; LLVM IR from uNetworking/uSockets :: src (loop)

; 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.bsd_addr_t = type { %struct.sockaddr_storage, i32, ptr, i32, i32 }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.us_internal_callback_t = type { %struct.us_poll_t, ptr, i32, i32, ptr, [8 x i8] }
%struct.us_poll_t = type { %struct.anon, [12 x i8] }
%struct.anon = type { i32 }
%struct.us_socket_t = type { %struct.us_poll_t, i8, i8, i16, ptr, ptr, ptr }
%struct.us_socket_context_t = type { ptr, i32, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, [8 x i8] }
%struct.us_listen_socket_t = type { %struct.us_socket_t, i32, [12 x i8] }
%struct.us_loop_t = type { %struct.us_internal_loop_data_t, i32, i32, i32, i32, [1024 x %struct.epoll_event], [8 x i8] }
%struct.us_internal_loop_data_t = type { ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64 }
%struct.epoll_event = type <{ i32, %union.epoll_data }>
%union.epoll_data = type { ptr }

; 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 void @us_poll_change(ptr noundef, ptr noundef, i32 noundef) #1

declare ptr @us_socket_context(i32 noundef, ptr noundef) #1

declare i32 @us_poll_events(ptr noundef) #1

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

declare void @bsd_socket_nodelay(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @us_internal_dispatch_ready_poll(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.bsd_addr_t, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call i32 @us_internal_poll_type(ptr noundef %16)
  switch i32 %17, label %373 [
    i32 3, label %18
    i32 2, label %44
    i32 1, label %134
    i32 0, label %134
  ]

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %19, ptr %7, align 8, !tbaa !5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.us_internal_callback_t, ptr %20, i32 0, i32 3
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %27, label %24

24:                                               ; preds = %18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call i32 @us_internal_accept_poll_event(ptr noundef %25)
  br label %27

27:                                               ; preds = %24, %18
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.us_internal_callback_t, ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 16, !tbaa !15
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.us_internal_callback_t, ptr %31, i32 0, i32 2
  %33 = load i32, ptr %32, align 8, !tbaa !16
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %27
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.us_internal_callback_t, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 16, !tbaa !17
  br label %42

39:                                               ; preds = %27
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.us_internal_callback_t, ptr %40, i32 0, i32 0
  br label %42

42:                                               ; preds = %39, %35
  %43 = phi ptr [ %38, %35 ], [ %41, %39 ]
  call void %30(ptr noundef %43)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %373

44:                                               ; preds = %3
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = call i32 @us_poll_events(ptr noundef %45)
  %47 = icmp eq i32 %46, 4
  br i1 %47, label %48, label %81

48:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %49, ptr %8, align 8, !tbaa !5
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %62

52:                                               ; preds = %48
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.us_socket_t, ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 8, !tbaa !18
  %56 = getelementptr inbounds %struct.us_socket_context_t, ptr %55, i32 0, i32 17
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = call ptr %57(ptr noundef %58, i32 noundef 0)
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = call ptr @us_socket_close_connecting(i32 noundef 0, ptr noundef %60)
  br label %80

62:                                               ; preds = %48
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.us_socket_t, ptr %64, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !18
  %67 = getelementptr inbounds %struct.us_socket_context_t, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 16, !tbaa !23
  call void @us_poll_change(ptr noundef %63, ptr noundef %68, i32 noundef 1)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call i32 @us_poll_fd(ptr noundef %69)
  call void @bsd_socket_nodelay(i32 noundef %70, i32 noundef 1)
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  call void @us_internal_poll_set_type(ptr noundef %71, i32 noundef 0)
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  call void @us_socket_timeout(i32 noundef 0, ptr noundef %72, i32 noundef 0)
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.us_socket_t, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !18
  %76 = getelementptr inbounds %struct.us_socket_context_t, ptr %75, i32 0, i32 10
  %77 = load ptr, ptr %76, align 16, !tbaa !24
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = call ptr %77(ptr noundef %78, i32 noundef 1, ptr noundef null, i32 noundef 0)
  br label %80

80:                                               ; preds = %62, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %133

81:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %82, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 152, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = call i32 @us_poll_fd(ptr noundef %83)
  %85 = call i32 @bsd_accept_socket(i32 noundef %84, ptr noundef %10)
  store i32 %85, ptr %11, align 4, !tbaa !9
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = icmp eq i32 %86, -1
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  br label %132

89:                                               ; preds = %81
  br label %90

90:                                               ; preds = %126, %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.us_listen_socket_t, ptr %91, i32 0, i32 0
  %93 = call ptr @us_socket_context(i32 noundef 0, ptr noundef %92)
  store ptr %93, ptr %12, align 8, !tbaa !5
  %94 = load ptr, ptr %12, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.us_socket_context_t, ptr %94, i32 0, i32 9
  %96 = load ptr, ptr %95, align 8, !tbaa !25
  %97 = icmp eq ptr %96, null
  br i1 %97, label %107, label %98

98:                                               ; preds = %90
  %99 = load ptr, ptr %12, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.us_socket_context_t, ptr %99, i32 0, i32 9
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i32, ptr %11, align 4, !tbaa !9
  %104 = call i32 %101(ptr noundef %102, i32 noundef %103)
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = icmp eq i32 %104, %105
  br i1 %106, label %107, label %122

107:                                              ; preds = %98, %90
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.us_listen_socket_t, ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 16, !tbaa !26
  %113 = call ptr @bsd_addr_get_ip(ptr noundef %10)
  %114 = call i32 @bsd_addr_get_ip_length(ptr noundef %10)
  %115 = call ptr @us_adopt_accepted_socket(i32 noundef 0, ptr noundef %108, i32 noundef %109, i32 noundef %112, ptr noundef %113, i32 noundef %114)
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.us_listen_socket_t, ptr %116, i32 0, i32 0
  %118 = call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef %117)
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %121

120:                                              ; preds = %107
  store i32 3, ptr %13, align 4
  br label %123

121:                                              ; preds = %107
  br label %122

122:                                              ; preds = %121, %98
  store i32 0, ptr %13, align 4
  br label %123

123:                                              ; preds = %122, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %124 = load i32, ptr %13, align 4
  switch i32 %124, label %374 [
    i32 0, label %125
    i32 3, label %131
  ]

125:                                              ; preds = %123
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = call i32 @us_poll_fd(ptr noundef %127)
  %129 = call i32 @bsd_accept_socket(i32 noundef %128, ptr noundef %10)
  store i32 %129, ptr %11, align 4, !tbaa !9
  %130 = icmp ne i32 %129, -1
  br i1 %130, label %90, label %131, !llvm.loop !28

131:                                              ; preds = %126, %123
  br label %132

132:                                              ; preds = %131, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 152, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %133

133:                                              ; preds = %132, %80
  br label %373

134:                                              ; preds = %3, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %135, ptr %14, align 8, !tbaa !5
  %136 = load i32, ptr %5, align 4, !tbaa !9
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %141

138:                                              ; preds = %134
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = call ptr @us_socket_close(i32 noundef 0, ptr noundef %139, i32 noundef 0, ptr noundef null)
  store ptr %140, ptr %14, align 8, !tbaa !5
  store i32 1, ptr %13, align 4
  br label %370

141:                                              ; preds = %134
  %142 = load i32, ptr %6, align 4, !tbaa !9
  %143 = and i32 %142, 4
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %190

145:                                              ; preds = %141
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.us_socket_t, ptr %146, i32 0, i32 4
  %148 = load ptr, ptr %147, align 8, !tbaa !18
  %149 = getelementptr inbounds %struct.us_socket_context_t, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 16, !tbaa !23
  %151 = getelementptr inbounds %struct.us_loop_t, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %151, i32 0, i32 2
  store i32 0, ptr %152, align 16, !tbaa !30
  %153 = load ptr, ptr %14, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.us_socket_t, ptr %153, i32 0, i32 4
  %155 = load ptr, ptr %154, align 8, !tbaa !18
  %156 = getelementptr inbounds %struct.us_socket_context_t, ptr %155, i32 0, i32 12
  %157 = load ptr, ptr %156, align 16, !tbaa !34
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = call ptr %157(ptr noundef %158)
  store ptr %159, ptr %14, align 8, !tbaa !5
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef %160)
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %164

163:                                              ; preds = %145
  store i32 1, ptr %13, align 4
  br label %370

164:                                              ; preds = %145
  %165 = load ptr, ptr %14, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.us_socket_t, ptr %165, i32 0, i32 4
  %167 = load ptr, ptr %166, align 8, !tbaa !18
  %168 = getelementptr inbounds %struct.us_socket_context_t, ptr %167, i32 0, i32 0
  %169 = load ptr, ptr %168, align 16, !tbaa !23
  %170 = getelementptr inbounds %struct.us_loop_t, ptr %169, i32 0, i32 0
  %171 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %170, i32 0, i32 2
  %172 = load i32, ptr %171, align 16, !tbaa !30
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %178

174:                                              ; preds = %164
  %175 = load ptr, ptr %14, align 8, !tbaa !5
  %176 = call i32 @us_socket_is_shut_down(i32 noundef 0, ptr noundef %175)
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %178, label %189

178:                                              ; preds = %174, %164
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.us_socket_t, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %14, align 8, !tbaa !5
  %182 = call ptr @us_socket_context(i32 noundef 0, ptr noundef %181)
  %183 = getelementptr inbounds %struct.us_socket_context_t, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 16, !tbaa !23
  %185 = load ptr, ptr %14, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.us_socket_t, ptr %185, i32 0, i32 0
  %187 = call i32 @us_poll_events(ptr noundef %186)
  %188 = and i32 %187, 1
  call void @us_poll_change(ptr noundef %180, ptr noundef %184, i32 noundef %188)
  br label %189

189:                                              ; preds = %178, %174
  br label %190

190:                                              ; preds = %189, %141
  %191 = load i32, ptr %6, align 4, !tbaa !9
  %192 = and i32 %191, 1
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %369

194:                                              ; preds = %190
  %195 = load ptr, ptr %14, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.us_socket_t, ptr %195, i32 0, i32 4
  %197 = load ptr, ptr %196, align 8, !tbaa !18
  %198 = getelementptr inbounds %struct.us_socket_context_t, ptr %197, i32 0, i32 18
  %199 = load ptr, ptr %198, align 16, !tbaa !35
  %200 = load ptr, ptr %14, align 8, !tbaa !5
  %201 = call i32 %199(ptr noundef %200)
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %282

203:                                              ; preds = %194
  %204 = load ptr, ptr %14, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.us_socket_t, ptr %204, i32 0, i32 3
  %206 = load i16, ptr %205, align 2, !tbaa !36
  %207 = zext i16 %206 to i32
  %208 = icmp eq i32 %207, 2
  br i1 %208, label %209, label %212

209:                                              ; preds = %203
  %210 = load ptr, ptr %14, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.us_socket_t, ptr %210, i32 0, i32 3
  store i16 0, ptr %211, align 2, !tbaa !36
  br label %281

212:                                              ; preds = %203
  %213 = load ptr, ptr %14, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.us_socket_t, ptr %213, i32 0, i32 4
  %215 = load ptr, ptr %214, align 8, !tbaa !18
  %216 = getelementptr inbounds %struct.us_socket_context_t, ptr %215, i32 0, i32 0
  %217 = load ptr, ptr %216, align 16, !tbaa !23
  %218 = getelementptr inbounds %struct.us_loop_t, ptr %217, i32 0, i32 0
  %219 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %218, i32 0, i32 11
  %220 = load i32, ptr %219, align 8, !tbaa !37
  %221 = icmp sgt i32 %220, 0
  br i1 %221, label %222, label %232

222:                                              ; preds = %212
  %223 = load ptr, ptr %14, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.us_socket_t, ptr %223, i32 0, i32 4
  %225 = load ptr, ptr %224, align 8, !tbaa !18
  %226 = getelementptr inbounds %struct.us_socket_context_t, ptr %225, i32 0, i32 0
  %227 = load ptr, ptr %226, align 16, !tbaa !23
  %228 = getelementptr inbounds %struct.us_loop_t, ptr %227, i32 0, i32 0
  %229 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %228, i32 0, i32 11
  %230 = load i32, ptr %229, align 8, !tbaa !37
  %231 = add nsw i32 %230, -1
  store i32 %231, ptr %229, align 8, !tbaa !37
  br label %280

232:                                              ; preds = %212
  %233 = load ptr, ptr %14, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.us_socket_t, ptr %233, i32 0, i32 0
  %235 = load ptr, ptr %14, align 8, !tbaa !5
  %236 = call ptr @us_socket_context(i32 noundef 0, ptr noundef %235)
  %237 = getelementptr inbounds %struct.us_socket_context_t, ptr %236, i32 0, i32 0
  %238 = load ptr, ptr %237, align 16, !tbaa !23
  %239 = load ptr, ptr %14, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.us_socket_t, ptr %239, i32 0, i32 0
  %241 = call i32 @us_poll_events(ptr noundef %240)
  %242 = and i32 %241, 4
  call void @us_poll_change(ptr noundef %234, ptr noundef %238, i32 noundef %242)
  %243 = load ptr, ptr %14, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.us_socket_t, ptr %243, i32 0, i32 4
  %245 = load ptr, ptr %244, align 8, !tbaa !18
  %246 = load ptr, ptr %14, align 8, !tbaa !5
  call void @us_internal_socket_context_unlink_socket(ptr noundef %245, ptr noundef %246)
  %247 = load ptr, ptr %14, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.us_socket_t, ptr %247, i32 0, i32 5
  store ptr null, ptr %248, align 16, !tbaa !38
  %249 = load ptr, ptr %14, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.us_socket_t, ptr %249, i32 0, i32 4
  %251 = load ptr, ptr %250, align 8, !tbaa !18
  %252 = getelementptr inbounds %struct.us_socket_context_t, ptr %251, i32 0, i32 0
  %253 = load ptr, ptr %252, align 16, !tbaa !23
  %254 = getelementptr inbounds %struct.us_loop_t, ptr %253, i32 0, i32 0
  %255 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %254, i32 0, i32 10
  %256 = load ptr, ptr %255, align 16, !tbaa !39
  %257 = load ptr, ptr %14, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.us_socket_t, ptr %257, i32 0, i32 6
  store ptr %256, ptr %258, align 8, !tbaa !40
  %259 = load ptr, ptr %14, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.us_socket_t, ptr %259, i32 0, i32 6
  %261 = load ptr, ptr %260, align 8, !tbaa !40
  %262 = icmp ne ptr %261, null
  br i1 %262, label %263, label %269

263:                                              ; preds = %232
  %264 = load ptr, ptr %14, align 8, !tbaa !5
  %265 = load ptr, ptr %14, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.us_socket_t, ptr %265, i32 0, i32 6
  %267 = load ptr, ptr %266, align 8, !tbaa !40
  %268 = getelementptr inbounds %struct.us_socket_t, ptr %267, i32 0, i32 5
  store ptr %264, ptr %268, align 16, !tbaa !38
  br label %269

269:                                              ; preds = %263, %232
  %270 = load ptr, ptr %14, align 8, !tbaa !5
  %271 = load ptr, ptr %14, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.us_socket_t, ptr %271, i32 0, i32 4
  %273 = load ptr, ptr %272, align 8, !tbaa !18
  %274 = getelementptr inbounds %struct.us_socket_context_t, ptr %273, i32 0, i32 0
  %275 = load ptr, ptr %274, align 16, !tbaa !23
  %276 = getelementptr inbounds %struct.us_loop_t, ptr %275, i32 0, i32 0
  %277 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %276, i32 0, i32 10
  store ptr %270, ptr %277, align 16, !tbaa !39
  %278 = load ptr, ptr %14, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.us_socket_t, ptr %278, i32 0, i32 3
  store i16 1, ptr %279, align 2, !tbaa !36
  store i32 2, ptr %13, align 4
  br label %370

280:                                              ; preds = %222
  br label %281

281:                                              ; preds = %280, %209
  br label %282

282:                                              ; preds = %281, %194
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  br label %283

283:                                              ; preds = %326, %282
  %284 = load ptr, ptr %14, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.us_socket_t, ptr %284, i32 0, i32 0
  %286 = call i32 @us_poll_fd(ptr noundef %285)
  %287 = load ptr, ptr %14, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.us_socket_t, ptr %287, i32 0, i32 4
  %289 = load ptr, ptr %288, align 8, !tbaa !18
  %290 = getelementptr inbounds %struct.us_socket_context_t, ptr %289, i32 0, i32 0
  %291 = load ptr, ptr %290, align 16, !tbaa !23
  %292 = getelementptr inbounds %struct.us_loop_t, ptr %291, i32 0, i32 0
  %293 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %292, i32 0, i32 5
  %294 = load ptr, ptr %293, align 8, !tbaa !41
  %295 = getelementptr inbounds i8, ptr %294, i64 32
  %296 = call i32 @bsd_recv(i32 noundef %286, ptr noundef %295, i32 noundef 524288, i32 noundef 0)
  store i32 %296, ptr %15, align 4, !tbaa !9
  %297 = load i32, ptr %15, align 4, !tbaa !9
  %298 = icmp sgt i32 %297, 0
  br i1 %298, label %299, label %328

299:                                              ; preds = %283
  %300 = load ptr, ptr %14, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.us_socket_t, ptr %300, i32 0, i32 4
  %302 = load ptr, ptr %301, align 8, !tbaa !18
  %303 = getelementptr inbounds %struct.us_socket_context_t, ptr %302, i32 0, i32 11
  %304 = load ptr, ptr %303, align 8, !tbaa !42
  %305 = load ptr, ptr %14, align 8, !tbaa !5
  %306 = load ptr, ptr %14, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.us_socket_t, ptr %306, i32 0, i32 4
  %308 = load ptr, ptr %307, align 8, !tbaa !18
  %309 = getelementptr inbounds %struct.us_socket_context_t, ptr %308, i32 0, i32 0
  %310 = load ptr, ptr %309, align 16, !tbaa !23
  %311 = getelementptr inbounds %struct.us_loop_t, ptr %310, i32 0, i32 0
  %312 = getelementptr inbounds %struct.us_internal_loop_data_t, ptr %311, i32 0, i32 5
  %313 = load ptr, ptr %312, align 8, !tbaa !41
  %314 = getelementptr inbounds i8, ptr %313, i64 32
  %315 = load i32, ptr %15, align 4, !tbaa !9
  %316 = call ptr %304(ptr noundef %305, ptr noundef %314, i32 noundef %315)
  store ptr %316, ptr %14, align 8, !tbaa !5
  %317 = load i32, ptr %15, align 4, !tbaa !9
  %318 = icmp eq i32 %317, 524288
  br i1 %318, label %319, label %327

319:                                              ; preds = %299
  %320 = load ptr, ptr %14, align 8, !tbaa !5
  %321 = icmp ne ptr %320, null
  br i1 %321, label %322, label %327

322:                                              ; preds = %319
  %323 = load ptr, ptr %14, align 8, !tbaa !5
  %324 = call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef %323)
  %325 = icmp ne i32 %324, 0
  br i1 %325, label %327, label %326

326:                                              ; preds = %322
  br label %283

327:                                              ; preds = %322, %319, %299
  br label %368

328:                                              ; preds = %283
  %329 = load i32, ptr %15, align 4, !tbaa !9
  %330 = icmp ne i32 %329, 0
  br i1 %330, label %357, label %331

331:                                              ; preds = %328
  %332 = load ptr, ptr %14, align 8, !tbaa !5
  %333 = call i32 @us_socket_is_shut_down(i32 noundef 0, ptr noundef %332)
  %334 = icmp ne i32 %333, 0
  br i1 %334, label %335, label %338

335:                                              ; preds = %331
  %336 = load ptr, ptr %14, align 8, !tbaa !5
  %337 = call ptr @us_socket_close(i32 noundef 0, ptr noundef %336, i32 noundef 0, ptr noundef null)
  store ptr %337, ptr %14, align 8, !tbaa !5
  br label %356

338:                                              ; preds = %331
  %339 = load ptr, ptr %14, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct.us_socket_t, ptr %339, i32 0, i32 0
  %341 = load ptr, ptr %14, align 8, !tbaa !5
  %342 = call ptr @us_socket_context(i32 noundef 0, ptr noundef %341)
  %343 = getelementptr inbounds %struct.us_socket_context_t, ptr %342, i32 0, i32 0
  %344 = load ptr, ptr %343, align 16, !tbaa !23
  %345 = load ptr, ptr %14, align 8, !tbaa !5
  %346 = getelementptr inbounds %struct.us_socket_t, ptr %345, i32 0, i32 0
  %347 = call i32 @us_poll_events(ptr noundef %346)
  %348 = and i32 %347, 4
  call void @us_poll_change(ptr noundef %340, ptr noundef %344, i32 noundef %348)
  %349 = load ptr, ptr %14, align 8, !tbaa !5
  %350 = getelementptr inbounds %struct.us_socket_t, ptr %349, i32 0, i32 4
  %351 = load ptr, ptr %350, align 8, !tbaa !18
  %352 = getelementptr inbounds %struct.us_socket_context_t, ptr %351, i32 0, i32 16
  %353 = load ptr, ptr %352, align 16, !tbaa !43
  %354 = load ptr, ptr %14, align 8, !tbaa !5
  %355 = call ptr %353(ptr noundef %354)
  store ptr %355, ptr %14, align 8, !tbaa !5
  br label %356

356:                                              ; preds = %338, %335
  br label %367

357:                                              ; preds = %328
  %358 = load i32, ptr %15, align 4, !tbaa !9
  %359 = icmp eq i32 %358, -1
  br i1 %359, label %360, label %366

360:                                              ; preds = %357
  %361 = call i32 (...) @bsd_would_block()
  %362 = icmp ne i32 %361, 0
  br i1 %362, label %366, label %363

363:                                              ; preds = %360
  %364 = load ptr, ptr %14, align 8, !tbaa !5
  %365 = call ptr @us_socket_close(i32 noundef 0, ptr noundef %364, i32 noundef 0, ptr noundef null)
  store ptr %365, ptr %14, align 8, !tbaa !5
  br label %366

366:                                              ; preds = %363, %360, %357
  br label %367

367:                                              ; preds = %366, %356
  br label %368

368:                                              ; preds = %367, %327
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %369

369:                                              ; preds = %368, %190
  store i32 0, ptr %13, align 4
  br label %370

370:                                              ; preds = %369, %269, %163, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %371 = load i32, ptr %13, align 4
  switch i32 %371, label %374 [
    i32 0, label %372
    i32 1, label %373
    i32 2, label %373
  ]

372:                                              ; preds = %370
  br label %373

373:                                              ; preds = %372, %370, %370, %133, %42, %3
  ret void

374:                                              ; preds = %370, %123
  unreachable
}

declare i32 @us_internal_poll_type(ptr noundef) #1

declare i32 @us_internal_accept_poll_event(ptr noundef) #1

declare ptr @us_socket_close_connecting(i32 noundef, ptr noundef) #1

declare i32 @us_poll_fd(ptr noundef) #1

declare void @us_internal_poll_set_type(ptr noundef, i32 noundef) #1

declare void @us_socket_timeout(i32 noundef, ptr noundef, i32 noundef) #1

declare i32 @bsd_accept_socket(i32 noundef, ptr noundef) #1

declare ptr @bsd_addr_get_ip(ptr noundef) #1

declare i32 @bsd_addr_get_ip_length(ptr noundef) #1

declare i32 @us_socket_is_closed(i32 noundef, ptr noundef) #1

declare ptr @us_socket_close(i32 noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @us_socket_is_shut_down(i32 noundef, ptr noundef) #1

declare void @us_internal_socket_context_unlink_socket(ptr noundef, ptr noundef) #1

declare i32 @bsd_recv(i32 noundef, ptr noundef, i32 noundef, i32 noundef) #1

declare i32 @bsd_would_block(...) #1

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 28}
!12 = !{!"us_internal_callback_t", !13, i64 0, !6, i64 16, !10, i64 24, !10, i64 28, !6, i64 32}
!13 = !{!"us_poll_t", !14, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 3}
!15 = !{!12, !6, i64 32}
!16 = !{!12, !10, i64 24}
!17 = !{!12, !6, i64 16}
!18 = !{!19, !6, i64 24}
!19 = !{!"us_socket_t", !13, i64 0, !7, i64 16, !7, i64 17, !20, i64 18, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!"short", !7, i64 0}
!21 = !{!22, !6, i64 120}
!22 = !{!"us_socket_context_t", !6, i64 0, !10, i64 8, !7, i64 12, !7, i64 13, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128}
!23 = !{!22, !6, i64 0}
!24 = !{!22, !6, i64 64}
!25 = !{!22, !6, i64 56}
!26 = !{!27, !10, i64 48}
!27 = !{!"us_listen_socket_t", !19, i64 0, !10, i64 48}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!31, !10, i64 16}
!31 = !{!"us_loop_t", !32, i64 0, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !7, i64 120}
!32 = !{!"us_internal_loop_data_t", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !33, i64 96}
!33 = !{!"long long", !7, i64 0}
!34 = !{!22, !6, i64 80}
!35 = !{!22, !6, i64 128}
!36 = !{!19, !20, i64 18}
!37 = !{!31, !10, i64 88}
!38 = !{!19, !6, i64 32}
!39 = !{!31, !6, i64 80}
!40 = !{!19, !6, i64 40}
!41 = !{!31, !6, i64 40}
!42 = !{!22, !6, i64 72}
!43 = !{!22, !6, i64 112}


; 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.bsd_addr_t = type { %struct.sockaddr_storage, i32, ptr, i32, i32 }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }

; 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

declare void @us_poll_change(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @us_socket_context(i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @us_poll_events(ptr noundef) local_unnamed_addr #1

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

declare void @bsd_socket_nodelay(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @us_internal_dispatch_ready_poll(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.bsd_addr_t, align 8
  %5 = tail call i32 @us_internal_poll_type(ptr noundef %0) #3
  switch i32 %5, label %.loopexit118 [
    i32 3, label %6
    i32 2, label %21
    i32 1, label %61
    i32 0, label %61
  ]

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %.not114 = icmp eq i32 %8, 0
  br i1 %.not114, label %9, label %11

9:                                                ; preds = %6
  %10 = tail call i32 @us_internal_accept_poll_event(ptr noundef nonnull %0) #3
  br label %11

11:                                               ; preds = %9, %6
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 16, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load i32, ptr %14, align 8, !tbaa !14
  %.not115 = icmp eq i32 %15, 0
  br i1 %.not115, label %19, label %16

16:                                               ; preds = %11
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load ptr, ptr %17, align 16, !tbaa !15
  br label %19

19:                                               ; preds = %11, %16
  %20 = phi ptr [ %18, %16 ], [ %0, %11 ]
  tail call void %13(ptr noundef %20) #3
  br label %.loopexit118

21:                                               ; preds = %3
  %22 = tail call i32 @us_poll_events(ptr noundef %0) #3
  %23 = icmp eq i32 %22, 4
  br i1 %23, label %24, label %39

24:                                               ; preds = %21
  %.not113 = icmp eq i32 %1, 0
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  br i1 %.not113, label %32, label %27

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %26, i64 120
  %29 = load ptr, ptr %28, align 8, !tbaa !19
  %30 = tail call ptr %29(ptr noundef %0, i32 noundef 0) #3
  %31 = tail call ptr @us_socket_close_connecting(i32 noundef 0, ptr noundef %0) #3
  br label %.loopexit118

32:                                               ; preds = %24
  %33 = load ptr, ptr %26, align 16, !tbaa !21
  tail call void @us_poll_change(ptr noundef %0, ptr noundef %33, i32 noundef 1) #3
  %34 = tail call i32 @us_poll_fd(ptr noundef %0) #3
  tail call void @bsd_socket_nodelay(i32 noundef %34, i32 noundef 1) #3
  tail call void @us_internal_poll_set_type(ptr noundef %0, i32 noundef 0) #3
  tail call void @us_socket_timeout(i32 noundef 0, ptr noundef %0, i32 noundef 0) #3
  %35 = load ptr, ptr %25, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %35, i64 64
  %37 = load ptr, ptr %36, align 16, !tbaa !22
  %38 = tail call ptr %37(ptr noundef %0, i32 noundef 1, ptr noundef null, i32 noundef 0) #3
  br label %.loopexit118

39:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %4) #3
  %40 = tail call i32 @us_poll_fd(ptr noundef %0) #3
  %41 = call i32 @bsd_accept_socket(i32 noundef %40, ptr noundef nonnull %4) #3
  %42 = icmp eq i32 %41, -1
  br i1 %42, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %39
  %43 = getelementptr inbounds i8, ptr %0, i64 48
  br label %44

44:                                               ; preds = %.preheader, %58
  %.0 = phi i32 [ %60, %58 ], [ %41, %.preheader ]
  %45 = call ptr @us_socket_context(i32 noundef 0, ptr noundef %0) #3
  %46 = getelementptr inbounds i8, ptr %45, i64 56
  %47 = load ptr, ptr %46, align 8, !tbaa !23
  %48 = icmp eq ptr %47, null
  br i1 %48, label %52, label %49

49:                                               ; preds = %44
  %50 = call i32 %47(ptr noundef nonnull %45, i32 noundef %.0) #3
  %51 = icmp eq i32 %50, %.0
  br i1 %51, label %52, label %58

52:                                               ; preds = %49, %44
  %53 = load i32, ptr %43, align 16, !tbaa !24
  %54 = call ptr @bsd_addr_get_ip(ptr noundef nonnull %4) #3
  %55 = call i32 @bsd_addr_get_ip_length(ptr noundef nonnull %4) #3
  %56 = call ptr @us_adopt_accepted_socket(i32 noundef 0, ptr noundef nonnull %45, i32 noundef %.0, i32 noundef %53, ptr noundef %54, i32 noundef %55)
  %57 = call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef %0) #3
  %.not111 = icmp eq i32 %57, 0
  br i1 %.not111, label %58, label %.loopexit

58:                                               ; preds = %49, %52
  %59 = call i32 @us_poll_fd(ptr noundef %0) #3
  %60 = call i32 @bsd_accept_socket(i32 noundef %59, ptr noundef nonnull %4) #3
  %.not112 = icmp eq i32 %60, -1
  br i1 %.not112, label %.loopexit, label %44, !llvm.loop !26

.loopexit:                                        ; preds = %52, %58, %39
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %4) #3
  br label %.loopexit118

61:                                               ; preds = %3, %3
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %64, label %62

62:                                               ; preds = %61
  %63 = tail call ptr @us_socket_close(i32 noundef 0, ptr noundef %0, i32 noundef 0, ptr noundef null) #3
  br label %.loopexit118

64:                                               ; preds = %61
  %65 = and i32 %2, 4
  %.not100 = icmp eq i32 %65, 0
  br i1 %.not100, label %88, label %66

66:                                               ; preds = %64
  %67 = getelementptr inbounds i8, ptr %0, i64 24
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %69 = load ptr, ptr %68, align 16, !tbaa !21
  %70 = getelementptr inbounds i8, ptr %69, i64 16
  store i32 0, ptr %70, align 16, !tbaa !28
  %71 = getelementptr inbounds i8, ptr %68, i64 80
  %72 = load ptr, ptr %71, align 16, !tbaa !32
  %73 = tail call ptr %72(ptr noundef %0) #3
  %74 = tail call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef %73) #3
  %.not101 = icmp eq i32 %74, 0
  br i1 %.not101, label %75, label %.loopexit118

75:                                               ; preds = %66
  %76 = getelementptr inbounds i8, ptr %73, i64 24
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = load ptr, ptr %77, align 16, !tbaa !21
  %79 = getelementptr inbounds i8, ptr %78, i64 16
  %80 = load i32, ptr %79, align 16, !tbaa !28
  %.not102 = icmp eq i32 %80, 0
  br i1 %.not102, label %83, label %81

81:                                               ; preds = %75
  %82 = tail call i32 @us_socket_is_shut_down(i32 noundef 0, ptr noundef nonnull %73) #3
  %.not103 = icmp eq i32 %82, 0
  br i1 %.not103, label %88, label %83

83:                                               ; preds = %81, %75
  %84 = tail call ptr @us_socket_context(i32 noundef 0, ptr noundef nonnull %73) #3
  %85 = load ptr, ptr %84, align 16, !tbaa !21
  %86 = tail call i32 @us_poll_events(ptr noundef nonnull %73) #3
  %87 = and i32 %86, 1
  tail call void @us_poll_change(ptr noundef nonnull %73, ptr noundef %85, i32 noundef %87) #3
  br label %88

88:                                               ; preds = %81, %83, %64
  %.090 = phi ptr [ %73, %83 ], [ %73, %81 ], [ %0, %64 ]
  %89 = and i32 %2, 1
  %.not104 = icmp eq i32 %89, 0
  br i1 %.not104, label %.loopexit118, label %90

90:                                               ; preds = %88
  %91 = getelementptr inbounds i8, ptr %.090, i64 24
  %92 = load ptr, ptr %91, align 8, !tbaa !16
  %93 = getelementptr inbounds i8, ptr %92, i64 128
  %94 = load ptr, ptr %93, align 16, !tbaa !33
  %95 = tail call i32 %94(ptr noundef %.090) #3
  %.not105 = icmp eq i32 %95, 0
  br i1 %.not105, label %.preheader135, label %96

.preheader135:                                    ; preds = %100, %107, %90
  br label %124

96:                                               ; preds = %90
  %97 = getelementptr inbounds i8, ptr %.090, i64 18
  %98 = load i16, ptr %97, align 2, !tbaa !34
  %99 = icmp eq i16 %98, 2
  br i1 %99, label %100, label %101

100:                                              ; preds = %96
  store i16 0, ptr %97, align 2, !tbaa !34
  br label %.preheader135

101:                                              ; preds = %96
  %102 = load ptr, ptr %91, align 8, !tbaa !16
  %103 = load ptr, ptr %102, align 16, !tbaa !21
  %104 = getelementptr inbounds i8, ptr %103, i64 88
  %105 = load i32, ptr %104, align 8, !tbaa !35
  %106 = icmp sgt i32 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %101
  %108 = add nsw i32 %105, -1
  store i32 %108, ptr %104, align 8, !tbaa !35
  br label %.preheader135

109:                                              ; preds = %101
  %110 = tail call ptr @us_socket_context(i32 noundef 0, ptr noundef nonnull %.090) #3
  %111 = load ptr, ptr %110, align 16, !tbaa !21
  %112 = tail call i32 @us_poll_events(ptr noundef nonnull %.090) #3
  %113 = and i32 %112, 4
  tail call void @us_poll_change(ptr noundef nonnull %.090, ptr noundef %111, i32 noundef %113) #3
  %114 = load ptr, ptr %91, align 8, !tbaa !16
  tail call void @us_internal_socket_context_unlink_socket(ptr noundef %114, ptr noundef nonnull %.090) #3
  %115 = getelementptr inbounds i8, ptr %.090, i64 32
  store ptr null, ptr %115, align 16, !tbaa !36
  %116 = load ptr, ptr %91, align 8, !tbaa !16
  %117 = load ptr, ptr %116, align 16, !tbaa !21
  %118 = getelementptr inbounds i8, ptr %117, i64 80
  %119 = load ptr, ptr %118, align 16, !tbaa !37
  %120 = getelementptr inbounds i8, ptr %.090, i64 40
  store ptr %119, ptr %120, align 8, !tbaa !38
  %.not106 = icmp eq ptr %119, null
  br i1 %.not106, label %123, label %121

121:                                              ; preds = %109
  %122 = getelementptr inbounds i8, ptr %119, i64 32
  store ptr %.090, ptr %122, align 16, !tbaa !36
  br label %123

123:                                              ; preds = %121, %109
  store ptr %.090, ptr %118, align 16, !tbaa !37
  store i16 1, ptr %97, align 2, !tbaa !34
  br label %.loopexit118

124:                                              ; preds = %.preheader135, %145
  %.1 = phi ptr [ %142, %145 ], [ %.090, %.preheader135 ]
  %125 = tail call i32 @us_poll_fd(ptr noundef nonnull %.1) #3
  %126 = getelementptr inbounds i8, ptr %.1, i64 24
  %127 = load ptr, ptr %126, align 8, !tbaa !16
  %128 = load ptr, ptr %127, align 16, !tbaa !21
  %129 = getelementptr inbounds i8, ptr %128, i64 40
  %130 = load ptr, ptr %129, align 8, !tbaa !39
  %131 = getelementptr inbounds i8, ptr %130, i64 32
  %132 = tail call i32 @bsd_recv(i32 noundef %125, ptr noundef nonnull %131, i32 noundef 524288, i32 noundef 0) #3
  %133 = icmp sgt i32 %132, 0
  br i1 %133, label %134, label %147

134:                                              ; preds = %124
  %135 = load ptr, ptr %126, align 8, !tbaa !16
  %136 = getelementptr inbounds i8, ptr %135, i64 72
  %137 = load ptr, ptr %136, align 8, !tbaa !40
  %138 = load ptr, ptr %135, align 16, !tbaa !21
  %139 = getelementptr inbounds i8, ptr %138, i64 40
  %140 = load ptr, ptr %139, align 8, !tbaa !39
  %141 = getelementptr inbounds i8, ptr %140, i64 32
  %142 = tail call ptr %137(ptr noundef nonnull %.1, ptr noundef nonnull %141, i32 noundef %132) #3
  %143 = icmp eq i32 %132, 524288
  %144 = icmp ne ptr %142, null
  %or.cond = select i1 %143, i1 %144, i1 false
  br i1 %or.cond, label %145, label %.loopexit118

145:                                              ; preds = %134
  %146 = tail call i32 @us_socket_is_closed(i32 noundef 0, ptr noundef nonnull %142) #3
  %.not110 = icmp eq i32 %146, 0
  br i1 %.not110, label %124, label %.loopexit118

147:                                              ; preds = %124
  switch i32 %132, label %.loopexit118 [
    i32 0, label %148
    i32 -1, label %161
  ]

148:                                              ; preds = %147
  %149 = tail call i32 @us_socket_is_shut_down(i32 noundef 0, ptr noundef nonnull %.1) #3
  %.not108 = icmp eq i32 %149, 0
  br i1 %.not108, label %152, label %150

150:                                              ; preds = %148
  %151 = tail call ptr @us_socket_close(i32 noundef 0, ptr noundef nonnull %.1, i32 noundef 0, ptr noundef null) #3
  br label %.loopexit118

152:                                              ; preds = %148
  %153 = tail call ptr @us_socket_context(i32 noundef 0, ptr noundef nonnull %.1) #3
  %154 = load ptr, ptr %153, align 16, !tbaa !21
  %155 = tail call i32 @us_poll_events(ptr noundef nonnull %.1) #3
  %156 = and i32 %155, 4
  tail call void @us_poll_change(ptr noundef nonnull %.1, ptr noundef %154, i32 noundef %156) #3
  %157 = load ptr, ptr %126, align 8, !tbaa !16
  %158 = getelementptr inbounds i8, ptr %157, i64 112
  %159 = load ptr, ptr %158, align 16, !tbaa !41
  %160 = tail call ptr %159(ptr noundef nonnull %.1) #3
  br label %.loopexit118

161:                                              ; preds = %147
  %162 = tail call i32 (...) @bsd_would_block() #3
  %.not109 = icmp eq i32 %162, 0
  br i1 %.not109, label %163, label %.loopexit118

163:                                              ; preds = %161
  %164 = tail call ptr @us_socket_close(i32 noundef 0, ptr noundef nonnull %.1, i32 noundef 0, ptr noundef null) #3
  br label %.loopexit118

.loopexit118:                                     ; preds = %145, %134, %62, %123, %66, %161, %163, %150, %152, %147, %88, %27, %32, %.loopexit, %19, %3
  ret void
}

declare i32 @us_internal_poll_type(ptr noundef) local_unnamed_addr #1

declare i32 @us_internal_accept_poll_event(ptr noundef) local_unnamed_addr #1

declare ptr @us_socket_close_connecting(i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @us_poll_fd(ptr noundef) local_unnamed_addr #1

declare void @us_internal_poll_set_type(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @us_socket_timeout(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @bsd_accept_socket(i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @bsd_addr_get_ip(ptr noundef) local_unnamed_addr #1

declare i32 @bsd_addr_get_ip_length(ptr noundef) local_unnamed_addr #1

declare i32 @us_socket_is_closed(i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @us_socket_close(i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @us_socket_is_shut_down(i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @us_internal_socket_context_unlink_socket(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @bsd_recv(i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare i32 @bsd_would_block(...) local_unnamed_addr #1

attributes #0 = { mustprogress 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, !9, i64 28}
!6 = !{!"us_internal_callback_t", !7, i64 0, !12, i64 16, !9, i64 24, !9, i64 28, !12, i64 32}
!7 = !{!"us_poll_t", !8, i64 0}
!8 = !{!"", !9, i64 0, !9, i64 3}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!6, !12, i64 32}
!14 = !{!6, !9, i64 24}
!15 = !{!6, !12, i64 16}
!16 = !{!17, !12, i64 24}
!17 = !{!"us_socket_t", !7, i64 0, !10, i64 16, !10, i64 17, !18, i64 18, !12, i64 24, !12, i64 32, !12, i64 40}
!18 = !{!"short", !10, i64 0}
!19 = !{!20, !12, i64 120}
!20 = !{!"us_socket_context_t", !12, i64 0, !9, i64 8, !10, i64 12, !10, i64 13, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128}
!21 = !{!20, !12, i64 0}
!22 = !{!20, !12, i64 64}
!23 = !{!20, !12, i64 56}
!24 = !{!25, !9, i64 48}
!25 = !{!"us_listen_socket_t", !17, i64 0, !9, i64 48}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!29, !9, i64 16}
!29 = !{!"us_loop_t", !30, i64 0, !9, i64 104, !9, i64 108, !9, i64 112, !9, i64 116, !10, i64 120}
!30 = !{!"us_internal_loop_data_t", !12, i64 0, !12, i64 8, !9, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !9, i64 88, !31, i64 96}
!31 = !{!"long long", !10, i64 0}
!32 = !{!20, !12, i64 80}
!33 = !{!20, !12, i64 128}
!34 = !{!17, !18, i64 18}
!35 = !{!29, !9, i64 88}
!36 = !{!17, !12, i64 32}
!37 = !{!29, !12, i64 80}
!38 = !{!17, !12, i64 40}
!39 = !{!29, !12, i64 40}
!40 = !{!20, !12, i64 72}
!41 = !{!20, !12, i64 112}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass