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

@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.m_TCPClientRead = external hidden unnamed_addr constant [16 x i8], align 1

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

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

declare i32 @close(i32 noundef) #1

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

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

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

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

declare double @mTimer(...) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @m_TCPClientRead(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.timeval, align 8
  %14 = alloca %struct.fd_set, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  %22 = zext i1 %21 to i32
  store i32 %22, ptr %8, align 4, !tbaa !9
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %19
  %26 = load i32, ptr %8, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %26, i32 noundef -1, ptr noundef @.str.2, i32 noundef 412, ptr noundef @__FUNCTION__.m_TCPClientRead, ptr noundef @.str.19)
  br label %27

27:                                               ; preds = %25, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %28

28:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 2147483647, ptr %9, align 4, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store ptr %9, ptr %7, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %31, %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call ptr @TCPClientInit(ptr noundef %33)
  store ptr %34, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.HandleTCPClient, ptr %35, i32 0, i32 5
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %44, label %39

39:                                               ; preds = %32
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.HandleTCPClient, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !14
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %52

44:                                               ; preds = %39, %32
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i32 @TCPClientConnect(ptr noundef %45)
  %47 = icmp eq i32 %46, -1
  br i1 %47, label %48, label %51

48:                                               ; preds = %44
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.HandleTCPClient, ptr %49, i32 0, i32 1
  store i32 0, ptr %50, align 4, !tbaa !14
  br label %165

51:                                               ; preds = %44
  br label %52

52:                                               ; preds = %51, %39
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.HandleTCPClient, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 4, !tbaa !15
  %56 = icmp sge i32 %55, 0
  br i1 %56, label %57, label %135

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #3
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.HandleTCPClient, ptr %58, i32 0, i32 4
  %60 = load i32, ptr %59, align 4, !tbaa !15
  %61 = sdiv i32 %60, 1000
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds %struct.timeval, ptr %13, i32 0, i32 0
  store i64 %62, ptr %63, align 8, !tbaa !16
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.HandleTCPClient, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = srem i32 %66, 1000
  %68 = mul nsw i32 %67, 1000
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds %struct.timeval, ptr %13, i32 0, i32 1
  store i64 %69, ptr %70, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 128, ptr %14) #3
  br label %71

71:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  store ptr %14, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %82, %71
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = icmp ult i64 %74, 16
  br i1 %75, label %76, label %85

76:                                               ; preds = %72
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.fd_set, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds [16 x i64], ptr %78, i64 0, i64 %80
  store i64 0, ptr %81, align 8, !tbaa !20
  br label %82

82:                                               ; preds = %76
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = add i32 %83, 1
  store i32 %84, ptr %15, align 4, !tbaa !9
  br label %72, !llvm.loop !21

85:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.HandleTCPClient, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %89, align 8, !tbaa !23
  %91 = srem i32 %90, 64
  %92 = zext i32 %91 to i64
  %93 = shl i64 1, %92
  %94 = getelementptr inbounds %struct.fd_set, ptr %14, i32 0, i32 0
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.HandleTCPClient, ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 8, !tbaa !23
  %98 = sdiv i32 %97, 64
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [16 x i64], ptr %94, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !20
  %102 = or i64 %101, %93
  store i64 %102, ptr %100, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.HandleTCPClient, ptr %103, i32 0, i32 0
  %105 = load i32, ptr %104, align 8, !tbaa !23
  %106 = add nsw i32 %105, 1
  %107 = call i32 @select(i32 noundef %106, ptr noundef %14, ptr noundef null, ptr noundef null, ptr noundef %13)
  store i32 %107, ptr %17, align 4, !tbaa !9
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = icmp sle i32 %108, 0
  br i1 %109, label %129, label %110

110:                                              ; preds = %87
  %111 = getelementptr inbounds %struct.fd_set, ptr %14, i32 0, i32 0
  %112 = load ptr, ptr %10, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.HandleTCPClient, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %113, align 8, !tbaa !23
  %115 = sdiv i32 %114, 64
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [16 x i64], ptr %111, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !20
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.HandleTCPClient, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !23
  %122 = srem i32 %121, 64
  %123 = zext i32 %122 to i64
  %124 = shl i64 1, %123
  %125 = and i64 %118, %124
  %126 = icmp ne i64 %125, 0
  %127 = zext i1 %126 to i32
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %110, %87
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %130, align 4, !tbaa !9
  store i32 4, ptr %18, align 4
  br label %132

131:                                              ; preds = %110
  store i32 0, ptr %18, align 4
  br label %132

132:                                              ; preds = %131, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #3
  %133 = load i32, ptr %18, align 4
  switch i32 %133, label %210 [
    i32 0, label %134
    i32 4, label %165
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %52
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.HandleTCPClient, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %137, align 8, !tbaa !23
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = load i32, ptr %140, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = call i64 @recv(i32 noundef %138, ptr noundef %139, i64 noundef %142, i32 noundef 0)
  %144 = trunc i64 %143 to i32
  store i32 %144, ptr %12, align 4, !tbaa !9
  %145 = load i32, ptr %12, align 4, !tbaa !9
  %146 = icmp sle i32 %145, 0
  br i1 %146, label %147, label %149

147:                                              ; preds = %135
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %148, align 4, !tbaa !9
  br label %165

149:                                              ; preds = %135
  %150 = load i32, ptr %12, align 4, !tbaa !9
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = load i32, ptr %151, align 4, !tbaa !9
  %153 = icmp slt i32 %150, %152
  br i1 %153, label %154, label %159

154:                                              ; preds = %149
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = load i32, ptr %12, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %155, i64 %157
  store i8 0, ptr %158, align 1, !tbaa !24
  br label %159

159:                                              ; preds = %154, %149
  %160 = load i32, ptr %12, align 4, !tbaa !9
  %161 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %160, ptr %161, align 4, !tbaa !9
  %162 = load ptr, ptr %10, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.HandleTCPClient, ptr %162, i32 0, i32 3
  %164 = getelementptr inbounds [32 x i8], ptr %163, i64 0, i64 0
  store ptr %164, ptr %11, align 8, !tbaa !5
  br label %165

165:                                              ; preds = %159, %147, %132, %48
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.HandleTCPClient, ptr %166, i32 0, i32 5
  %168 = load i32, ptr %167, align 8, !tbaa !11
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %183

170:                                              ; preds = %165
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.HandleTCPClient, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 8, !tbaa !23
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %175, label %180

175:                                              ; preds = %170
  %176 = load ptr, ptr %10, 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 = call i32 @close(i32 noundef %178)
  br label %180

180:                                              ; preds = %175, %170
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.HandleTCPClient, ptr %181, i32 0, i32 0
  store i32 0, ptr %182, align 8, !tbaa !23
  br label %208

183:                                              ; preds = %165
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.HandleTCPClient, ptr %184, i32 0, i32 6
  %186 = load i32, ptr %185, align 4, !tbaa !25
  %187 = icmp sgt i32 %186, 0
  br i1 %187, label %188, label %207

188:                                              ; preds = %183
  %189 = load ptr, ptr %11, align 8, !tbaa !5
  %190 = icmp ne ptr %189, null
  br i1 %190, label %191, label %194

191:                                              ; preds = %188
  %192 = load ptr, ptr %10, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.HandleTCPClient, ptr %192, i32 0, i32 7
  store double -1.000000e+00, ptr %193, align 8, !tbaa !26
  br label %206

194:                                              ; preds = %188
  %195 = load ptr, ptr %10, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.HandleTCPClient, ptr %195, i32 0, i32 1
  store i32 0, ptr %196, align 4, !tbaa !14
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.HandleTCPClient, ptr %197, i32 0, i32 7
  %199 = load double, ptr %198, align 8, !tbaa !26
  %200 = fcmp olt double %199, 0.000000e+00
  br i1 %200, label %201, label %205

201:                                              ; preds = %194
  %202 = call double (...) @mTimer()
  %203 = load ptr, ptr %10, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.HandleTCPClient, ptr %203, i32 0, i32 7
  store double %202, ptr %204, align 8, !tbaa !26
  br label %205

205:                                              ; preds = %201, %194
  br label %206

206:                                              ; preds = %205, %191
  br label %207

207:                                              ; preds = %206, %183
  br label %208

208:                                              ; preds = %207, %180
  %209 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %209, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %210

210:                                              ; preds = %208, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  %211 = load ptr, ptr %4, align 8
  ret ptr %211
}

declare i64 @recv(i32 noundef, ptr noundef, i64 noundef, i32 noundef) #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 48}
!12 = !{!"HandleTCPClient", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 12, !10, i64 44, !10, i64 48, !10, i64 52, !13, i64 56, !10, i64 64}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !10, i64 44}
!16 = !{!17, !18, i64 0}
!17 = !{!"timeval", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !18, i64 8}
!20 = !{!18, !18, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!12, !10, i64 0}
!24 = !{!7, !7, i64 0}
!25 = !{!12, !10, i64 52}
!26 = !{!12, !13, i64 56}


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

@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.m_TCPClientRead = external hidden unnamed_addr constant [16 x i8], align 1

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @m_TCPClientRead(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.timeval, align 8
  %5 = alloca %struct.fd_set, align 8
  %6 = icmp eq ptr %1, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %3
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.2, i32 noundef 412, ptr noundef nonnull @__FUNCTION__.m_TCPClientRead, ptr noundef nonnull @.str.19) #4
  br label %8

8:                                                ; preds = %7, %3
  %9 = icmp eq ptr %2, null
  %10 = tail call ptr @TCPClientInit(ptr noundef %0)
  %11 = getelementptr inbounds i8, ptr %10, i64 48
  %12 = load i32, ptr %11, align 8, !tbaa !5
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %18, label %14

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %10, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %23

18:                                               ; preds = %14, %8
  %19 = tail call i32 @TCPClientConnect(ptr noundef %0)
  %20 = icmp eq i32 %19, -1
  br i1 %20, label %21, label %23

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %.cont58

23:                                               ; preds = %18, %14
  %24 = getelementptr inbounds i8, ptr %10, i64 44
  %25 = load i32, ptr %24, align 4, !tbaa !12
  %26 = icmp sgt i32 %25, -1
  %.pre = load i32, ptr %10, align 8, !tbaa !13
  br i1 %26, label %27, label %56

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %28 = udiv i32 %25, 1000
  %29 = zext nneg i32 %28 to i64
  store i64 %29, ptr %4, align 8, !tbaa !14
  %30 = urem i32 %25, 1000
  %31 = mul nuw nsw i32 %30, 1000
  %32 = zext nneg i32 %31 to i64
  %33 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %32, ptr %33, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %5) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %5, i8 0, i64 128, i1 false), !tbaa !18
  %34 = srem i32 %.pre, 64
  %35 = zext nneg i32 %34 to i64
  %36 = shl nuw i64 1, %35
  %37 = sdiv i32 %.pre, 64
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [16 x i64], ptr %5, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !18
  %41 = or i64 %36, %40
  store i64 %41, ptr %39, align 8, !tbaa !18
  %42 = add nsw i32 %.pre, 1
  %43 = call i32 @select(i32 noundef %42, ptr noundef nonnull %5, ptr noundef null, ptr noundef null, ptr noundef nonnull %4) #4
  %44 = icmp slt i32 %43, 1
  br i1 %44, label %55, label %45

45:                                               ; preds = %27
  %46 = load i32, ptr %10, align 8, !tbaa !13
  %47 = sdiv i32 %46, 64
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [16 x i64], ptr %5, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !18
  %51 = srem i32 %46, 64
  %52 = zext nneg i32 %51 to i64
  %53 = shl nuw i64 1, %52
  %54 = and i64 %53, %50
  %.not = icmp eq i64 %54, 0
  br i1 %.not, label %55, label %.cont65

55:                                               ; preds = %45, %27
  br i1 %9, label %.cont65.thread, label %.else67

.else67:                                          ; preds = %55
  store i32 0, ptr %2, align 4, !tbaa !19
  br label %.cont65.thread

.cont65.thread:                                   ; preds = %55, %.else67
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %.cont58

.cont65:                                          ; preds = %45
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br label %56

56:                                               ; preds = %.cont65, %23
  %57 = phi i32 [ %46, %.cont65 ], [ %.pre, %23 ]
  br i1 %9, label %.cont61, label %.cont61.thread

.cont61:                                          ; preds = %56
  %58 = call i64 @recv(i32 noundef %57, ptr noundef %1, i64 noundef 2147483647, i32 noundef 0) #4
  %59 = trunc i64 %58 to i32
  %60 = icmp slt i32 %59, 1
  br i1 %60, label %.cont58, label %.cont56

.cont61.thread:                                   ; preds = %56
  %.else.val64 = load i32, ptr %2, align 4, !tbaa !19
  %61 = sext i32 %.else.val64 to i64
  %62 = call i64 @recv(i32 noundef %57, ptr noundef %1, i64 noundef %61, i32 noundef 0) #4
  %63 = trunc i64 %62 to i32
  %64 = icmp slt i32 %63, 1
  br i1 %64, label %.else60, label %.else57

.else60:                                          ; preds = %.cont61.thread
  store i32 0, ptr %2, align 4, !tbaa !19
  br label %.cont58

.else57:                                          ; preds = %.cont61.thread
  %.else.val = load i32, ptr %2, align 4, !tbaa !19
  br label %.cont56

.cont56:                                          ; preds = %.cont61, %.else57
  %65 = phi i64 [ %62, %.else57 ], [ %58, %.cont61 ]
  %66 = phi i32 [ %63, %.else57 ], [ %59, %.cont61 ]
  %67 = phi i32 [ %.else.val, %.else57 ], [ 2147483647, %.cont61 ]
  %68 = icmp sgt i32 %67, %66
  br i1 %68, label %69, label %72

69:                                               ; preds = %.cont56
  %70 = and i64 %65, 2147483647
  %71 = getelementptr inbounds i8, ptr %1, i64 %70
  store i8 0, ptr %71, align 1, !tbaa !20
  br label %72

72:                                               ; preds = %69, %.cont56
  br i1 %9, label %.cont, label %.else

.else:                                            ; preds = %72
  store i32 %66, ptr %2, align 4, !tbaa !19
  br label %.cont

.cont:                                            ; preds = %72, %.else
  %73 = getelementptr inbounds i8, ptr %10, i64 12
  br label %.cont58

.cont58:                                          ; preds = %.else60, %.cont61, %.cont65.thread, %.cont, %21
  %.049 = phi ptr [ null, %21 ], [ %73, %.cont ], [ null, %.cont65.thread ], [ null, %.cont61 ], [ null, %.else60 ]
  %74 = load i32, ptr %11, align 8, !tbaa !5
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %81

76:                                               ; preds = %.cont58
  %77 = load i32, ptr %10, align 8, !tbaa !13
  %.not54 = icmp eq i32 %77, 0
  br i1 %.not54, label %80, label %78

78:                                               ; preds = %76
  %79 = call i32 @close(i32 noundef %77) #4
  br label %80

80:                                               ; preds = %78, %76
  store i32 0, ptr %10, align 8, !tbaa !13
  br label %95

81:                                               ; preds = %.cont58
  %82 = getelementptr inbounds i8, ptr %10, i64 52
  %83 = load i32, ptr %82, align 4, !tbaa !21
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %85, label %95

85:                                               ; preds = %81
  %.not53 = icmp eq ptr %.049, null
  br i1 %.not53, label %88, label %86

86:                                               ; preds = %85
  %87 = getelementptr inbounds i8, ptr %10, i64 56
  store double -1.000000e+00, ptr %87, align 8, !tbaa !22
  br label %95

88:                                               ; preds = %85
  %89 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 0, ptr %89, align 4, !tbaa !11
  %90 = getelementptr inbounds i8, ptr %10, i64 56
  %91 = load double, ptr %90, align 8, !tbaa !22
  %92 = fcmp olt double %91, 0.000000e+00
  br i1 %92, label %93, label %95

93:                                               ; preds = %88
  %94 = call double (...) @mTimer() #4
  store double %94, ptr %90, align 8, !tbaa !22
  br label %95

95:                                               ; preds = %80, %86, %93, %88, %81
  ret ptr %.049
}

declare i64 @recv(i32 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 48}
!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 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 44}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"timeval", !16, i64 0, !16, i64 8}
!16 = !{!"long", !8, i64 0}
!17 = !{!15, !16, i64 8}
!18 = !{!16, !16, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!8, !8, i64 0}
!21 = !{!6, !7, i64 52}
!22 = !{!6, !10, i64 56}


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