; LLVM IR from TobiasKozel/VAE :: external/portaudio/src/os/unix (pa_unix_util)

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

%union.pthread_attr_t = type { i64, [48 x i8] }
%union.pthread_condattr_t = type { i32 }
%struct.sched_param = type { i32 }
%struct.timespec = type { i64, i64 }
%struct.PaUnixThread = type { i64, i32, i32, i32, %struct.PaUnixMutex, %union.pthread_cond_t, i32 }
%struct.PaUnixMutex = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }

@paUtilErr_ = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.PaUnixThread_New = external hidden unnamed_addr constant [81 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [160 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [186 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [195 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [163 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [165 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [157 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [143 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

; Function Attrs: nounwind uwtable
declare dso_local double @PaUtil_GetTime() #1

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @PaUnixThread_New(ptr noundef %0, ptr noundef %1, ptr noundef %2, double noundef %3, i32 noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %union.pthread_attr_t, align 8
  %14 = alloca %union.pthread_condattr_t, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.sched_param, align 4
  %18 = alloca double, align 8
  %19 = alloca %struct.timespec, align 8
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store double %3, ptr %10, align 8, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 56, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !11
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %23, i8 0, i64 120, i1 false)
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.PaUnixThread, ptr %24, i32 0, i32 4
  %26 = call i32 @PaUnixMutex_Initialize(ptr noundef %25)
  %27 = call i32 @pthread_condattr_init(ptr noundef %14) #8
  store i32 %27, ptr @paUtilErr_, align 4, !tbaa !11
  %28 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  %29 = icmp eq i32 0, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %5
  br label %32

31:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 282, ptr noundef @__PRETTY_FUNCTION__.PaUnixThread_New) #9
  unreachable

32:                                               ; preds = %30
  %33 = call i32 @pthread_condattr_setclock(ptr noundef %14, i32 noundef 1) #8
  store i32 %33, ptr @paUtilErr_, align 4, !tbaa !11
  %34 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  %35 = icmp eq i32 0, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  br label %38

37:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 284, ptr noundef @__PRETTY_FUNCTION__.PaUnixThread_New) #9
  unreachable

38:                                               ; preds = %36
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.PaUnixThread, ptr %39, i32 0, i32 5
  %41 = call i32 @pthread_cond_init(ptr noundef %40, ptr noundef %14) #8
  store i32 %41, ptr @paUtilErr_, align 4, !tbaa !11
  %42 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  %43 = icmp eq i32 0, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  br label %46

45:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 286, ptr noundef @__PRETTY_FUNCTION__.PaUnixThread_New) #9
  unreachable

46:                                               ; preds = %44
  %47 = load double, ptr %10, align 8, !tbaa !9
  %48 = fcmp une double 0.000000e+00, %47
  %49 = zext i1 %48 to i32
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.PaUnixThread, ptr %50, i32 0, i32 1
  store i32 %49, ptr %51, align 8, !tbaa !13
  br label %52

52:                                               ; preds = %46
  %53 = call i32 @pthread_attr_init(ptr noundef %13) #8
  %54 = icmp ne i32 %53, 0
  %55 = xor i1 %54, true
  %56 = zext i1 %55 to i32
  %57 = icmp eq i32 %56, 0
  %58 = zext i1 %57 to i32
  %59 = sext i32 %58 to i64
  %60 = call i64 @llvm.expect.i64(i64 %59, i64 0)
  %61 = icmp ne i64 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %52
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.2)
  store i32 -9986, ptr %12, align 4, !tbaa !11
  br label %233

63:                                               ; preds = %52
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  br label %66

66:                                               ; preds = %65
  %67 = call i32 @pthread_attr_setscope(ptr noundef %13, i32 noundef 0) #8
  %68 = icmp ne i32 %67, 0
  %69 = xor i1 %68, true
  %70 = zext i1 %69 to i32
  %71 = icmp eq i32 %70, 0
  %72 = zext i1 %71 to i32
  %73 = sext i32 %72 to i64
  %74 = call i64 @llvm.expect.i64(i64 %73, i64 0)
  %75 = icmp ne i64 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %66
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.3)
  store i32 -9986, ptr %12, align 4, !tbaa !11
  br label %233

77:                                               ; preds = %66
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.PaUnixThread, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = call i32 @pthread_create(ptr noundef %82, ptr noundef %13, ptr noundef %83, ptr noundef %84) #8
  %86 = icmp ne i32 %85, 0
  %87 = xor i1 %86, true
  %88 = zext i1 %87 to i32
  %89 = icmp eq i32 %88, 0
  %90 = zext i1 %89 to i32
  %91 = sext i32 %90 to i64
  %92 = call i64 @llvm.expect.i64(i64 %91, i64 0)
  %93 = icmp ne i64 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %80
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.4)
  store i32 -9986, ptr %12, align 4, !tbaa !11
  br label %233

95:                                               ; preds = %80
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  store i32 1, ptr %15, align 4, !tbaa !11
  %98 = load i32, ptr %11, align 4, !tbaa !11
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %118

100:                                              ; preds = %97
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = call i32 @BoostPriority(ptr noundef %102)
  store i32 %103, ptr @paUtilErr_, align 4, !tbaa !11
  %104 = icmp slt i32 %103, 0
  %105 = zext i1 %104 to i32
  %106 = sext i32 %105 to i64
  %107 = call i64 @llvm.expect.i64(i64 %106, i64 0)
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %101
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.5)
  %110 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  store i32 %110, ptr %12, align 4, !tbaa !11
  br label %233

111:                                              ; preds = %101
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.PaUnixThread, ptr %114, i32 0, i32 0
  %116 = load i64, ptr %115, align 8, !tbaa !17
  %117 = call i32 @pthread_getschedparam(i64 noundef %116, ptr noundef %16, ptr noundef %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %118

118:                                              ; preds = %113, %97
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.PaUnixThread, ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 8, !tbaa !13
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %230

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.PaUnixThread, ptr %125, i32 0, i32 4
  %127 = call i32 @PaUnixMutex_Lock(ptr noundef %126)
  store i32 %127, ptr @paUtilErr_, align 4, !tbaa !11
  %128 = icmp slt i32 %127, 0
  %129 = zext i1 %128 to i32
  %130 = sext i32 %129 to i64
  %131 = call i64 @llvm.expect.i64(i64 %130, i64 0)
  %132 = icmp ne i64 %131, 0
  br i1 %132, label %133, label %135

133:                                              ; preds = %124
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.6)
  %134 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  store i32 %134, ptr %12, align 4, !tbaa !11
  store i32 4, ptr %22, align 4
  br label %227

135:                                              ; preds = %124
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %138 = call double @PaUtil_GetTime()
  store double %138, ptr %21, align 8, !tbaa !9
  %139 = load double, ptr %21, align 8, !tbaa !9
  %140 = load double, ptr %10, align 8, !tbaa !9
  %141 = fadd double %139, %140
  store double %141, ptr %18, align 8, !tbaa !9
  br label %142

142:                                              ; preds = %181, %137
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.PaUnixThread, ptr %143, i32 0, i32 1
  %145 = load i32, ptr %144, align 8, !tbaa !13
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %151

147:                                              ; preds = %142
  %148 = load i32, ptr %20, align 4, !tbaa !11
  %149 = icmp ne i32 %148, 0
  %150 = xor i1 %149, true
  br label %151

151:                                              ; preds = %147, %142
  %152 = phi i1 [ false, %142 ], [ %150, %147 ]
  br i1 %152, label %153, label %182

153:                                              ; preds = %151
  %154 = load double, ptr %10, align 8, !tbaa !9
  %155 = fcmp ogt double %154, 0.000000e+00
  br i1 %155, label %156, label %174

156:                                              ; preds = %153
  %157 = load double, ptr %18, align 8, !tbaa !9
  %158 = call double @llvm.floor.f64(double %157)
  %159 = fptosi double %158 to i64
  %160 = getelementptr inbounds %struct.timespec, ptr %19, i32 0, i32 0
  store i64 %159, ptr %160, align 8, !tbaa !18
  %161 = load double, ptr %18, align 8, !tbaa !9
  %162 = load double, ptr %18, align 8, !tbaa !9
  %163 = call double @llvm.floor.f64(double %162)
  %164 = fsub double %161, %163
  %165 = fmul double %164, 1.000000e+09
  %166 = fptosi double %165 to i64
  %167 = getelementptr inbounds %struct.timespec, ptr %19, i32 0, i32 1
  store i64 %166, ptr %167, align 8, !tbaa !20
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.PaUnixThread, ptr %168, i32 0, i32 5
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.PaUnixThread, ptr %170, i32 0, i32 4
  %172 = getelementptr inbounds %struct.PaUnixMutex, ptr %171, i32 0, i32 0
  %173 = call i32 @pthread_cond_timedwait(ptr noundef %169, ptr noundef %172, ptr noundef %19)
  store i32 %173, ptr %20, align 4, !tbaa !11
  br label %181

174:                                              ; preds = %153
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.PaUnixThread, ptr %175, i32 0, i32 5
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.PaUnixThread, ptr %177, i32 0, i32 4
  %179 = getelementptr inbounds %struct.PaUnixMutex, ptr %178, i32 0, i32 0
  %180 = call i32 @pthread_cond_wait(ptr noundef %176, ptr noundef %179)
  store i32 %180, ptr %20, align 4, !tbaa !11
  br label %181

181:                                              ; preds = %174, %156
  br label %142, !llvm.loop !21

182:                                              ; preds = %151
  br label %183

183:                                              ; preds = %182
  %184 = load ptr, ptr %7, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.PaUnixThread, ptr %184, i32 0, i32 4
  %186 = call i32 @PaUnixMutex_Unlock(ptr noundef %185)
  store i32 %186, ptr @paUtilErr_, align 4, !tbaa !11
  %187 = icmp slt i32 %186, 0
  %188 = zext i1 %187 to i32
  %189 = sext i32 %188 to i64
  %190 = call i64 @llvm.expect.i64(i64 %189, i64 0)
  %191 = icmp ne i64 %190, 0
  br i1 %191, label %192, label %194

192:                                              ; preds = %183
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.7)
  %193 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  store i32 %193, ptr %12, align 4, !tbaa !11
  store i32 4, ptr %22, align 4
  br label %227

194:                                              ; preds = %183
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %20, align 4, !tbaa !11
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %203

200:                                              ; preds = %197
  %201 = load i32, ptr %20, align 4, !tbaa !11
  %202 = icmp eq i32 110, %201
  br label %203

203:                                              ; preds = %200, %197
  %204 = phi i1 [ true, %197 ], [ %202, %200 ]
  %205 = zext i1 %204 to i32
  %206 = icmp eq i32 %205, 0
  %207 = zext i1 %206 to i32
  %208 = sext i32 %207 to i64
  %209 = call i64 @llvm.expect.i64(i64 %208, i64 0)
  %210 = icmp ne i64 %209, 0
  br i1 %210, label %211, label %212

211:                                              ; preds = %203
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.8)
  store i32 -9986, ptr %12, align 4, !tbaa !11
  store i32 4, ptr %22, align 4
  br label %227

212:                                              ; preds = %203
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %20, align 4, !tbaa !11
  %216 = icmp eq i32 110, %215
  br i1 %216, label %217, label %226

217:                                              ; preds = %214
  br label %218

218:                                              ; preds = %217
  store i32 -9987, ptr @paUtilErr_, align 4, !tbaa !11
  %219 = call i64 @llvm.expect.i64(i64 1, i64 0)
  %220 = icmp ne i64 %219, 0
  br i1 %220, label %221, label %223

221:                                              ; preds = %218
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef @.str.9)
  %222 = load i32, ptr @paUtilErr_, align 4, !tbaa !11
  store i32 %222, ptr %12, align 4, !tbaa !11
  store i32 4, ptr %22, align 4
  br label %227

223:                                              ; preds = %218
  br label %224

224:                                              ; preds = %223
  br label %225

225:                                              ; preds = %224
  br label %226

226:                                              ; preds = %225, %214
  store i32 0, ptr %22, align 4
  br label %227

227:                                              ; preds = %226, %221, %211, %192, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  %228 = load i32, ptr %22, align 4
  switch i32 %228, label %240 [
    i32 0, label %229
    i32 4, label %233
  ]

229:                                              ; preds = %227
  br label %230

230:                                              ; preds = %229, %118
  br label %231

231:                                              ; preds = %239, %230
  %232 = load i32, ptr %12, align 4, !tbaa !11
  store i32 %232, ptr %6, align 4
  store i32 1, ptr %22, align 4
  br label %240

233:                                              ; preds = %227, %109, %94, %76, %62
  %234 = load i32, ptr %15, align 4, !tbaa !11
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %236, label %239

236:                                              ; preds = %233
  %237 = load ptr, ptr %7, align 8, !tbaa !5
  %238 = call i32 @PaUnixThread_Terminate(ptr noundef %237, i32 noundef 0, ptr noundef null)
  br label %239

239:                                              ; preds = %236, %233
  br label %231

240:                                              ; preds = %231, %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  %241 = load i32, ptr %6, align 4
  ret i32 %241
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaUnixMutex_Initialize(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @pthread_condattr_init(ptr noundef) #2

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

; Function Attrs: nounwind
declare i32 @pthread_condattr_setclock(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_cond_init(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_attr_init(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

declare void @PaUtil_DebugPrint(ptr noundef, ...) #6

; Function Attrs: nounwind
declare i32 @pthread_attr_setscope(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @BoostPriority(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @pthread_getschedparam(i64 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaUnixMutex_Lock(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #7

declare i32 @pthread_cond_timedwait(ptr noundef, ptr noundef, ptr noundef) #6

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) #6

; Function Attrs: nounwind uwtable
declare dso_local i32 @PaUnixMutex_Unlock(ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { "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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"", !15, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !16, i64 24, !7, i64 64, !12, i64 112}
!15 = !{!"long", !7, i64 0}
!16 = !{!"", !7, i64 0}
!17 = !{!14, !15, i64 0}
!18 = !{!19, !15, i64 0}
!19 = !{!"timespec", !15, i64 0, !15, i64 8}
!20 = !{!19, !15, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"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"

%union.pthread_attr_t = type { i64, [48 x i8] }
%union.pthread_condattr_t = type { i32 }
%struct.sched_param = type { i32 }
%struct.timespec = type { i64, i64 }

@paUtilErr_ = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.PaUnixThread_New = external hidden unnamed_addr constant [81 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [160 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [186 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [195 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [163 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [165 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [157 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [143 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: nounwind uwtable
declare dso_local double @PaUtil_GetTime() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @PaUnixThread_New(ptr noundef %0, ptr noundef %1, ptr noundef %2, double noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = alloca %union.pthread_attr_t, align 8
  %7 = alloca %union.pthread_condattr_t, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.sched_param, align 4
  %10 = alloca %struct.timespec, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(120) %0, i8 0, i64 120, i1 false)
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = tail call i32 @PaUnixMutex_Initialize(ptr noundef nonnull %11)
  %13 = call i32 @pthread_condattr_init(ptr noundef nonnull %7) #7
  store i32 %13, ptr @paUtilErr_, align 4, !tbaa !5
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %16, label %15

15:                                               ; preds = %5
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 282, ptr noundef nonnull @__PRETTY_FUNCTION__.PaUnixThread_New) #8
  unreachable

16:                                               ; preds = %5
  %17 = call i32 @pthread_condattr_setclock(ptr noundef nonnull %7, i32 noundef 1) #7
  store i32 %17, ptr @paUtilErr_, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 284, ptr noundef nonnull @__PRETTY_FUNCTION__.PaUnixThread_New) #8
  unreachable

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 64
  %22 = call i32 @pthread_cond_init(ptr noundef nonnull %21, ptr noundef nonnull %7) #7
  store i32 %22, ptr @paUtilErr_, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 286, ptr noundef nonnull @__PRETTY_FUNCTION__.PaUnixThread_New) #8
  unreachable

25:                                               ; preds = %20
  %26 = fcmp une double %3, 0.000000e+00
  %27 = zext i1 %26 to i32
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %27, ptr %28, align 8, !tbaa !9
  %29 = call i32 @pthread_attr_init(ptr noundef nonnull %6) #7
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %31, label %30, !prof !13

30:                                               ; preds = %25
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.2) #7
  br label %.thread49

31:                                               ; preds = %25
  %32 = call i32 @pthread_attr_setscope(ptr noundef nonnull %6, i32 noundef 0) #7
  %.not38 = icmp eq i32 %32, 0
  br i1 %.not38, label %34, label %33, !prof !13

33:                                               ; preds = %31
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.3) #7
  br label %.thread49

34:                                               ; preds = %31
  %35 = call i32 @pthread_create(ptr noundef nonnull %0, ptr noundef nonnull %6, ptr noundef %1, ptr noundef %2) #7
  %.not39 = icmp eq i32 %35, 0
  br i1 %.not39, label %37, label %36, !prof !13

36:                                               ; preds = %34
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.4) #7
  br label %.thread49

37:                                               ; preds = %34
  %.not40 = icmp eq i32 %4, 0
  br i1 %.not40, label %46, label %38

38:                                               ; preds = %37
  %39 = call i32 @BoostPriority(ptr noundef nonnull %0)
  store i32 %39, ptr @paUtilErr_, align 4, !tbaa !5
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %43, !prof !14

41:                                               ; preds = %38
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.5) #7
  %42 = load i32, ptr @paUtilErr_, align 4, !tbaa !5
  br label %81

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %44 = load i64, ptr %0, align 8, !tbaa !15
  %45 = call i32 @pthread_getschedparam(i64 noundef %44, ptr noundef nonnull %8, ptr noundef nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  br label %46

46:                                               ; preds = %43, %37
  %47 = load i32, ptr %28, align 8, !tbaa !9
  %.not41 = icmp eq i32 %47, 0
  br i1 %.not41, label %.thread49, label %48

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  %49 = call i32 @PaUnixMutex_Lock(ptr noundef nonnull %11)
  store i32 %49, ptr @paUtilErr_, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %53, !prof !14

51:                                               ; preds = %48
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.6) #7
  %52 = load i32, ptr @paUtilErr_, align 4, !tbaa !5
  br label %.thread

53:                                               ; preds = %48
  %54 = call double @PaUtil_GetTime()
  %55 = load i32, ptr %28, align 8, !tbaa !9
  %.not52 = icmp eq i32 %55, 0
  br i1 %.not52, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %53
  %56 = fadd double %54, %3
  %57 = fcmp ogt double %3, 0.000000e+00
  %58 = call double @llvm.floor.f64(double %56)
  %59 = fptosi double %58 to i64
  %60 = fsub double %56, %58
  %61 = fmul double %60, 1.000000e+09
  %62 = fptosi double %61 to i64
  %63 = getelementptr inbounds i8, ptr %10, i64 8
  br i1 %57, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  store i64 %59, ptr %10, align 8, !tbaa !16
  store i64 %62, ptr %63, align 8, !tbaa !18
  %64 = call i32 @pthread_cond_timedwait(ptr noundef nonnull %21, ptr noundef nonnull %11, ptr noundef nonnull %10) #7
  %65 = load i32, ptr %28, align 8, !tbaa !9
  %66 = icmp ne i32 %65, 0
  %.not42.us = icmp eq i32 %64, 0
  %67 = select i1 %66, i1 %.not42.us, i1 false
  br i1 %67, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !19

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  %68 = call i32 @pthread_cond_wait(ptr noundef nonnull %21, ptr noundef nonnull %11) #7
  %69 = load i32, ptr %28, align 8, !tbaa !9
  %70 = icmp ne i32 %69, 0
  %.not42 = icmp eq i32 %68, 0
  %71 = select i1 %70, i1 %.not42, i1 false
  br i1 %71, label %.lr.ph.split, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph.split, %.lr.ph.split.us, %53
  %.034.lcssa = phi i32 [ 0, %53 ], [ %64, %.lr.ph.split.us ], [ %68, %.lr.ph.split ]
  %72 = call i32 @PaUnixMutex_Unlock(ptr noundef nonnull %11)
  store i32 %72, ptr @paUtilErr_, align 4, !tbaa !5
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %76, !prof !14

74:                                               ; preds = %._crit_edge
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.7) #7
  %75 = load i32, ptr @paUtilErr_, align 4, !tbaa !5
  br label %.thread

76:                                               ; preds = %._crit_edge
  switch i32 %.034.lcssa, label %77 [
    i32 110, label %78
    i32 0, label %80
  ]

77:                                               ; preds = %76
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.8) #7
  br label %.thread

78:                                               ; preds = %76
  store i32 -9987, ptr @paUtilErr_, align 4, !tbaa !5
  call void (ptr, ...) @PaUtil_DebugPrint(ptr noundef nonnull @.str.9) #7
  %79 = load i32, ptr @paUtilErr_, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %51, %74, %77, %78
  %.035.ph = phi i32 [ %79, %78 ], [ -9986, %77 ], [ %75, %74 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br label %81

80:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br label %.thread49

81:                                               ; preds = %41, %.thread
  %.2 = phi i32 [ %42, %41 ], [ %.035.ph, %.thread ]
  %82 = call i32 @PaUnixThread_Terminate(ptr noundef nonnull %0, i32 noundef 0, ptr noundef null)
  br label %.thread49

.thread49:                                        ; preds = %36, %33, %30, %80, %46, %81
  %.136 = phi i32 [ %.2, %81 ], [ 0, %80 ], [ 0, %46 ], [ -9986, %30 ], [ -9986, %33 ], [ -9986, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %6) #7
  ret i32 %.136
}

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

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

; Function Attrs: nounwind
declare i32 @pthread_condattr_init(ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind
declare i32 @pthread_attr_init(ptr noundef) local_unnamed_addr #2

declare void @PaUtil_DebugPrint(ptr noundef, ...) local_unnamed_addr #5

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

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

; Function Attrs: nounwind
declare i32 @pthread_getschedparam(i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #6

declare i32 @pthread_cond_timedwait(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"", !11, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !12, i64 24, !7, i64 64, !6, i64 112}
!11 = !{!"long", !7, i64 0}
!12 = !{!"", !7, i64 0}
!13 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!14 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!15 = !{!10, !11, i64 0}
!16 = !{!17, !11, i64 0}
!17 = !{!"timespec", !11, i64 0, !11, i64 8}
!18 = !{!17, !11, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass