; LLVM IR from jingweizhanghuai/Morn :: src/wrap (morn_socket)

; 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.fd_set = type { [16 x i64] }
%struct.timeval = type { i64, i64 }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.HandleTCPClient = type { i32, i32, i32, [32 x i8], i32, i32, i32, double, i32 }

@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@__FUNCTION__.TCPClientConnect = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [19 x i8], align 1
@morn_log_levelset = external global i32, align 4
@morn_log_level = external thread_local global i32, align 4
@.str.15 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @IPAddress(ptr noundef, ptr noundef, ptr noundef) #0

; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare i32 @close(i32 noundef) #2

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #4

declare i32 @select(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @TCPClientInit(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @TCPClientConnect(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %struct.fd_set, align 8
  %10 = alloca %struct.fd_set, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct.timeval, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca %struct.sockaddr_in, align 4
  %25 = alloca %struct.sockaddr_in, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = call ptr @TCPClientInit(ptr noundef %27)
  store ptr %28, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.HandleTCPClient, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !9
  store i32 %31, ptr %5, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.HandleTCPClient, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !14
  store i32 %34, ptr %6, align 4, !tbaa !13
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  call void @IPAddress(ptr noundef %35, ptr noundef %5, ptr noundef %6)
  %36 = load i32, ptr %5, align 4, !tbaa !13
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.HandleTCPClient, ptr %37, i32 0, i32 1
  store i32 %36, ptr %38, align 4, !tbaa !9
  %39 = load i32, ptr %6, align 4, !tbaa !13
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.HandleTCPClient, ptr %40, i32 0, i32 2
  store i32 %39, ptr %41, align 8, !tbaa !14
  br label %42

42:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %43 = load i32, ptr %5, align 4, !tbaa !13
  %44 = icmp eq i32 %43, 0
  %45 = zext i1 %44 to i32
  store i32 %45, ptr %7, align 4, !tbaa !13
  %46 = load i32, ptr %7, align 4, !tbaa !13
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %42
  %49 = load i32, ptr %7, align 4, !tbaa !13
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %49, i32 noundef -1, ptr noundef @.str.2, i32 noundef 294, ptr noundef @__FUNCTION__.TCPClientConnect, ptr noundef @.str.14)
  br label %50

50:                                               ; preds = %48, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr %5, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.HandleTCPClient, ptr %53, i32 0, i32 3
  %55 = getelementptr inbounds [32 x i8], ptr %54, i64 0, i64 0
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 0
  %58 = load i8, ptr %57, align 1, !tbaa !15
  %59 = zext i8 %58 to i32
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 1
  %62 = load i8, ptr %61, align 1, !tbaa !15
  %63 = zext i8 %62 to i32
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 2
  %66 = load i8, ptr %65, align 1, !tbaa !15
  %67 = zext i8 %66 to i32
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 3
  %70 = load i8, ptr %69, align 1, !tbaa !15
  %71 = zext i8 %70 to i32
  %72 = load i32, ptr %6, align 4, !tbaa !13
  %73 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %55, ptr noundef @.str.1, i32 noundef %59, i32 noundef %63, i32 noundef %67, i32 noundef %71, i32 noundef %72) #7
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.HandleTCPClient, ptr %74, i32 0, i32 4
  %76 = load i32, ptr %75, align 4, !tbaa !16
  %77 = icmp sge i32 %76, 0
  br i1 %77, label %78, label %302

78:                                               ; preds = %52
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.HandleTCPClient, ptr %79, i32 0, i32 7
  %81 = load double, ptr %80, align 8, !tbaa !17
  %82 = fcmp oge double %81, 0.000000e+00
  br i1 %82, label %83, label %302

83:                                               ; preds = %78
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.HandleTCPClient, ptr %84, i32 0, i32 8
  %86 = load i32, ptr %85, align 8, !tbaa !18
  %87 = icmp eq i32 %86, -1
  br i1 %87, label %88, label %251

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 128, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr %10) #7
  br label %89

89:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr %9, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !13
  br label %90

90:                                               ; preds = %100, %89
  %91 = load i32, ptr %11, align 4, !tbaa !13
  %92 = zext i32 %91 to i64
  %93 = icmp ult i64 %92, 16
  br i1 %93, label %94, label %103

94:                                               ; preds = %90
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.fd_set, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %11, align 4, !tbaa !13
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds [16 x i64], ptr %96, i64 0, i64 %98
  store i64 0, ptr %99, align 8, !tbaa !19
  br label %100

100:                                              ; preds = %94
  %101 = load i32, ptr %11, align 4, !tbaa !13
  %102 = add i32 %101, 1
  store i32 %102, ptr %11, align 4, !tbaa !13
  br label %90, !llvm.loop !21

103:                                              ; preds = %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.HandleTCPClient, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !23
  %109 = srem i32 %108, 64
  %110 = zext i32 %109 to i64
  %111 = shl i64 1, %110
  %112 = getelementptr inbounds %struct.fd_set, ptr %9, i32 0, i32 0
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.HandleTCPClient, ptr %113, i32 0, i32 0
  %115 = load i32, ptr %114, align 8, !tbaa !23
  %116 = sdiv i32 %115, 64
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [16 x i64], ptr %112, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !19
  %120 = or i64 %119, %111
  store i64 %120, ptr %118, align 8, !tbaa !19
  br label %121

121:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store ptr %10, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %122

122:                                              ; preds = %132, %121
  %123 = load i32, ptr %13, align 4, !tbaa !13
  %124 = zext i32 %123 to i64
  %125 = icmp ult i64 %124, 16
  br i1 %125, label %126, label %135

126:                                              ; preds = %122
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.fd_set, ptr %127, i32 0, i32 0
  %129 = load i32, ptr %13, align 4, !tbaa !13
  %130 = zext i32 %129 to i64
  %131 = getelementptr inbounds [16 x i64], ptr %128, i64 0, i64 %130
  store i64 0, ptr %131, align 8, !tbaa !19
  br label %132

132:                                              ; preds = %126
  %133 = load i32, ptr %13, align 4, !tbaa !13
  %134 = add i32 %133, 1
  store i32 %134, ptr %13, align 4, !tbaa !13
  br label %122, !llvm.loop !24

135:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %136

136:                                              ; preds = %135
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.HandleTCPClient, ptr %138, i32 0, i32 0
  %140 = load i32, ptr %139, align 8, !tbaa !23
  %141 = srem i32 %140, 64
  %142 = zext i32 %141 to i64
  %143 = shl i64 1, %142
  %144 = getelementptr inbounds %struct.fd_set, ptr %10, i32 0, i32 0
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.HandleTCPClient, ptr %145, i32 0, i32 0
  %147 = load i32, ptr %146, align 8, !tbaa !23
  %148 = sdiv i32 %147, 64
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [16 x i64], ptr %144, i64 0, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !19
  %152 = or i64 %151, %143
  store i64 %152, ptr %150, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.HandleTCPClient, ptr %153, i32 0, i32 4
  %155 = load i32, ptr %154, align 4, !tbaa !16
  %156 = sdiv i32 %155, 1000
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds %struct.timeval, ptr %15, i32 0, i32 0
  store i64 %157, ptr %158, align 8, !tbaa !25
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.HandleTCPClient, ptr %159, i32 0, i32 4
  %161 = load i32, ptr %160, align 4, !tbaa !16
  %162 = srem i32 %161, 1000
  %163 = mul nsw i32 %162, 1000
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds %struct.timeval, ptr %15, i32 0, i32 1
  store i64 %164, ptr %165, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.HandleTCPClient, ptr %166, i32 0, i32 0
  %168 = load i32, ptr %167, align 8, !tbaa !23
  %169 = add nsw i32 %168, 1
  %170 = call i32 @select(i32 noundef %169, ptr noundef %9, ptr noundef %10, ptr noundef null, ptr noundef %15)
  store i32 %170, ptr %16, align 4, !tbaa !13
  %171 = load i32, ptr %16, align 4, !tbaa !13
  %172 = icmp sle i32 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %137
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %250

174:                                              ; preds = %137
  %175 = getelementptr inbounds %struct.fd_set, ptr %9, i32 0, i32 0
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.HandleTCPClient, ptr %176, i32 0, i32 0
  %178 = load i32, ptr %177, align 8, !tbaa !23
  %179 = sdiv i32 %178, 64
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [16 x i64], ptr %175, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !19
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.HandleTCPClient, ptr %183, i32 0, i32 0
  %185 = load i32, ptr %184, align 8, !tbaa !23
  %186 = srem i32 %185, 64
  %187 = zext i32 %186 to i64
  %188 = shl i64 1, %187
  %189 = and i64 %182, %188
  %190 = icmp ne i64 %189, 0
  br i1 %190, label %208, label %191

191:                                              ; preds = %174
  %192 = getelementptr inbounds %struct.fd_set, ptr %10, i32 0, i32 0
  %193 = load ptr, ptr %4, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.HandleTCPClient, ptr %193, i32 0, i32 0
  %195 = load i32, ptr %194, align 8, !tbaa !23
  %196 = sdiv i32 %195, 64
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [16 x i64], ptr %192, i64 0, i64 %197
  %199 = load i64, ptr %198, align 8, !tbaa !19
  %200 = load ptr, ptr %4, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.HandleTCPClient, ptr %200, i32 0, i32 0
  %202 = load i32, ptr %201, align 8, !tbaa !23
  %203 = srem i32 %202, 64
  %204 = zext i32 %203 to i64
  %205 = shl i64 1, %204
  %206 = and i64 %199, %205
  %207 = icmp ne i64 %206, 0
  br i1 %207, label %208, label %249

208:                                              ; preds = %191, %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 4, ptr %19, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %209 = load ptr, ptr %4, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.HandleTCPClient, ptr %209, i32 0, i32 0
  %211 = load i32, ptr %210, align 8, !tbaa !23
  %212 = call i32 @getsockopt(i32 noundef %211, i32 noundef 1, i32 noundef 4, ptr noundef %18, ptr noundef %19) #7
  store i32 %212, ptr %20, align 4, !tbaa !13
  %213 = load i32, ptr %20, align 4, !tbaa !13
  %214 = icmp eq i32 %213, 0
  br i1 %214, label %215, label %244

215:                                              ; preds = %208
  %216 = load ptr, ptr %4, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.HandleTCPClient, ptr %216, i32 0, i32 8
  %218 = load i32, ptr %217, align 8, !tbaa !18
  %219 = icmp eq i32 %218, -1
  br i1 %219, label %220, label %237

220:                                              ; preds = %215
  %221 = load i32, ptr %18, align 4, !tbaa !13
  %222 = load ptr, ptr %4, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.HandleTCPClient, ptr %222, i32 0, i32 8
  store i32 %221, ptr %223, align 8, !tbaa !18
  br label %224

224:                                              ; preds = %220
  %225 = load i32, ptr @morn_log_levelset, align 4, !tbaa !13
  %226 = icmp sge i32 32, %225
  br i1 %226, label %227, label %234

227:                                              ; preds = %224
  %228 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %228, align 4, !tbaa !13
  %229 = load ptr, ptr %4, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.HandleTCPClient, ptr %229, i32 0, i32 3
  %231 = getelementptr inbounds [32 x i8], ptr %230, i64 0, i64 0
  %232 = load i32, ptr %18, align 4, !tbaa !13
  %233 = call ptr @strerror(i32 noundef %232) #7
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef @.str.15, ptr noundef %231, ptr noundef %233)
  br label %234

234:                                              ; preds = %227, %224
  br label %235

235:                                              ; preds = %234
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236, %215
  %238 = load i32, ptr %18, align 4, !tbaa !13
  %239 = icmp eq i32 %238, 0
  br i1 %239, label %240, label %243

240:                                              ; preds = %237
  %241 = load ptr, ptr %4, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.HandleTCPClient, ptr %241, i32 0, i32 7
  store double -1.000000e+00, ptr %242, align 8, !tbaa !17
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %248

243:                                              ; preds = %237
  br label %244

244:                                              ; preds = %243, %208
  %245 = call double (...) @mTimer()
  %246 = load ptr, ptr %4, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.HandleTCPClient, ptr %246, i32 0, i32 7
  store double %245, ptr %247, align 8, !tbaa !17
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %248

248:                                              ; preds = %244, %240
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %250

249:                                              ; preds = %191
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %250

250:                                              ; preds = %249, %248, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %9) #7
  br label %405

251:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %252 = load ptr, ptr %4, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.HandleTCPClient, ptr %252, i32 0, i32 6
  %254 = load i32, ptr %253, align 4, !tbaa !28
  %255 = sitofp i32 %254 to double
  store double %255, ptr %21, align 8, !tbaa !29
  %256 = load double, ptr %21, align 8, !tbaa !29
  %257 = fcmp olt double %256, 0.000000e+00
  br i1 %257, label %258, label %259

258:                                              ; preds = %251
  store double 5.000000e+02, ptr %21, align 8, !tbaa !29
  br label %259

259:                                              ; preds = %258, %251
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %260 = call double (...) @mTimer()
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.HandleTCPClient, ptr %261, i32 0, i32 7
  %263 = load double, ptr %262, align 8, !tbaa !17
  %264 = fsub double %260, %263
  store double %264, ptr %22, align 8, !tbaa !29
  %265 = load double, ptr %22, align 8, !tbaa !29
  %266 = load double, ptr %21, align 8, !tbaa !29
  %267 = fcmp olt double %265, %266
  br i1 %267, label %268, label %275

268:                                              ; preds = %259
  %269 = load ptr, ptr %4, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.HandleTCPClient, ptr %269, i32 0, i32 8
  %271 = load i32, ptr %270, align 8, !tbaa !18
  %272 = icmp ne i32 %271, 0
  %273 = zext i1 %272 to i64
  %274 = select i1 %272, i32 -1, i32 0
  store i32 %274, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %299

275:                                              ; preds = %259
  br label %276

276:                                              ; preds = %275
  %277 = load i32, ptr @morn_log_levelset, align 4, !tbaa !13
  %278 = icmp sge i32 32, %277
  br i1 %278, label %279, label %284

279:                                              ; preds = %276
  %280 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %280, align 4, !tbaa !13
  %281 = load ptr, ptr %4, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct.HandleTCPClient, ptr %281, i32 0, i32 3
  %283 = getelementptr inbounds [32 x i8], ptr %282, i64 0, i64 0
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef @.str.16, ptr noundef %283)
  br label %284

284:                                              ; preds = %279, %276
  br label %285

285:                                              ; preds = %284
  br label %286

286:                                              ; preds = %285
  %287 = load ptr, ptr %4, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.HandleTCPClient, ptr %287, i32 0, i32 0
  %289 = load i32, ptr %288, align 8, !tbaa !23
  %290 = icmp ne i32 %289, 0
  br i1 %290, label %291, label %296

291:                                              ; preds = %286
  %292 = load ptr, ptr %4, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.HandleTCPClient, ptr %292, i32 0, i32 0
  %294 = load i32, ptr %293, align 8, !tbaa !23
  %295 = call i32 @close(i32 noundef %294)
  br label %296

296:                                              ; preds = %291, %286
  %297 = load ptr, ptr %4, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.HandleTCPClient, ptr %297, i32 0, i32 0
  store i32 0, ptr %298, align 8, !tbaa !23
  store i32 0, ptr %17, align 4
  br label %299

299:                                              ; preds = %296, %268
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  %300 = load i32, ptr %17, align 4
  switch i32 %300, label %405 [
    i32 0, label %301
  ]

301:                                              ; preds = %299
  br label %302

302:                                              ; preds = %301, %78, %52
  %303 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 6) #7
  %304 = load ptr, ptr %4, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.HandleTCPClient, ptr %304, i32 0, i32 0
  store i32 %303, ptr %305, align 8, !tbaa !23
  %306 = load ptr, ptr %4, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.HandleTCPClient, ptr %306, i32 0, i32 0
  %308 = load i32, ptr %307, align 8, !tbaa !23
  %309 = icmp slt i32 %308, 0
  br i1 %309, label %310, label %313

310:                                              ; preds = %302
  %311 = load ptr, ptr %4, align 8, !tbaa !5
  %312 = getelementptr inbounds %struct.HandleTCPClient, ptr %311, i32 0, i32 0
  store i32 0, ptr %312, align 8, !tbaa !23
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %405

313:                                              ; preds = %302
  %314 = load ptr, ptr %4, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.HandleTCPClient, ptr %314, i32 0, i32 4
  %316 = load i32, ptr %315, align 4, !tbaa !16
  %317 = icmp sge i32 %316, 0
  br i1 %317, label %318, label %366

318:                                              ; preds = %313
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %319 = load ptr, ptr %4, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.HandleTCPClient, ptr %319, i32 0, i32 0
  %321 = load i32, ptr %320, align 8, !tbaa !23
  %322 = call i32 (i32, i32, ...) @fcntl(i32 noundef %321, i32 noundef 3, i32 noundef 0)
  store i32 %322, ptr %23, align 4, !tbaa !13
  %323 = load ptr, ptr %4, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.HandleTCPClient, ptr %323, i32 0, i32 0
  %325 = load i32, ptr %324, align 8, !tbaa !23
  %326 = load i32, ptr %23, align 4, !tbaa !13
  %327 = or i32 %326, 2048
  %328 = call i32 (i32, i32, ...) @fcntl(i32 noundef %325, i32 noundef 4, i32 noundef %327)
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #7
  %329 = getelementptr inbounds %struct.sockaddr_in, ptr %24, i32 0, i32 0
  store i16 2, ptr %329, align 4, !tbaa !30
  %330 = load i32, ptr %6, align 4, !tbaa !13
  %331 = trunc i32 %330 to i16
  %332 = call zeroext i16 @__bswap_16(i16 noundef zeroext %331)
  %333 = getelementptr inbounds %struct.sockaddr_in, ptr %24, i32 0, i32 1
  store i16 %332, ptr %333, align 2, !tbaa !34
  %334 = load i32, ptr %5, align 4, !tbaa !13
  %335 = getelementptr inbounds %struct.sockaddr_in, ptr %24, i32 0, i32 2
  %336 = getelementptr inbounds %struct.in_addr, ptr %335, i32 0, i32 0
  store i32 %334, ptr %336, align 4, !tbaa !35
  %337 = load ptr, ptr %4, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct.HandleTCPClient, ptr %337, i32 0, i32 0
  %339 = load i32, ptr %338, align 8, !tbaa !23
  %340 = call i32 @connect(i32 noundef %339, ptr noundef %24, i32 noundef 16)
  store i32 %340, ptr %23, align 4, !tbaa !13
  %341 = load i32, ptr %23, align 4, !tbaa !13
  %342 = icmp slt i32 %341, 0
  br i1 %342, label %343, label %360

343:                                              ; preds = %318
  br label %344

344:                                              ; preds = %343
  %345 = load i32, ptr @morn_log_levelset, align 4, !tbaa !13
  %346 = icmp sge i32 64, %345
  br i1 %346, label %347, label %355

347:                                              ; preds = %344
  %348 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %348, align 4, !tbaa !13
  %349 = load ptr, ptr %4, align 8, !tbaa !5
  %350 = getelementptr inbounds %struct.HandleTCPClient, ptr %349, i32 0, i32 3
  %351 = getelementptr inbounds [32 x i8], ptr %350, i64 0, i64 0
  %352 = call ptr @__errno_location() #8
  %353 = load i32, ptr %352, align 4, !tbaa !13
  %354 = call ptr @strerror(i32 noundef %353) #7
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef @.str.17, ptr noundef %351, ptr noundef %354)
  br label %355

355:                                              ; preds = %347, %344
  br label %356

356:                                              ; preds = %355
  br label %357

357:                                              ; preds = %356
  %358 = load ptr, ptr %4, align 8, !tbaa !5
  %359 = getelementptr inbounds %struct.HandleTCPClient, ptr %358, i32 0, i32 8
  store i32 -1, ptr %359, align 8, !tbaa !18
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %365

360:                                              ; preds = %318
  %361 = load ptr, ptr %4, align 8, !tbaa !5
  %362 = getelementptr inbounds %struct.HandleTCPClient, ptr %361, i32 0, i32 8
  store i32 0, ptr %362, align 8, !tbaa !18
  %363 = load ptr, ptr %4, align 8, !tbaa !5
  %364 = getelementptr inbounds %struct.HandleTCPClient, ptr %363, i32 0, i32 7
  store double -1.000000e+00, ptr %364, align 8, !tbaa !17
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %365

365:                                              ; preds = %360, %357
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %405

366:                                              ; preds = %313
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #7
  %367 = getelementptr inbounds %struct.sockaddr_in, ptr %25, i32 0, i32 0
  store i16 2, ptr %367, align 4, !tbaa !30
  %368 = load i32, ptr %6, align 4, !tbaa !13
  %369 = trunc i32 %368 to i16
  %370 = call zeroext i16 @__bswap_16(i16 noundef zeroext %369)
  %371 = getelementptr inbounds %struct.sockaddr_in, ptr %25, i32 0, i32 1
  store i16 %370, ptr %371, align 2, !tbaa !34
  %372 = load i32, ptr %5, align 4, !tbaa !13
  %373 = getelementptr inbounds %struct.sockaddr_in, ptr %25, i32 0, i32 2
  %374 = getelementptr inbounds %struct.in_addr, ptr %373, i32 0, i32 0
  store i32 %372, ptr %374, align 4, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %375 = load ptr, ptr %4, align 8, !tbaa !5
  %376 = getelementptr inbounds %struct.HandleTCPClient, ptr %375, i32 0, i32 0
  %377 = load i32, ptr %376, align 8, !tbaa !23
  %378 = call i32 @connect(i32 noundef %377, ptr noundef %25, i32 noundef 16)
  store i32 %378, ptr %26, align 4, !tbaa !13
  %379 = load i32, ptr %26, align 4, !tbaa !13
  %380 = icmp slt i32 %379, 0
  br i1 %380, label %381, label %399

381:                                              ; preds = %366
  br label %382

382:                                              ; preds = %381
  %383 = load i32, ptr @morn_log_levelset, align 4, !tbaa !13
  %384 = icmp sge i32 64, %383
  br i1 %384, label %385, label %393

385:                                              ; preds = %382
  %386 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %386, align 4, !tbaa !13
  %387 = load ptr, ptr %4, align 8, !tbaa !5
  %388 = getelementptr inbounds %struct.HandleTCPClient, ptr %387, i32 0, i32 3
  %389 = getelementptr inbounds [32 x i8], ptr %388, i64 0, i64 0
  %390 = call ptr @__errno_location() #8
  %391 = load i32, ptr %390, align 4, !tbaa !13
  %392 = call ptr @strerror(i32 noundef %391) #7
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef @.str.18, ptr noundef %389, ptr noundef %392)
  br label %393

393:                                              ; preds = %385, %382
  br label %394

394:                                              ; preds = %393
  br label %395

395:                                              ; preds = %394
  %396 = call double (...) @mTimer()
  %397 = load ptr, ptr %4, align 8, !tbaa !5
  %398 = getelementptr inbounds %struct.HandleTCPClient, ptr %397, i32 0, i32 7
  store double %396, ptr %398, align 8, !tbaa !17
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %404

399:                                              ; preds = %366
  %400 = load ptr, ptr %4, align 8, !tbaa !5
  %401 = getelementptr inbounds %struct.HandleTCPClient, ptr %400, i32 0, i32 8
  store i32 0, ptr %401, align 8, !tbaa !18
  %402 = load ptr, ptr %4, align 8, !tbaa !5
  %403 = getelementptr inbounds %struct.HandleTCPClient, ptr %402, i32 0, i32 7
  store double -1.000000e+00, ptr %403, align 8, !tbaa !17
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %404

404:                                              ; preds = %399, %395
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #7
  br label %405

405:                                              ; preds = %404, %365, %310, %299, %250
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %406 = load i32, ptr %2, align 4
  ret i32 %406
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #5

declare void @m_Log(i32 noundef, ptr noundef, ...) #2

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

declare double @mTimer(...) #2

declare i32 @fcntl(i32 noundef, i32 noundef, ...) #2

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) #2

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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, !11, i64 4}
!10 = !{!"HandleTCPClient", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 12, !11, i64 44, !11, i64 48, !11, i64 52, !12, i64 56, !11, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!10, !11, i64 44}
!17 = !{!10, !12, i64 56}
!18 = !{!10, !11, i64 64}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!10, !11, i64 0}
!24 = distinct !{!24, !22}
!25 = !{!26, !20, i64 0}
!26 = !{!"timeval", !20, i64 0, !20, i64 8}
!27 = !{!26, !20, i64 8}
!28 = !{!10, !11, i64 52}
!29 = !{!12, !12, i64 0}
!30 = !{!31, !32, i64 0}
!31 = !{!"sockaddr_in", !32, i64 0, !32, i64 2, !33, i64 4, !7, i64 8}
!32 = !{!"short", !7, i64 0}
!33 = !{!"in_addr", !11, i64 0}
!34 = !{!31, !32, i64 2}
!35 = !{!31, !11, i64 4}


; 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.fd_set = type { [16 x i64] }
%struct.timeval = type { i64, i64 }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@__FUNCTION__.TCPClientConnect = external hidden unnamed_addr constant [17 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [19 x i8], align 1
@morn_log_levelset = external local_unnamed_addr global i32, align 4
@morn_log_level = external thread_local local_unnamed_addr global i32, align 4
@.str.15 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @IPAddress(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #2

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #5

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @TCPClientInit(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @TCPClientConnect(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.fd_set, align 8
  %5 = alloca %struct.fd_set, align 8
  %6 = alloca %struct.timeval, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.sockaddr_in, align 4
  %10 = alloca %struct.sockaddr_in, align 4
  %11 = tail call ptr @TCPClientInit(ptr noundef %0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %13, ptr %2, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  %14 = getelementptr inbounds i8, ptr %11, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !12
  store i32 %15, ptr %3, align 4, !tbaa !11
  call void @IPAddress(ptr noundef %0, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %16 = load i32, ptr %2, align 4
  store i32 %16, ptr %12, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !11
  store i32 %17, ptr %14, align 8, !tbaa !12
  %18 = icmp eq i32 %16, 0
  %19 = trunc i32 %16 to i8
  %20 = lshr i32 %16, 8
  %21 = trunc i32 %20 to i8
  %22 = lshr i32 %16, 16
  %23 = trunc i32 %22 to i8
  %24 = lshr i32 %16, 24
  %25 = trunc nuw i32 %24 to i8
  br i1 %18, label %26, label %27

26:                                               ; preds = %1
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.2, i32 noundef 294, ptr noundef nonnull @__FUNCTION__.TCPClientConnect, ptr noundef nonnull @.str.14) #9
  %.pre = load i8, ptr %2, align 4, !tbaa !13
  %.phi.trans.insert = getelementptr inbounds i8, ptr %2, i64 1
  %.pre90 = load i8, ptr %.phi.trans.insert, align 1, !tbaa !13
  %.phi.trans.insert91 = getelementptr inbounds i8, ptr %2, i64 2
  %.pre92 = load i8, ptr %.phi.trans.insert91, align 2, !tbaa !13
  %.phi.trans.insert93 = getelementptr inbounds i8, ptr %2, i64 3
  %.pre94 = load i8, ptr %.phi.trans.insert93, align 1, !tbaa !13
  %.pre95 = load i32, ptr %3, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %26, %1
  %28 = phi i32 [ %.pre95, %26 ], [ %17, %1 ]
  %29 = phi i8 [ %.pre94, %26 ], [ %25, %1 ]
  %30 = phi i8 [ %.pre92, %26 ], [ %23, %1 ]
  %31 = phi i8 [ %.pre90, %26 ], [ %21, %1 ]
  %32 = phi i8 [ %.pre, %26 ], [ %19, %1 ]
  %33 = getelementptr inbounds i8, ptr %11, i64 12
  %34 = zext i8 %32 to i32
  %35 = zext i8 %31 to i32
  %36 = zext i8 %30 to i32
  %37 = zext i8 %29 to i32
  %38 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34, i32 noundef %35, i32 noundef %36, i32 noundef %37, i32 noundef %28) #9
  %39 = getelementptr inbounds i8, ptr %11, i64 44
  %40 = load i32, ptr %39, align 4, !tbaa !14
  %41 = icmp sgt i32 %40, -1
  br i1 %41, label %42, label %127

42:                                               ; preds = %27
  %43 = getelementptr inbounds i8, ptr %11, i64 56
  %44 = load double, ptr %43, align 8, !tbaa !15
  %45 = fcmp ult double %44, 0.000000e+00
  br i1 %45, label %127, label %46

46:                                               ; preds = %42
  %47 = getelementptr inbounds i8, ptr %11, i64 64
  %48 = load i32, ptr %47, align 8, !tbaa !16
  %49 = icmp eq i32 %48, -1
  br i1 %49, label %50, label %106

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %5) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %4, i8 0, i64 128, i1 false), !tbaa !17
  %51 = load i32, ptr %11, align 8, !tbaa !19
  %52 = srem i32 %51, 64
  %53 = zext nneg i32 %52 to i64
  %54 = shl nuw i64 1, %53
  %55 = sdiv i32 %51, 64
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [16 x i64], ptr %4, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !17
  %59 = or i64 %54, %58
  store i64 %59, ptr %57, align 8, !tbaa !17
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %5, i8 0, i64 128, i1 false), !tbaa !17
  %60 = getelementptr inbounds [16 x i64], ptr %5, i64 0, i64 %56
  %61 = load i64, ptr %60, align 8, !tbaa !17
  %62 = or i64 %61, %54
  store i64 %62, ptr %60, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #9
  %63 = udiv i32 %40, 1000
  %64 = zext nneg i32 %63 to i64
  store i64 %64, ptr %6, align 8, !tbaa !20
  %65 = urem i32 %40, 1000
  %66 = mul nuw nsw i32 %65, 1000
  %67 = zext nneg i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 %67, ptr %68, align 8, !tbaa !22
  %69 = add nsw i32 %51, 1
  %70 = call i32 @select(i32 noundef %69, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef null, ptr noundef nonnull %6) #9
  %71 = icmp slt i32 %70, 1
  br i1 %71, label %105, label %72

72:                                               ; preds = %50
  %73 = load i32, ptr %11, align 8, !tbaa !19
  %74 = sdiv i32 %73, 64
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [16 x i64], ptr %4, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !17
  %78 = srem i32 %73, 64
  %79 = zext nneg i32 %78 to i64
  %80 = shl nuw i64 1, %79
  %81 = and i64 %80, %77
  %.not83 = icmp eq i64 %81, 0
  br i1 %.not83, label %82, label %86

82:                                               ; preds = %72
  %83 = getelementptr inbounds [16 x i64], ptr %5, i64 0, i64 %75
  %84 = load i64, ptr %83, align 8, !tbaa !17
  %85 = and i64 %84, %80
  %.not84 = icmp eq i64 %85, 0
  br i1 %.not84, label %105, label %86

86:                                               ; preds = %82, %72
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  store i32 4, ptr %8, align 4, !tbaa !11
  %87 = call i32 @getsockopt(i32 noundef %73, i32 noundef 1, i32 noundef 4, ptr noundef nonnull %7, ptr noundef nonnull %8) #9
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %102

89:                                               ; preds = %86
  %90 = load i32, ptr %47, align 8, !tbaa !16
  %91 = icmp eq i32 %90, -1
  br i1 %91, label %92, label %thread-pre-split

92:                                               ; preds = %89
  %93 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %93, ptr %47, align 8, !tbaa !16
  %94 = load i32, ptr @morn_log_levelset, align 4, !tbaa !11
  %95 = icmp slt i32 %94, 33
  br i1 %95, label %96, label %99

96:                                               ; preds = %92
  %97 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %97, align 4, !tbaa !11
  %98 = call ptr @strerror(i32 noundef %93) #9
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef nonnull @.str.15, ptr noundef nonnull %33, ptr noundef %98) #9
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %89, %96
  %.pr = load i32, ptr %7, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %thread-pre-split, %92
  %100 = phi i32 [ %.pr, %thread-pre-split ], [ %93, %92 ]
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %104, label %102

102:                                              ; preds = %99, %86
  %103 = call double (...) @mTimer() #9
  br label %104

104:                                              ; preds = %99, %102
  %storemerge = phi double [ %103, %102 ], [ -1.000000e+00, %99 ]
  %.0 = phi i32 [ -1, %102 ], [ 0, %99 ]
  store double %storemerge, ptr %43, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  br label %105

105:                                              ; preds = %82, %50, %104
  %.1 = phi i32 [ %.0, %104 ], [ -1, %50 ], [ -1, %82 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #9
  br label %186

106:                                              ; preds = %46
  %107 = getelementptr inbounds i8, ptr %11, i64 52
  %108 = load i32, ptr %107, align 4, !tbaa !23
  %109 = sitofp i32 %108 to double
  %110 = icmp slt i32 %108, 0
  %.075 = select i1 %110, double 5.000000e+02, double %109
  %111 = call double (...) @mTimer() #9
  %112 = load double, ptr %43, align 8, !tbaa !15
  %113 = fsub double %111, %112
  %114 = fcmp uge double %113, %.075
  br i1 %114, label %115, label %124

115:                                              ; preds = %106
  %116 = load i32, ptr @morn_log_levelset, align 4, !tbaa !11
  %117 = icmp slt i32 %116, 33
  br i1 %117, label %118, label %120

118:                                              ; preds = %115
  %119 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %119, align 4, !tbaa !11
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef nonnull @.str.16, ptr noundef nonnull %33) #9
  br label %120

120:                                              ; preds = %118, %115
  %121 = load i32, ptr %11, align 8, !tbaa !19
  %.not = icmp eq i32 %121, 0
  br i1 %.not, label %.thread, label %122

122:                                              ; preds = %120
  %123 = call i32 @close(i32 noundef %121) #9
  br label %.thread

.thread:                                          ; preds = %120, %122
  store i32 0, ptr %11, align 8, !tbaa !19
  br label %127

124:                                              ; preds = %106
  %125 = load i32, ptr %47, align 8, !tbaa !16
  %.not82 = icmp ne i32 %125, 0
  %126 = sext i1 %.not82 to i32
  br label %186

127:                                              ; preds = %.thread, %42, %27
  %128 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 6) #9
  store i32 %128, ptr %11, align 8, !tbaa !19
  %129 = icmp slt i32 %128, 0
  br i1 %129, label %130, label %131

130:                                              ; preds = %127
  store i32 0, ptr %11, align 8, !tbaa !19
  br label %186

131:                                              ; preds = %127
  %132 = load i32, ptr %39, align 4, !tbaa !14
  %133 = icmp sgt i32 %132, -1
  br i1 %133, label %134, label %162

134:                                              ; preds = %131
  %135 = call i32 (i32, i32, ...) @fcntl(i32 noundef %128, i32 noundef 3, i32 noundef 0) #9
  %136 = load i32, ptr %11, align 8, !tbaa !19
  %137 = or i32 %135, 2048
  %138 = call i32 (i32, i32, ...) @fcntl(i32 noundef %136, i32 noundef 4, i32 noundef %137) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #9
  store i16 2, ptr %9, align 4, !tbaa !24
  %139 = load i32, ptr %3, align 4, !tbaa !11
  %140 = trunc i32 %139 to i16
  %141 = call zeroext i16 @__bswap_16(i16 noundef zeroext %140)
  %142 = getelementptr inbounds i8, ptr %9, i64 2
  store i16 %141, ptr %142, align 2, !tbaa !28
  %143 = load i32, ptr %2, align 4, !tbaa !11
  %144 = getelementptr inbounds i8, ptr %9, i64 4
  store i32 %143, ptr %144, align 4, !tbaa !29
  %145 = load i32, ptr %11, align 8, !tbaa !19
  %146 = call i32 @connect(i32 noundef %145, ptr noundef nonnull %9, i32 noundef 16) #9
  %147 = icmp slt i32 %146, 0
  br i1 %147, label %148, label %158

148:                                              ; preds = %134
  %149 = load i32, ptr @morn_log_levelset, align 4, !tbaa !11
  %150 = icmp slt i32 %149, 65
  br i1 %150, label %151, label %156

151:                                              ; preds = %148
  %152 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %152, align 4, !tbaa !11
  %153 = tail call ptr @__errno_location() #10
  %154 = load i32, ptr %153, align 4, !tbaa !11
  %155 = call ptr @strerror(i32 noundef %154) #9
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef nonnull @.str.17, ptr noundef nonnull %33, ptr noundef %155) #9
  br label %156

156:                                              ; preds = %151, %148
  %157 = getelementptr inbounds i8, ptr %11, i64 64
  store i32 -1, ptr %157, align 8, !tbaa !16
  br label %161

158:                                              ; preds = %134
  %159 = getelementptr inbounds i8, ptr %11, i64 64
  store i32 0, ptr %159, align 8, !tbaa !16
  %160 = getelementptr inbounds i8, ptr %11, i64 56
  store double -1.000000e+00, ptr %160, align 8, !tbaa !15
  br label %161

161:                                              ; preds = %158, %156
  %.3 = phi i32 [ -1, %156 ], [ 0, %158 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #9
  br label %186

162:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #9
  store i16 2, ptr %10, align 4, !tbaa !24
  %163 = load i32, ptr %3, align 4, !tbaa !11
  %164 = trunc i32 %163 to i16
  %165 = call zeroext i16 @__bswap_16(i16 noundef zeroext %164)
  %166 = getelementptr inbounds i8, ptr %10, i64 2
  store i16 %165, ptr %166, align 2, !tbaa !28
  %167 = load i32, ptr %2, align 4, !tbaa !11
  %168 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 %167, ptr %168, align 4, !tbaa !29
  %169 = load i32, ptr %11, align 8, !tbaa !19
  %170 = call i32 @connect(i32 noundef %169, ptr noundef nonnull %10, i32 noundef 16) #9
  %171 = icmp slt i32 %170, 0
  br i1 %171, label %172, label %182

172:                                              ; preds = %162
  %173 = load i32, ptr @morn_log_levelset, align 4, !tbaa !11
  %174 = icmp slt i32 %173, 65
  br i1 %174, label %175, label %180

175:                                              ; preds = %172
  %176 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %176, align 4, !tbaa !11
  %177 = tail call ptr @__errno_location() #10
  %178 = load i32, ptr %177, align 4, !tbaa !11
  %179 = call ptr @strerror(i32 noundef %178) #9
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef nonnull @.str.18, ptr noundef nonnull %33, ptr noundef %179) #9
  br label %180

180:                                              ; preds = %175, %172
  %181 = call double (...) @mTimer() #9
  br label %184

182:                                              ; preds = %162
  %183 = getelementptr inbounds i8, ptr %11, i64 64
  store i32 0, ptr %183, align 8, !tbaa !16
  br label %184

184:                                              ; preds = %182, %180
  %.sink = phi double [ -1.000000e+00, %182 ], [ %181, %180 ]
  %.4 = phi i32 [ 0, %182 ], [ -1, %180 ]
  %185 = getelementptr inbounds i8, ptr %11, i64 56
  store double %.sink, ptr %185, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #9
  br label %186

186:                                              ; preds = %124, %184, %161, %130, %105
  %.5 = phi i32 [ %.1, %105 ], [ -1, %130 ], [ %.3, %161 ], [ %.4, %184 ], [ %126, %124 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  ret i32 %.5
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #6

declare void @m_Log(i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #4

declare double @mTimer(...) local_unnamed_addr #2

declare i32 @fcntl(i32 noundef, i32 noundef, ...) local_unnamed_addr #2

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

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

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

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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }

!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 4}
!6 = !{!"HandleTCPClient", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 12, !7, i64 44, !7, i64 48, !7, i64 52, !10, i64 56, !7, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 8}
!13 = !{!8, !8, i64 0}
!14 = !{!6, !7, i64 44}
!15 = !{!6, !10, i64 56}
!16 = !{!6, !7, i64 64}
!17 = !{!18, !18, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!6, !7, i64 0}
!20 = !{!21, !18, i64 0}
!21 = !{!"timeval", !18, i64 0, !18, i64 8}
!22 = !{!21, !18, i64 8}
!23 = !{!6, !7, i64 52}
!24 = !{!25, !26, i64 0}
!25 = !{!"sockaddr_in", !26, i64 0, !26, i64 2, !27, i64 4, !8, i64 8}
!26 = !{!"short", !8, i64 0}
!27 = !{!"in_addr", !7, i64 0}
!28 = !{!25, !26, i64 2}
!29 = !{!25, !7, i64 4}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopRotatePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass