; LLVM IR from golems/ach :: src (event)

; 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.timespec = type { i64, i64 }
%struct.ach_evhandler = type { ptr, ptr, ptr }
%struct.pollfd = type { i32, i16, i16 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__.ach_evhandle = external hidden unnamed_addr constant [128 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @ach_evhandle(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, i32 noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca %struct.timespec, align 8
  %26 = alloca %struct.timespec, align 8
  %27 = alloca %struct.timespec, align 8
  %28 = alloca ptr, align 8
  %29 = alloca i64, align 8
  %30 = alloca i32, align 4
  %31 = alloca i64, align 8
  %32 = alloca %struct.timespec, align 8
  %33 = alloca i32, align 4
  %34 = alloca ptr, align 8
  %35 = alloca i64, align 8
  %36 = alloca i64, align 8
  %37 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store i32 %5, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 0, ptr %15, align 8, !tbaa !9
  %38 = load i64, ptr %9, align 8, !tbaa !9
  %39 = call ptr @llvm.stacksave.p0()
  store ptr %39, ptr %16, align 8
  %40 = alloca i32, i64 %38, align 16
  store i64 %38, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 -1, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #8
  %41 = load i32, ptr %13, align 4, !tbaa !11
  %42 = and i32 %41, 2
  %43 = icmp ne i32 %42, 0
  %44 = zext i1 %43 to i8
  store i8 %44, ptr %19, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #8
  %45 = load i32, ptr %13, align 4, !tbaa !11
  %46 = and i32 %45, 1
  %47 = icmp ne i32 %46, 0
  %48 = zext i1 %47 to i8
  store i8 %48, ptr %20, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  store i64 0, ptr %21, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %74, %6
  %50 = load i64, ptr %21, align 8, !tbaa !9
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = icmp ult i64 %50, %51
  br i1 %52, label %53, label %77

53:                                               ; preds = %49
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load i64, ptr %21, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.ach_evhandler, ptr %54, i64 %55
  %57 = getelementptr inbounds %struct.ach_evhandler, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  %59 = load i64, ptr %21, align 8, !tbaa !9
  %60 = getelementptr inbounds i32, ptr %40, i64 %59
  %61 = call i32 @ach_channel_map(ptr noundef %58, ptr noundef %60)
  store i32 %61, ptr %14, align 4, !tbaa !11
  %62 = icmp ne i32 0, %61
  br i1 %62, label %63, label %65

63:                                               ; preds = %53
  %64 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %64, ptr %7, align 4
  store i32 1, ptr %23, align 4
  br label %330

65:                                               ; preds = %53
  %66 = load i64, ptr %21, align 8, !tbaa !9
  %67 = getelementptr inbounds i32, ptr %40, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = icmp eq i32 3, %68
  br i1 %69, label %70, label %73

70:                                               ; preds = %65
  %71 = load i64, ptr %15, align 8, !tbaa !9
  %72 = add i64 %71, 1
  store i64 %72, ptr %15, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %70, %65
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %21, align 8, !tbaa !9
  %76 = add i64 %75, 1
  store i64 %76, ptr %21, align 8, !tbaa !9
  br label %49, !llvm.loop !17

77:                                               ; preds = %49
  %78 = load i64, ptr %15, align 8, !tbaa !9
  %79 = load i64, ptr %9, align 8, !tbaa !9
  %80 = icmp eq i64 %78, %79
  br i1 %80, label %85, label %81

81:                                               ; preds = %77
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = icmp ne ptr %82, null
  br i1 %83, label %85, label %84

84:                                               ; preds = %81
  store i32 19, ptr %7, align 4
  store i32 1, ptr %23, align 4
  br label %330

85:                                               ; preds = %81, %77
  %86 = load i64, ptr %15, align 8, !tbaa !9
  %87 = alloca %struct.pollfd, i64 %86, align 16
  store i64 %86, ptr %24, align 8
  %88 = call ptr @__errno_location() #9
  store i32 0, ptr %88, align 4, !tbaa !11
  %89 = load i64, ptr %15, align 8, !tbaa !9
  %90 = icmp ne i64 %89, 0
  br i1 %90, label %91, label %122

91:                                               ; preds = %85
  store i64 0, ptr %21, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %118, %91
  %93 = load i64, ptr %21, align 8, !tbaa !9
  %94 = load i64, ptr %9, align 8, !tbaa !9
  %95 = icmp ult i64 %93, %94
  br i1 %95, label %96, label %121

96:                                               ; preds = %92
  %97 = load i64, ptr %21, align 8, !tbaa !9
  %98 = getelementptr inbounds i32, ptr %40, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %100 = icmp eq i32 3, %99
  br i1 %100, label %101, label %117

101:                                              ; preds = %96
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = load i64, ptr %21, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.ach_evhandler, ptr %102, i64 %103
  %105 = getelementptr inbounds %struct.ach_evhandler, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !15
  %107 = load i64, ptr %21, align 8, !tbaa !9
  %108 = getelementptr inbounds %struct.pollfd, ptr %87, i64 %107
  %109 = getelementptr inbounds %struct.pollfd, ptr %108, i32 0, i32 0
  %110 = call i32 @ach_channel_fd(ptr noundef %106, ptr noundef %109)
  store i32 %110, ptr %14, align 4, !tbaa !11
  %111 = icmp ne i32 0, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %101
  br label %310

113:                                              ; preds = %101
  %114 = load i64, ptr %21, align 8, !tbaa !9
  %115 = getelementptr inbounds %struct.pollfd, ptr %87, i64 %114
  %116 = getelementptr inbounds %struct.pollfd, ptr %115, i32 0, i32 1
  store i16 1, ptr %116, align 4, !tbaa !19
  br label %117

117:                                              ; preds = %113, %96
  br label %118

118:                                              ; preds = %117
  %119 = load i64, ptr %21, align 8, !tbaa !9
  %120 = add i64 %119, 1
  store i64 %120, ptr %21, align 8, !tbaa !9
  br label %92, !llvm.loop !22

121:                                              ; preds = %92
  br label %122

122:                                              ; preds = %121, %85
  store i64 0, ptr %29, align 8, !tbaa !9
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = icmp ne ptr %123, null
  br i1 %124, label %125, label %136

125:                                              ; preds = %122
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %126, i64 16, i1 false), !tbaa.struct !23
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.timespec, ptr %127, i32 0, i32 0
  %129 = load i64, ptr %128, align 8, !tbaa !24
  %130 = mul nsw i64 %129, 1000000000
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.timespec, ptr %131, i32 0, i32 1
  %133 = load i64, ptr %132, align 8, !tbaa !26
  %134 = add nsw i64 %130, %133
  store i64 %134, ptr %29, align 8, !tbaa !9
  %135 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %26) #8
  store ptr %27, ptr %28, align 8, !tbaa !5
  br label %137

136:                                              ; preds = %122
  store ptr null, ptr %28, align 8, !tbaa !5
  br label %137

137:                                              ; preds = %136, %125
  br label %138

138:                                              ; preds = %306, %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #8
  store i32 0, ptr %30, align 4, !tbaa !11
  %139 = load i64, ptr %15, align 8, !tbaa !9
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %141, label %149

141:                                              ; preds = %138
  %142 = load i64, ptr %15, align 8, !tbaa !9
  %143 = load ptr, ptr %28, align 8, !tbaa !5
  %144 = call i32 @ppoll(ptr noundef %87, i64 noundef %142, ptr noundef %143, ptr noundef null)
  store i32 %144, ptr %30, align 4, !tbaa !11
  %145 = load i32, ptr %30, align 4, !tbaa !11
  %146 = icmp slt i32 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %141
  store i32 4, ptr %14, align 4, !tbaa !11
  store i32 8, ptr %23, align 4
  br label %303

148:                                              ; preds = %141
  br label %175

149:                                              ; preds = %138
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %153

152:                                              ; preds = %149
  br label %154

153:                                              ; preds = %149
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 116, ptr noundef @__PRETTY_FUNCTION__.ach_evhandle) #10
  unreachable

154:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #8
  %155 = getelementptr inbounds %struct.timespec, ptr %26, i32 0, i32 1
  %156 = load i64, ptr %155, align 8, !tbaa !26
  %157 = load i64, ptr %29, align 8, !tbaa !9
  %158 = add i64 %156, %157
  store i64 %158, ptr %31, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %32) #8
  %159 = getelementptr inbounds %struct.timespec, ptr %32, i32 0, i32 0
  %160 = getelementptr inbounds %struct.timespec, ptr %26, i32 0, i32 0
  %161 = load i64, ptr %160, align 8, !tbaa !24
  %162 = load i64, ptr %31, align 8, !tbaa !9
  %163 = udiv i64 %162, 1000000000
  %164 = add nsw i64 %161, %163
  store i64 %164, ptr %159, align 8, !tbaa !24
  %165 = getelementptr inbounds %struct.timespec, ptr %32, i32 0, i32 1
  %166 = load i64, ptr %31, align 8, !tbaa !9
  %167 = urem i64 %166, 1000000000
  store i64 %167, ptr %165, align 8, !tbaa !26
  %168 = call i32 @clock_nanosleep(i32 noundef 1, i32 noundef 1, ptr noundef %32, ptr noundef null)
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %171

170:                                              ; preds = %154
  store i32 8, ptr %23, align 4
  br label %172

171:                                              ; preds = %154
  store i32 0, ptr %23, align 4
  br label %172

172:                                              ; preds = %171, %170
  call void @llvm.lifetime.end.p0(i64 16, ptr %32) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #8
  %173 = load i32, ptr %23, align 4
  switch i32 %173, label %303 [
    i32 0, label %174
  ]

174:                                              ; preds = %172
  br label %175

175:                                              ; preds = %174, %148
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %180

178:                                              ; preds = %175
  %179 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %25) #8
  br label %180

180:                                              ; preds = %178, %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #8
  store i32 0, ptr %33, align 4, !tbaa !11
  store i64 0, ptr %21, align 8, !tbaa !9
  store i64 0, ptr %22, align 8, !tbaa !9
  br label %181

181:                                              ; preds = %240, %180
  %182 = load i64, ptr %21, align 8, !tbaa !9
  %183 = load i64, ptr %9, align 8, !tbaa !9
  %184 = icmp ult i64 %182, %183
  br i1 %184, label %185, label %243

185:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #8
  %186 = load ptr, ptr %8, align 8, !tbaa !5
  %187 = load i64, ptr %21, align 8, !tbaa !9
  %188 = getelementptr inbounds %struct.ach_evhandler, ptr %186, i64 %187
  store ptr %188, ptr %34, align 8, !tbaa !5
  %189 = load i64, ptr %21, align 8, !tbaa !9
  %190 = getelementptr inbounds i32, ptr %40, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !11
  %192 = icmp eq i32 2, %191
  br i1 %192, label %215, label %193

193:                                              ; preds = %185
  %194 = load i64, ptr %21, align 8, !tbaa !9
  %195 = getelementptr inbounds i32, ptr %40, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !11
  %197 = icmp eq i32 1, %196
  br i1 %197, label %215, label %198

198:                                              ; preds = %193
  %199 = load i32, ptr %30, align 4, !tbaa !11
  %200 = icmp sgt i32 %199, 0
  br i1 %200, label %201, label %230

201:                                              ; preds = %198
  %202 = load i64, ptr %21, align 8, !tbaa !9
  %203 = getelementptr inbounds i32, ptr %40, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !11
  %205 = icmp eq i32 3, %204
  br i1 %205, label %206, label %230

206:                                              ; preds = %201
  %207 = load i64, ptr %22, align 8, !tbaa !9
  %208 = add i64 %207, 1
  store i64 %208, ptr %22, align 8, !tbaa !9
  %209 = getelementptr inbounds %struct.pollfd, ptr %87, i64 %207
  %210 = getelementptr inbounds %struct.pollfd, ptr %209, i32 0, i32 2
  %211 = load i16, ptr %210, align 2, !tbaa !27
  %212 = sext i16 %211 to i32
  %213 = and i32 %212, 1
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %230

215:                                              ; preds = %206, %193, %185
  %216 = load ptr, ptr %34, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.ach_evhandler, ptr %216, i32 0, i32 2
  %218 = load ptr, ptr %217, align 8, !tbaa !28
  %219 = load ptr, ptr %34, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.ach_evhandler, ptr %219, i32 0, i32 1
  %221 = load ptr, ptr %220, align 8, !tbaa !29
  %222 = load ptr, ptr %34, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.ach_evhandler, ptr %222, i32 0, i32 0
  %224 = load ptr, ptr %223, align 8, !tbaa !15
  %225 = call i32 %218(ptr noundef %221, ptr noundef %224)
  store i32 %225, ptr %14, align 4, !tbaa !11
  switch i32 %225, label %228 [
    i32 0, label %226
    i32 5, label %227
  ]

226:                                              ; preds = %215
  store i32 1, ptr %33, align 4, !tbaa !11
  br label %227

227:                                              ; preds = %226, %215
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %229

228:                                              ; preds = %215
  store i32 8, ptr %23, align 4
  br label %237

229:                                              ; preds = %227
  br label %230

230:                                              ; preds = %229, %206, %201, %198
  %231 = load i64, ptr %22, align 8, !tbaa !9
  %232 = load i64, ptr %15, align 8, !tbaa !9
  %233 = icmp ule i64 %231, %232
  br i1 %233, label %234, label %235

234:                                              ; preds = %230
  br label %236

235:                                              ; preds = %230
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 138, ptr noundef @__PRETTY_FUNCTION__.ach_evhandle) #10
  unreachable

236:                                              ; preds = %234
  store i32 0, ptr %23, align 4
  br label %237

237:                                              ; preds = %236, %228
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #8
  %238 = load i32, ptr %23, align 4
  switch i32 %238, label %302 [
    i32 0, label %239
  ]

239:                                              ; preds = %237
  br label %240

240:                                              ; preds = %239
  %241 = load i64, ptr %21, align 8, !tbaa !9
  %242 = add i64 %241, 1
  store i64 %242, ptr %21, align 8, !tbaa !9
  br label %181, !llvm.loop !30

243:                                              ; preds = %181
  %244 = load i32, ptr %33, align 4, !tbaa !11
  %245 = icmp ne i32 %244, 0
  br i1 %245, label %246, label %256

246:                                              ; preds = %243
  %247 = load ptr, ptr %11, align 8, !tbaa !5
  %248 = icmp ne ptr %247, null
  br i1 %248, label %249, label %256

249:                                              ; preds = %246
  %250 = load i8, ptr %19, align 1, !tbaa !13, !range !31, !noundef !32
  %251 = trunc i8 %250 to i1
  br i1 %251, label %252, label %256

252:                                              ; preds = %249
  %253 = load ptr, ptr %11, align 8, !tbaa !5
  %254 = load ptr, ptr %12, align 8, !tbaa !5
  %255 = call i32 %253(ptr noundef %254)
  store i32 %255, ptr %14, align 4, !tbaa !11
  br label %256

256:                                              ; preds = %252, %249, %246, %243
  %257 = load i32, ptr %14, align 4, !tbaa !11
  %258 = icmp eq i32 %257, 0
  br i1 %258, label %259, label %301

259:                                              ; preds = %256
  %260 = load ptr, ptr %10, align 8, !tbaa !5
  %261 = icmp ne ptr %260, null
  br i1 %261, label %262, label %301

262:                                              ; preds = %259
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #8
  %263 = getelementptr inbounds %struct.timespec, ptr %25, i32 0, i32 0
  %264 = load i64, ptr %263, align 8, !tbaa !24
  %265 = getelementptr inbounds %struct.timespec, ptr %26, i32 0, i32 0
  %266 = load i64, ptr %265, align 8, !tbaa !24
  %267 = sub nsw i64 %264, %266
  %268 = mul nsw i64 %267, 1000000000
  %269 = getelementptr inbounds %struct.timespec, ptr %25, i32 0, i32 1
  %270 = load i64, ptr %269, align 8, !tbaa !26
  %271 = getelementptr inbounds %struct.timespec, ptr %26, i32 0, i32 1
  %272 = load i64, ptr %271, align 8, !tbaa !26
  %273 = sub nsw i64 %270, %272
  %274 = add nsw i64 %268, %273
  store i64 %274, ptr %35, align 8, !tbaa !9
  %275 = load i64, ptr %35, align 8, !tbaa !9
  %276 = load i64, ptr %29, align 8, !tbaa !9
  %277 = icmp uge i64 %275, %276
  br i1 %277, label %278, label %290

278:                                              ; preds = %262
  %279 = load ptr, ptr %11, align 8, !tbaa !5
  %280 = icmp ne ptr %279, null
  br i1 %280, label %281, label %288

281:                                              ; preds = %278
  %282 = load i8, ptr %20, align 1, !tbaa !13, !range !31, !noundef !32
  %283 = trunc i8 %282 to i1
  br i1 %283, label %284, label %288

284:                                              ; preds = %281
  %285 = load ptr, ptr %11, align 8, !tbaa !5
  %286 = load ptr, ptr %12, align 8, !tbaa !5
  %287 = call i32 %285(ptr noundef %286)
  store i32 %287, ptr %14, align 4, !tbaa !11
  br label %288

288:                                              ; preds = %284, %281, %278
  %289 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %27, ptr align 8 %289, i64 16, i1 false), !tbaa.struct !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %25, i64 16, i1 false), !tbaa.struct !23
  br label %300

290:                                              ; preds = %262
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #8
  %291 = load i64, ptr %29, align 8, !tbaa !9
  %292 = load i64, ptr %35, align 8, !tbaa !9
  %293 = sub i64 %291, %292
  store i64 %293, ptr %36, align 8, !tbaa !9
  %294 = load i64, ptr %36, align 8, !tbaa !9
  %295 = udiv i64 %294, 1000000000
  %296 = getelementptr inbounds %struct.timespec, ptr %27, i32 0, i32 0
  store i64 %295, ptr %296, align 8, !tbaa !24
  %297 = load i64, ptr %36, align 8, !tbaa !9
  %298 = urem i64 %297, 1000000000
  %299 = getelementptr inbounds %struct.timespec, ptr %27, i32 0, i32 1
  store i64 %298, ptr %299, align 8, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #8
  br label %300

300:                                              ; preds = %290, %288
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #8
  br label %301

301:                                              ; preds = %300, %259, %256
  store i32 0, ptr %23, align 4
  br label %302

302:                                              ; preds = %301, %237
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #8
  br label %303

303:                                              ; preds = %302, %172, %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #8
  %304 = load i32, ptr %23, align 4
  switch i32 %304, label %330 [
    i32 0, label %305
    i32 8, label %310
  ]

305:                                              ; preds = %303
  br label %306

306:                                              ; preds = %305
  %307 = load i32, ptr %14, align 4, !tbaa !11
  %308 = icmp eq i32 0, %307
  br i1 %308, label %138, label %309, !llvm.loop !33

309:                                              ; preds = %306
  br label %310

310:                                              ; preds = %309, %303, %112
  %311 = load i32, ptr %18, align 4, !tbaa !11
  %312 = icmp sgt i32 %311, 0
  br i1 %312, label %313, label %328

313:                                              ; preds = %310
  %314 = call ptr @__errno_location() #9
  %315 = load i32, ptr %314, align 4, !tbaa !11
  %316 = icmp ne i32 %315, 0
  br i1 %316, label %317, label %324

317:                                              ; preds = %313
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #8
  %318 = call ptr @__errno_location() #9
  %319 = load i32, ptr %318, align 4, !tbaa !11
  store i32 %319, ptr %37, align 4, !tbaa !11
  %320 = load i32, ptr %18, align 4, !tbaa !11
  %321 = call i32 @close(i32 noundef %320)
  %322 = load i32, ptr %37, align 4, !tbaa !11
  %323 = call ptr @__errno_location() #9
  store i32 %322, ptr %323, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #8
  br label %327

324:                                              ; preds = %313
  %325 = load i32, ptr %18, align 4, !tbaa !11
  %326 = call i32 @close(i32 noundef %325)
  br label %327

327:                                              ; preds = %324, %317
  br label %328

328:                                              ; preds = %327, %310
  %329 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %329, ptr %7, align 4
  store i32 1, ptr %23, align 4
  br label %330

330:                                              ; preds = %328, %303, %84, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  %331 = load ptr, ptr %16, align 8
  call void @llvm.stackrestore.p0(ptr %331)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  %332 = load i32, ptr %7, align 4
  ret i32 %332
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

declare i32 @ach_channel_map(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

declare i32 @ach_channel_fd(ptr noundef, ptr noundef) #3

; 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 @clock_gettime(i32 noundef, ptr noundef) #6

declare i32 @ppoll(ptr noundef, i64 noundef, ptr noundef, ptr noundef) #3

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

declare i32 @clock_nanosleep(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

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

declare i32 @close(i32 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
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 willreturn memory(none) "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 "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 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"ach_evhandler", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !21, i64 4}
!20 = !{!"pollfd", !12, i64 0, !21, i64 4, !21, i64 6}
!21 = !{!"short", !7, i64 0}
!22 = distinct !{!22, !18}
!23 = !{i64 0, i64 8, !9, i64 8, i64 8, !9}
!24 = !{!25, !10, i64 0}
!25 = !{!"timespec", !10, i64 0, !10, i64 8}
!26 = !{!25, !10, i64 8}
!27 = !{!20, !21, i64 6}
!28 = !{!16, !6, i64 16}
!29 = !{!16, !6, i64 8}
!30 = distinct !{!30, !18}
!31 = !{i8 0, i8 2}
!32 = !{}
!33 = distinct !{!33, !18}


; 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.timespec = type { i64, i64 }
%struct.ach_evhandler = type { ptr, ptr, ptr }
%struct.pollfd = type { i32, i16, i16 }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__.ach_evhandle = external hidden unnamed_addr constant [128 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @ach_evhandle(ptr nocapture noundef readonly %0, i64 noundef %1, ptr noundef readonly %2, ptr noundef readonly %3, ptr noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = alloca %struct.timespec, align 8
  %8 = alloca %struct.timespec, align 8
  %9 = alloca %struct.timespec, align 8
  %10 = alloca %struct.timespec, align 8
  %11 = alloca i32, i64 %1, align 16
  %12 = and i32 %5, 2
  %.not = icmp eq i32 %12, 0
  %13 = and i32 %5, 1
  %.not121 = icmp eq i32 %13, 0
  %.not176 = icmp eq i64 %1, 0
  br i1 %.not176, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6, %18
  %.088163 = phi i64 [ %spec.select, %18 ], [ 0, %6 ]
  %.090162 = phi i64 [ %22, %18 ], [ 0, %6 ]
  %14 = getelementptr inbounds %struct.ach_evhandler, ptr %0, i64 %.090162
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i32, ptr %11, i64 %.090162
  %17 = call i32 @ach_channel_map(ptr noundef %15, ptr noundef nonnull %16) #7
  %.not129 = icmp eq i32 %17, 0
  br i1 %.not129, label %18, label %.thread146

18:                                               ; preds = %.lr.ph
  %19 = load i32, ptr %16, align 4, !tbaa !10
  %20 = icmp eq i32 %19, 3
  %21 = zext i1 %20 to i64
  %spec.select = add i64 %.088163, %21
  %22 = add nuw i64 %.090162, 1
  %exitcond.not = icmp eq i64 %22, %1
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %18, %6
  %.088.lcssa = phi i64 [ 0, %6 ], [ %spec.select, %18 ]
  %23 = icmp eq i64 %.088.lcssa, %1
  %24 = icmp ne ptr %2, null
  %or.cond = or i1 %24, %23
  br i1 %or.cond, label %25, label %.thread146

25:                                               ; preds = %._crit_edge
  %26 = alloca %struct.pollfd, i64 %.088.lcssa, align 16
  %27 = tail call ptr @__errno_location() #8
  store i32 0, ptr %27, align 4, !tbaa !10
  %.not122 = icmp ne i64 %.088.lcssa, 0
  %28 = icmp ne i64 %1, 0
  %or.cond175 = and i1 %.not122, %28
  br i1 %or.cond175, label %.lr.ph165, label %.loopexit

.lr.ph165:                                        ; preds = %25, %39
  %.191164 = phi i64 [ %40, %39 ], [ 0, %25 ]
  %29 = getelementptr inbounds i32, ptr %11, i64 %.191164
  %30 = load i32, ptr %29, align 4, !tbaa !10
  %31 = icmp eq i32 %30, 3
  br i1 %31, label %32, label %39

32:                                               ; preds = %.lr.ph165
  %33 = getelementptr inbounds %struct.ach_evhandler, ptr %0, i64 %.191164
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.pollfd, ptr %26, i64 %.191164
  %36 = call i32 @ach_channel_fd(ptr noundef %34, ptr noundef nonnull %35) #7
  %.not128 = icmp eq i32 %36, 0
  br i1 %.not128, label %37, label %.thread146

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %35, i64 4
  store i16 1, ptr %38, align 4, !tbaa !14
  br label %39

39:                                               ; preds = %.lr.ph165, %37
  %40 = add nuw i64 %.191164, 1
  %exitcond188.not = icmp eq i64 %40, %1
  br i1 %exitcond188.not, label %.loopexit, label %.lr.ph165, !llvm.loop !17

.loopexit:                                        ; preds = %39, %25
  br i1 %24, label %41, label %.split174

41:                                               ; preds = %.loopexit
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false), !tbaa.struct !18
  %42 = load i64, ptr %2, align 8, !tbaa !21
  %43 = mul nsw i64 %42, 1000000000
  %44 = getelementptr inbounds i8, ptr %2, i64 8
  %45 = load i64, ptr %44, align 8, !tbaa !23
  %46 = add nsw i64 %43, %45
  %47 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %8) #7
  br label %.split174

.split174:                                        ; preds = %41, %.loopexit
  %.0103 = phi ptr [ %9, %41 ], [ null, %.loopexit ]
  %.0102 = phi i64 [ %46, %41 ], [ 0, %.loopexit ]
  %48 = getelementptr inbounds i8, ptr %8, i64 8
  %49 = getelementptr inbounds i8, ptr %10, i64 8
  %50 = icmp eq ptr %3, null
  %51 = getelementptr inbounds i8, ptr %7, i64 8
  %brmerge132 = or i1 %50, %.not121
  %52 = getelementptr inbounds i8, ptr %9, i64 8
  br label %53

53:                                               ; preds = %126, %.split174
  br i1 %.not122, label %54, label %57

54:                                               ; preds = %53
  %55 = call i32 @ppoll(ptr noundef nonnull %26, i64 noundef %.088.lcssa, ptr noundef %.0103, ptr noundef null) #7
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %.thread146, label %67

57:                                               ; preds = %53
  br i1 %24, label %59, label %58

58:                                               ; preds = %57
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 116, ptr noundef nonnull @__PRETTY_FUNCTION__.ach_evhandle) #9
  unreachable

59:                                               ; preds = %57
  %60 = load i64, ptr %48, align 8, !tbaa !23
  %61 = add i64 %60, %.0102
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  %62 = load i64, ptr %8, align 8, !tbaa !21
  %63 = udiv i64 %61, 1000000000
  %64 = add nsw i64 %62, %63
  store i64 %64, ptr %10, align 8, !tbaa !21
  %65 = urem i64 %61, 1000000000
  store i64 %65, ptr %49, align 8, !tbaa !23
  %66 = call i32 @clock_nanosleep(i32 noundef 1, i32 noundef 1, ptr noundef nonnull %10, ptr noundef null) #7
  %.not123 = icmp eq i32 %66, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  br i1 %.not123, label %.thread, label %.thread146

67:                                               ; preds = %54
  br i1 %24, label %.thread, label %69

.thread:                                          ; preds = %59, %67
  %.0101136 = phi i32 [ %55, %67 ], [ 0, %59 ]
  %68 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %7) #7
  br label %69

69:                                               ; preds = %.thread, %67
  %.0101135 = phi i32 [ %.0101136, %.thread ], [ %55, %67 ]
  br i1 %.not176, label %._crit_edge171.thread, label %.lr.ph170

.lr.ph170:                                        ; preds = %69
  %.0101135.fr = freeze i32 %.0101135
  %.not125.not = icmp eq i32 %.0101135.fr, 0
  br i1 %.not125.not, label %.lr.ph170.split.us, label %.lr.ph170.split

.lr.ph170.split.us:                               ; preds = %.lr.ph170, %81
  %.292168.us = phi i64 [ %82, %81 ], [ 0, %.lr.ph170 ]
  %.093167.us = phi i32 [ %.295.us, %81 ], [ 0, %.lr.ph170 ]
  %70 = getelementptr inbounds i32, ptr %11, i64 %.292168.us
  %71 = load i32, ptr %70, align 4, !tbaa !10
  %.off.us = add i32 %71, -1
  %switch.us = icmp ult i32 %.off.us, 2
  br i1 %switch.us, label %72, label %81

72:                                               ; preds = %.lr.ph170.split.us
  %73 = getelementptr inbounds %struct.ach_evhandler, ptr %0, i64 %.292168.us
  %74 = getelementptr inbounds i8, ptr %73, i64 16
  %75 = load ptr, ptr %74, align 8, !tbaa !24
  %76 = getelementptr inbounds i8, ptr %73, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !25
  %78 = load ptr, ptr %73, align 8, !tbaa !5
  %79 = call i32 %75(ptr noundef %77, ptr noundef %78) #7
  switch i32 %79, label %.thread146 [
    i32 0, label %80
    i32 5, label %81
  ]

80:                                               ; preds = %72
  br label %81

81:                                               ; preds = %.lr.ph170.split.us, %80, %72
  %.295.us = phi i32 [ 1, %80 ], [ %.093167.us, %72 ], [ %.093167.us, %.lr.ph170.split.us ]
  %82 = add nuw i64 %.292168.us, 1
  %exitcond190.not = icmp eq i64 %82, %1
  br i1 %exitcond190.not, label %._crit_edge171, label %.lr.ph170.split.us, !llvm.loop !26

83:                                               ; preds = %103
  %84 = add nuw i64 %.292168, 1
  %exitcond189.not = icmp eq i64 %84, %1
  br i1 %exitcond189.not, label %._crit_edge171, label %.lr.ph170.split, !llvm.loop !26

.lr.ph170.split:                                  ; preds = %.lr.ph170, %83
  %.292168 = phi i64 [ %84, %83 ], [ 0, %.lr.ph170 ]
  %.093167 = phi i32 [ %.295, %83 ], [ 0, %.lr.ph170 ]
  %.097166 = phi i64 [ %.299, %83 ], [ 0, %.lr.ph170 ]
  %85 = getelementptr inbounds %struct.ach_evhandler, ptr %0, i64 %.292168
  %86 = getelementptr inbounds i32, ptr %11, i64 %.292168
  %87 = load i32, ptr %86, align 4, !tbaa !10
  %.off = add i32 %87, -1
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %95, label %88

88:                                               ; preds = %.lr.ph170.split
  %89 = icmp eq i32 %87, 3
  br i1 %89, label %90, label %103

90:                                               ; preds = %88
  %91 = add i64 %.097166, 1
  %92 = getelementptr inbounds %struct.pollfd, ptr %26, i64 %.097166, i32 2
  %93 = load i16, ptr %92, align 2, !tbaa !27
  %94 = and i16 %93, 1
  %.not126 = icmp eq i16 %94, 0
  br i1 %.not126, label %103, label %95

95:                                               ; preds = %.lr.ph170.split, %90
  %.198 = phi i64 [ %91, %90 ], [ %.097166, %.lr.ph170.split ]
  %96 = getelementptr inbounds i8, ptr %85, i64 16
  %97 = load ptr, ptr %96, align 8, !tbaa !24
  %98 = getelementptr inbounds i8, ptr %85, i64 8
  %99 = load ptr, ptr %98, align 8, !tbaa !25
  %100 = load ptr, ptr %85, align 8, !tbaa !5
  %101 = call i32 %97(ptr noundef %99, ptr noundef %100) #7
  switch i32 %101, label %.thread146 [
    i32 0, label %102
    i32 5, label %103
  ]

102:                                              ; preds = %95
  br label %103

103:                                              ; preds = %95, %102, %90, %88
  %.299 = phi i64 [ %91, %90 ], [ %.097166, %88 ], [ %.198, %102 ], [ %.198, %95 ]
  %.295 = phi i32 [ %.093167, %90 ], [ %.093167, %88 ], [ 1, %102 ], [ %.093167, %95 ]
  %.not127 = icmp ugt i64 %.299, %.088.lcssa
  br i1 %.not127, label %.split, label %83

.split:                                           ; preds = %103
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 138, ptr noundef nonnull @__PRETTY_FUNCTION__.ach_evhandle) #9
  unreachable

._crit_edge171:                                   ; preds = %83, %81
  %.093.lcssa = phi i32 [ %.295.us, %81 ], [ %.295, %83 ]
  %104 = icmp eq i32 %.093.lcssa, 0
  %105 = or i1 %.not, %104
  %brmerge = or i1 %50, %105
  br i1 %brmerge, label %._crit_edge171.thread, label %106

106:                                              ; preds = %._crit_edge171
  %107 = call i32 %3(ptr noundef %4) #7
  br label %._crit_edge171.thread

._crit_edge171.thread:                            ; preds = %69, %._crit_edge171, %106
  %.8 = phi i32 [ %107, %106 ], [ 0, %._crit_edge171 ], [ 0, %69 ]
  %108 = icmp eq i32 %.8, 0
  %or.cond6 = and i1 %24, %108
  br i1 %or.cond6, label %109, label %126

109:                                              ; preds = %._crit_edge171.thread
  %110 = load i64, ptr %7, align 8, !tbaa !21
  %111 = load i64, ptr %8, align 8, !tbaa !21
  %112 = sub nsw i64 %110, %111
  %113 = mul nsw i64 %112, 1000000000
  %114 = load i64, ptr %51, align 8, !tbaa !23
  %115 = load i64, ptr %48, align 8, !tbaa !23
  %116 = sub nsw i64 %114, %115
  %117 = add nsw i64 %116, %113
  %.not124 = icmp ult i64 %117, %.0102
  br i1 %.not124, label %122, label %118

118:                                              ; preds = %109
  br i1 %brmerge132, label %121, label %119

119:                                              ; preds = %118
  %120 = call i32 %3(ptr noundef %4) #7
  br label %121

121:                                              ; preds = %118, %119
  %.9 = phi i32 [ %120, %119 ], [ 0, %118 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %7, i64 16, i1 false), !tbaa.struct !18
  br label %126

122:                                              ; preds = %109
  %123 = sub i64 %.0102, %117
  %124 = udiv i64 %123, 1000000000
  store i64 %124, ptr %9, align 8, !tbaa !21
  %125 = urem i64 %123, 1000000000
  store i64 %125, ptr %52, align 8, !tbaa !23
  br label %126

126:                                              ; preds = %121, %122, %._crit_edge171.thread
  %.13 = phi i32 [ %.9, %121 ], [ 0, %122 ], [ %.8, %._crit_edge171.thread ]
  %127 = icmp eq i32 %.13, 0
  br i1 %127, label %53, label %.thread146, !llvm.loop !28

.thread146:                                       ; preds = %.lr.ph, %32, %59, %54, %126, %95, %72, %._crit_edge
  %.0 = phi i32 [ 19, %._crit_edge ], [ %79, %72 ], [ %101, %95 ], [ 0, %59 ], [ 4, %54 ], [ %.13, %126 ], [ %36, %32 ], [ %17, %.lr.ph ]
  ret i32 %.0
}

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

declare i32 @ach_channel_map(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #3

declare i32 @ach_channel_fd(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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) #4

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #5

declare i32 @ppoll(ptr noundef, i64 noundef, ptr noundef, 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 #6

declare i32 @clock_nanosleep(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; 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 = { "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 nofree nosync nounwind willreturn memory(none) "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
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, !7, i64 0}
!6 = !{!"ach_evhandler", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !16, i64 4}
!15 = !{!"pollfd", !11, i64 0, !16, i64 4, !16, i64 6}
!16 = !{!"short", !8, i64 0}
!17 = distinct !{!17, !13}
!18 = !{i64 0, i64 8, !19, i64 8, i64 8, !19}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !8, i64 0}
!21 = !{!22, !20, i64 0}
!22 = !{!"timespec", !20, i64 0, !20, i64 8}
!23 = !{!22, !20, i64 8}
!24 = !{!6, !7, i64 16}
!25 = !{!6, !7, i64 8}
!26 = distinct !{!26, !13}
!27 = !{!15, !16, i64 6}
!28 = distinct !{!28, !13}


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