; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (TcpToSendData)

; 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._TCP_CB = type { %struct._LIST_ENTRY, ptr, ptr, %struct._TCP_PEER, %struct._TCP_PEER, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32, i8, i8, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, i32, i32, i32, i32, i16, i16, [6 x i32], i32, i32, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i8, i8, i32, i32, i32, i8, i8, i16, i32, i32, i32, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, ptr }
%struct._TCP_PEER = type { i32, i16 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._SOCKET = type { i32, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, i8, i32, i8, i16, %struct.EFI_LOCK, %struct._SOCK_BUFFER, %struct._SOCK_BUFFER, i64, i8, i32, i32, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, [20 x i8], %union._NET_PROTOCOL, ptr, ptr, ptr }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct._SOCK_BUFFER = type { i32, i32, ptr }
%union._NET_PROTOCOL = type { %struct._EFI_TCP4_PROTOCOL }
%struct._EFI_TCP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct._TCP_SEG = type { i32, i32, i32, i8, i16, i32 }
%struct.TCP_HEAD = type { i16, i16, i32, i32, i8, i8, i16, i16, i16 }

@mTcpOutFlag = external dso_local global [11 x i8], align 1
@.str = external hidden unnamed_addr constant [153 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 x i8], align 1
@mTcpStateName = external global [0 x ptr], align 8
@.str.23 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [55 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 zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #1

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

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

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #1

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

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

declare void @NetbufFree(ptr noundef) #1

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

declare i32 @NetbufTrim(ptr noundef, i32 noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @TcpToSendData(ptr noundef %0, i64 noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  br label %14

14:                                               ; preds = %2
  %15 = call zeroext i8 @DebugAssertEnabled()
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %33

17:                                               ; preds = %14
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %31

20:                                               ; preds = %17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._TCP_CB, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %31

25:                                               ; preds = %20
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._TCP_CB, ptr %26, i32 0, i32 9
  %28 = load i8, ptr %27, align 8, !tbaa !18
  %29 = zext i8 %28 to i32
  %30 = icmp ne i32 %29, 1
  br i1 %30, label %32, label %31

31:                                               ; preds = %25, %20, %17
  call void @DebugAssert(ptr noundef @.str, i64 noundef 740, ptr noundef @.str.19)
  br label %32

32:                                               ; preds = %31, %25
  br label %33

33:                                               ; preds = %32, %14
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  store i64 0, ptr %7, align 8, !tbaa !9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._TCP_CB, ptr %36, i32 0, i32 9
  %38 = load i8, ptr %37, align 8, !tbaa !18
  %39 = zext i8 %38 to i32
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %51, label %41

41:                                               ; preds = %35
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._TCP_CB, ptr %42, i32 0, i32 7
  %44 = load i32, ptr %43, align 8, !tbaa !19
  %45 = and i32 %44, 1024
  %46 = icmp ne i32 %45, 0
  %47 = zext i1 %46 to i32
  %48 = trunc i32 %47 to i8
  %49 = zext i8 %48 to i32
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %41, %35
  store i64 0, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %418

52:                                               ; preds = %41
  br label %53

53:                                               ; preds = %408, %52
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i64, ptr %5, align 8, !tbaa !9
  %56 = call i32 @TcpDataToSend(ptr noundef %54, i64 noundef %55)
  store i32 %56, ptr %6, align 4, !tbaa !20
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._TCP_CB, ptr %57, i32 0, i32 14
  %59 = load i32, ptr %58, align 4, !tbaa !21
  store i32 %59, ptr %11, align 4, !tbaa !20
  br label %60

60:                                               ; preds = %53
  %61 = call zeroext i8 @DebugAssertEnabled()
  %62 = icmp ne i8 %61, 0
  br i1 %62, label %63, label %71

63:                                               ; preds = %60
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._TCP_CB, ptr %64, i32 0, i32 9
  %66 = load i8, ptr %65, align 8, !tbaa !18
  %67 = zext i8 %66 to i64
  %68 = icmp ult i64 %67, 11
  br i1 %68, label %70, label %69

69:                                               ; preds = %63
  call void @DebugAssert(ptr noundef @.str, i64 noundef 757, ptr noundef @.str.20)
  br label %70

70:                                               ; preds = %69, %63
  br label %71

71:                                               ; preds = %70, %60
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._TCP_CB, ptr %74, i32 0, i32 9
  %76 = load i8, ptr %75, align 8, !tbaa !18
  %77 = zext i8 %76 to i64
  %78 = getelementptr inbounds [11 x i8], ptr @mTcpOutFlag, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !22
  store i8 %79, ptr %8, align 1, !tbaa !22
  %80 = load i8, ptr %8, align 1, !tbaa !22
  %81 = zext i8 %80 to i32
  %82 = and i32 %81, 2
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %88

84:                                               ; preds = %73
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._TCP_CB, ptr %85, i32 0, i32 12
  %87 = load i32, ptr %86, align 4, !tbaa !23
  store i32 %87, ptr %11, align 4, !tbaa !20
  store i32 0, ptr %6, align 4, !tbaa !20
  br label %88

88:                                               ; preds = %84, %73
  %89 = load i32, ptr %6, align 4, !tbaa !20
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %98

91:                                               ; preds = %88
  %92 = load i8, ptr %8, align 1, !tbaa !22
  %93 = zext i8 %92 to i32
  %94 = and i32 %93, 3
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %91
  %97 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %97, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %418

98:                                               ; preds = %91, %88
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load i32, ptr %11, align 4, !tbaa !20
  %101 = load i32, ptr %6, align 4, !tbaa !20
  %102 = call ptr @TcpGetSegment(ptr noundef %99, i32 noundef %100, i32 noundef %101)
  store ptr %102, ptr %9, align 8, !tbaa !5
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %121

105:                                              ; preds = %98
  br label %106

106:                                              ; preds = %105
  %107 = call zeroext i8 @DebugPrintEnabled()
  %108 = icmp ne i8 %107, 0
  br i1 %108, label %109, label %118

109:                                              ; preds = %106
  br label %110

110:                                              ; preds = %109
  %111 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %112 = icmp ne i8 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %110
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.21, ptr noundef %114)
  br label %115

115:                                              ; preds = %113, %110
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117, %106
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  br label %411

121:                                              ; preds = %98
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.NET_BUF, ptr %122, i32 0, i32 6
  %124 = getelementptr inbounds [64 x i8], ptr %123, i64 0, i64 0
  store ptr %124, ptr %10, align 8, !tbaa !5
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.NET_BUF, ptr %125, i32 0, i32 9
  %127 = load i32, ptr %126, align 4, !tbaa !24
  store i32 %127, ptr %6, align 4, !tbaa !20
  %128 = load i32, ptr %11, align 4, !tbaa !20
  %129 = load i32, ptr %6, align 4, !tbaa !20
  %130 = add i32 %128, %129
  store i32 %130, ptr %12, align 4, !tbaa !20
  %131 = load i8, ptr %8, align 1, !tbaa !22
  %132 = zext i8 %131 to i32
  %133 = and i32 %132, 2
  %134 = icmp ne i32 %133, 0
  %135 = zext i1 %134 to i32
  %136 = trunc i32 %135 to i8
  %137 = icmp ne i8 %136, 0
  br i1 %137, label %138, label %141

138:                                              ; preds = %121
  %139 = load i32, ptr %12, align 4, !tbaa !20
  %140 = add i32 %139, 1
  store i32 %140, ptr %12, align 4, !tbaa !20
  br label %141

141:                                              ; preds = %138, %121
  %142 = load i8, ptr %8, align 1, !tbaa !22
  %143 = zext i8 %142 to i32
  %144 = and i32 %143, 1
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %205

146:                                              ; preds = %141
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = call i32 @TcpGetMaxSndNxt(ptr noundef %147)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._TCP_CB, ptr %149, i32 0, i32 14
  %151 = load i32, ptr %150, align 4, !tbaa !21
  %152 = icmp eq i32 %148, %151
  br i1 %152, label %153, label %199

153:                                              ; preds = %146
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._TCP_CB, ptr %154, i32 0, i32 2
  %156 = load ptr, ptr %155, align 8, !tbaa !11
  %157 = getelementptr inbounds %struct._SOCKET, ptr %156, i32 0, i32 11
  %158 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !26
  %160 = getelementptr inbounds %struct.NET_BUF_QUEUE, ptr %159, i32 0, i32 4
  %161 = load i32, ptr %160, align 8, !tbaa !30
  %162 = icmp eq i32 %161, 0
  br i1 %162, label %163, label %199

163:                                              ; preds = %153
  %164 = load i32, ptr %12, align 4, !tbaa !20
  %165 = add i32 %164, 1
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._TCP_CB, ptr %166, i32 0, i32 17
  %168 = load i32, ptr %167, align 8, !tbaa !32
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._TCP_CB, ptr %169, i32 0, i32 20
  %171 = load i32, ptr %170, align 4, !tbaa !33
  %172 = add i32 %168, %171
  %173 = sub i32 %165, %172
  %174 = icmp slt i32 %173, 0
  br i1 %174, label %175, label %199

175:                                              ; preds = %163
  br label %176

176:                                              ; preds = %175
  %177 = call zeroext i8 @DebugPrintEnabled()
  %178 = icmp ne i8 %177, 0
  br i1 %178, label %179, label %194

179:                                              ; preds = %176
  br label %180

180:                                              ; preds = %179
  %181 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %182 = icmp ne i8 %181, 0
  br i1 %182, label %183, label %191

183:                                              ; preds = %180
  %184 = load ptr, ptr %4, align 8, !tbaa !5
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct._TCP_CB, ptr %185, i32 0, i32 9
  %187 = load i8, ptr %186, align 8, !tbaa !18
  %188 = zext i8 %187 to i64
  %189 = getelementptr inbounds [0 x ptr], ptr @mTcpStateName, i64 0, i64 %188
  %190 = load ptr, ptr %189, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.22, ptr noundef %184, ptr noundef %190)
  br label %191

191:                                              ; preds = %183, %180
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193, %176
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  %197 = load i32, ptr %12, align 4, !tbaa !20
  %198 = add i32 %197, 1
  store i32 %198, ptr %12, align 4, !tbaa !20
  br label %204

199:                                              ; preds = %163, %153, %146
  %200 = load i8, ptr %8, align 1, !tbaa !22
  %201 = zext i8 %200 to i32
  %202 = and i32 %201, -2
  %203 = trunc i32 %202 to i8
  store i8 %203, ptr %8, align 1, !tbaa !22
  br label %204

204:                                              ; preds = %199, %196
  br label %205

205:                                              ; preds = %204, %141
  %206 = load i32, ptr %11, align 4, !tbaa !20
  %207 = load ptr, ptr %10, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct._TCP_SEG, ptr %207, i32 0, i32 0
  store i32 %206, ptr %208, align 4, !tbaa !34
  %209 = load i32, ptr %12, align 4, !tbaa !20
  %210 = load ptr, ptr %10, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct._TCP_SEG, ptr %210, i32 0, i32 1
  store i32 %209, ptr %211, align 4, !tbaa !36
  %212 = load i8, ptr %8, align 1, !tbaa !22
  %213 = load ptr, ptr %10, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct._TCP_SEG, ptr %213, i32 0, i32 3
  store i8 %212, ptr %214, align 4, !tbaa !37
  br label %215

215:                                              ; preds = %205
  %216 = call zeroext i8 @DebugAssertEnabled()
  %217 = icmp ne i8 %216, 0
  br i1 %217, label %218, label %224

218:                                              ; preds = %215
  %219 = load ptr, ptr %9, align 8, !tbaa !5
  %220 = call i64 @TcpVerifySegment(ptr noundef %219)
  %221 = icmp ne i64 %220, 0
  br i1 %221, label %223, label %222

222:                                              ; preds = %218
  call void @DebugAssert(ptr noundef @.str, i64 noundef 825, ptr noundef @.str.16)
  br label %223

223:                                              ; preds = %222, %218
  br label %224

224:                                              ; preds = %223, %215
  br label %225

225:                                              ; preds = %224
  br label %226

226:                                              ; preds = %225
  br label %227

227:                                              ; preds = %226
  %228 = call zeroext i8 @DebugAssertEnabled()
  %229 = icmp ne i8 %228, 0
  br i1 %229, label %230, label %237

230:                                              ; preds = %227
  %231 = load ptr, ptr %4, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct._TCP_CB, ptr %231, i32 0, i32 5
  %233 = call i64 @TcpCheckSndQue(ptr noundef %232)
  %234 = icmp ne i64 %233, 0
  br i1 %234, label %236, label %235

235:                                              ; preds = %230
  call void @DebugAssert(ptr noundef @.str, i64 noundef 826, ptr noundef @.str.23)
  br label %236

236:                                              ; preds = %235, %230
  br label %237

237:                                              ; preds = %236, %227
  br label %238

238:                                              ; preds = %237
  br label %239

239:                                              ; preds = %238
  %240 = load ptr, ptr %10, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct._TCP_SEG, ptr %240, i32 0, i32 1
  %242 = load i32, ptr %241, align 4, !tbaa !36
  %243 = load ptr, ptr %10, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct._TCP_SEG, ptr %243, i32 0, i32 0
  %245 = load i32, ptr %244, align 4, !tbaa !34
  %246 = icmp eq i32 %242, %245
  br i1 %246, label %247, label %265

247:                                              ; preds = %239
  br label %248

248:                                              ; preds = %247
  %249 = call zeroext i8 @DebugPrintEnabled()
  %250 = icmp ne i8 %249, 0
  br i1 %250, label %251, label %260

251:                                              ; preds = %248
  br label %252

252:                                              ; preds = %251
  %253 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2)
  %254 = icmp ne i8 %253, 0
  br i1 %254, label %255, label %257

255:                                              ; preds = %252
  %256 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2, ptr noundef @.str.24, ptr noundef %256)
  br label %257

257:                                              ; preds = %255, %252
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258
  br label %260

260:                                              ; preds = %259, %248
  br label %261

261:                                              ; preds = %260
  br label %262

262:                                              ; preds = %261
  %263 = load ptr, ptr %9, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %263)
  %264 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %264, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %418

265:                                              ; preds = %239
  %266 = load ptr, ptr %4, align 8, !tbaa !5
  %267 = load ptr, ptr %9, align 8, !tbaa !5
  %268 = call i64 @TcpTransmitSegment(ptr noundef %266, ptr noundef %267)
  %269 = icmp ne i64 %268, 0
  br i1 %269, label %270, label %293

270:                                              ; preds = %265
  %271 = load ptr, ptr %9, align 8, !tbaa !5
  %272 = load ptr, ptr %9, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.NET_BUF, ptr %272, i32 0, i32 4
  %274 = load ptr, ptr %273, align 8, !tbaa !38
  %275 = getelementptr inbounds %struct.TCP_HEAD, ptr %274, i32 0, i32 4
  %276 = load i8, ptr %275, align 1
  %277 = lshr i8 %276, 4
  %278 = zext i8 %277 to i32
  %279 = shl i32 %278, 2
  %280 = call i32 @NetbufTrim(ptr noundef %271, i32 noundef %279, i8 noundef zeroext 1)
  %281 = load ptr, ptr %9, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct.NET_BUF, ptr %281, i32 0, i32 4
  store ptr null, ptr %282, align 8, !tbaa !38
  %283 = load i8, ptr %8, align 1, !tbaa !22
  %284 = zext i8 %283 to i32
  %285 = and i32 %284, 1
  %286 = icmp ne i32 %285, 0
  br i1 %286, label %287, label %292

287:                                              ; preds = %270
  %288 = load ptr, ptr %4, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct._TCP_CB, ptr %288, i32 0, i32 7
  %290 = load i32, ptr %289, align 8, !tbaa !19
  %291 = or i32 %290, 1024
  store i32 %291, ptr %289, align 8, !tbaa !19
  br label %292

292:                                              ; preds = %287, %270
  br label %411

293:                                              ; preds = %265
  %294 = load i32, ptr %12, align 4, !tbaa !20
  %295 = load i32, ptr %11, align 4, !tbaa !20
  %296 = sub i32 %294, %295
  %297 = zext i32 %296 to i64
  %298 = load i64, ptr %7, align 8, !tbaa !9
  %299 = add nsw i64 %298, %297
  store i64 %299, ptr %7, align 8, !tbaa !9
  br label %300

300:                                              ; preds = %293
  %301 = call zeroext i8 @DebugAssertEnabled()
  %302 = icmp ne i8 %301, 0
  br i1 %302, label %303, label %310

303:                                              ; preds = %300
  %304 = load ptr, ptr %9, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.NET_BUF, ptr %304, i32 0, i32 4
  %306 = load ptr, ptr %305, align 8, !tbaa !38
  %307 = icmp ne ptr %306, null
  br i1 %307, label %309, label %308

308:                                              ; preds = %303
  call void @DebugAssert(ptr noundef @.str, i64 noundef 855, ptr noundef @.str.18)
  br label %309

309:                                              ; preds = %308, %303
  br label %310

310:                                              ; preds = %309, %300
  br label %311

311:                                              ; preds = %310
  br label %312

312:                                              ; preds = %311
  %313 = load ptr, ptr %9, align 8, !tbaa !5
  %314 = load ptr, ptr %9, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.NET_BUF, ptr %314, i32 0, i32 4
  %316 = load ptr, ptr %315, align 8, !tbaa !38
  %317 = getelementptr inbounds %struct.TCP_HEAD, ptr %316, i32 0, i32 4
  %318 = load i8, ptr %317, align 1
  %319 = lshr i8 %318, 4
  %320 = zext i8 %319 to i32
  %321 = shl i32 %320, 2
  %322 = call i32 @NetbufTrim(ptr noundef %313, i32 noundef %321, i8 noundef zeroext 1)
  %323 = load ptr, ptr %9, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.NET_BUF, ptr %323, i32 0, i32 4
  store ptr null, ptr %324, align 8, !tbaa !38
  %325 = load ptr, ptr %9, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %325)
  %326 = load ptr, ptr %4, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct._TCP_CB, ptr %326, i32 0, i32 10
  store i8 0, ptr %327, align 1, !tbaa !39
  %328 = load i8, ptr %8, align 1, !tbaa !22
  %329 = zext i8 %328 to i32
  %330 = and i32 %329, 1
  %331 = icmp ne i32 %330, 0
  br i1 %331, label %332, label %337

332:                                              ; preds = %312
  %333 = load ptr, ptr %4, align 8, !tbaa !5
  %334 = getelementptr inbounds %struct._TCP_CB, ptr %333, i32 0, i32 7
  %335 = load i32, ptr %334, align 8, !tbaa !19
  %336 = or i32 %335, 1024
  store i32 %336, ptr %334, align 8, !tbaa !19
  br label %337

337:                                              ; preds = %332, %312
  %338 = load ptr, ptr %4, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct._TCP_CB, ptr %338, i32 0, i32 14
  %340 = load i32, ptr %339, align 4, !tbaa !21
  %341 = load i32, ptr %12, align 4, !tbaa !20
  %342 = sub i32 %340, %341
  %343 = icmp slt i32 %342, 0
  br i1 %343, label %344, label %348

344:                                              ; preds = %337
  %345 = load i32, ptr %12, align 4, !tbaa !20
  %346 = load ptr, ptr %4, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct._TCP_CB, ptr %346, i32 0, i32 14
  store i32 %345, ptr %347, align 4, !tbaa !21
  br label %348

348:                                              ; preds = %344, %337
  %349 = load ptr, ptr %4, align 8, !tbaa !5
  %350 = getelementptr inbounds %struct._TCP_CB, ptr %349, i32 0, i32 28
  %351 = load i16, ptr %350, align 2, !tbaa !40
  %352 = zext i16 %351 to i32
  %353 = and i32 %352, 2
  %354 = icmp ne i32 %353, 0
  br i1 %354, label %360, label %355

355:                                              ; preds = %348
  %356 = load ptr, ptr %4, align 8, !tbaa !5
  %357 = load ptr, ptr %4, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct._TCP_CB, ptr %357, i32 0, i32 42
  %359 = load i32, ptr %358, align 4, !tbaa !41
  call void @TcpSetTimer(ptr noundef %356, i16 noundef zeroext 1, i32 noundef %359)
  br label %360

360:                                              ; preds = %355, %348
  %361 = load ptr, ptr %4, align 8, !tbaa !5
  %362 = getelementptr inbounds %struct._TCP_CB, ptr %361, i32 0, i32 47
  %363 = load i8, ptr %362, align 2, !tbaa !42
  %364 = zext i8 %363 to i32
  %365 = icmp eq i32 %364, 3
  br i1 %365, label %366, label %401

366:                                              ; preds = %360
  %367 = load ptr, ptr %4, align 8, !tbaa !5
  %368 = getelementptr inbounds %struct._TCP_CB, ptr %367, i32 0, i32 7
  %369 = load i32, ptr %368, align 8, !tbaa !19
  %370 = and i32 %369, 8192
  %371 = icmp ne i32 %370, 0
  %372 = zext i1 %371 to i32
  %373 = trunc i32 %372 to i8
  %374 = icmp ne i8 %373, 0
  br i1 %374, label %401, label %375

375:                                              ; preds = %366
  br label %376

376:                                              ; preds = %375
  %377 = call zeroext i8 @DebugPrintEnabled()
  %378 = icmp ne i8 %377, 0
  br i1 %378, label %379, label %389

379:                                              ; preds = %376
  br label %380

380:                                              ; preds = %379
  %381 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %382 = icmp ne i8 %381, 0
  br i1 %382, label %383, label %386

383:                                              ; preds = %380
  %384 = load i32, ptr %11, align 4, !tbaa !20
  %385 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.25, i32 noundef %384, ptr noundef %385)
  br label %386

386:                                              ; preds = %383, %380
  br label %387

387:                                              ; preds = %386
  br label %388

388:                                              ; preds = %387
  br label %389

389:                                              ; preds = %388, %376
  br label %390

390:                                              ; preds = %389
  br label %391

391:                                              ; preds = %390
  %392 = load ptr, ptr %4, align 8, !tbaa !5
  %393 = getelementptr inbounds %struct._TCP_CB, ptr %392, i32 0, i32 7
  %394 = load i32, ptr %393, align 8, !tbaa !19
  %395 = or i32 %394, 8192
  store i32 %395, ptr %393, align 8, !tbaa !19
  %396 = load i32, ptr %11, align 4, !tbaa !20
  %397 = load ptr, ptr %4, align 8, !tbaa !5
  %398 = getelementptr inbounds %struct._TCP_CB, ptr %397, i32 0, i32 38
  store i32 %396, ptr %398, align 4, !tbaa !43
  %399 = load ptr, ptr %4, align 8, !tbaa !5
  %400 = getelementptr inbounds %struct._TCP_CB, ptr %399, i32 0, i32 39
  store i32 0, ptr %400, align 8, !tbaa !44
  br label %401

401:                                              ; preds = %391, %366, %360
  %402 = load i32, ptr %6, align 4, !tbaa !20
  %403 = load ptr, ptr %4, align 8, !tbaa !5
  %404 = getelementptr inbounds %struct._TCP_CB, ptr %403, i32 0, i32 21
  %405 = load i16, ptr %404, align 8, !tbaa !45
  %406 = zext i16 %405 to i32
  %407 = icmp eq i32 %402, %406
  br i1 %407, label %408, label %409

408:                                              ; preds = %401
  br label %53

409:                                              ; preds = %401
  %410 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %410, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %418

411:                                              ; preds = %292, %120
  %412 = load ptr, ptr %9, align 8, !tbaa !5
  %413 = icmp ne ptr %412, null
  br i1 %413, label %414, label %416

414:                                              ; preds = %411
  %415 = load ptr, ptr %9, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %415)
  br label %416

416:                                              ; preds = %414, %411
  %417 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %417, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %418

418:                                              ; preds = %416, %409, %262, %96, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %419 = load i64, ptr %3, align 8
  ret i64 %419
}

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

declare void @TcpSetTimer(ptr noundef, i16 noundef zeroext, 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 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"_TCP_CB", !13, i64 0, !6, i64 16, !6, i64 24, !14, i64 32, !14, i64 40, !13, i64 48, !13, i64 64, !15, i64 80, !15, i64 84, !7, i64 88, !7, i64 89, !16, i64 90, !15, i64 92, !15, i64 96, !15, i64 100, !15, i64 104, !15, i64 108, !15, i64 112, !15, i64 116, !15, i64 120, !15, i64 124, !16, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !15, i64 148, !16, i64 152, !16, i64 154, !7, i64 156, !15, i64 180, !15, i64 184, !15, i64 188, !7, i64 192, !7, i64 193, !7, i64 194, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !15, i64 224, !15, i64 228, !15, i64 232, !16, i64 236, !7, i64 238, !7, i64 239, !15, i64 240, !15, i64 244, !15, i64 248, !7, i64 252, !7, i64 253, !16, i64 254, !15, i64 256, !15, i64 260, !15, i64 264, !7, i64 268, !7, i64 269, !7, i64 270, !17, i64 271, !6, i64 280}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!"_TCP_PEER", !15, i64 0, !16, i64 4}
!15 = !{!"int", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"", !7, i64 0}
!18 = !{!12, !7, i64 88}
!19 = !{!12, !15, i64 80}
!20 = !{!15, !15, i64 0}
!21 = !{!12, !15, i64 100}
!22 = !{!7, !7, i64 0}
!23 = !{!12, !15, i64 92}
!24 = !{!25, !15, i64 132}
!25 = !{!"", !15, i64 0, !10, i64 8, !13, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !15, i64 128, !15, i64 132, !7, i64 136}
!26 = !{!27, !6, i64 104}
!27 = !{!"_SOCKET", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !7, i64 56, !15, i64 60, !7, i64 64, !16, i64 66, !28, i64 72, !29, i64 96, !29, i64 112, !10, i64 128, !7, i64 136, !15, i64 140, !15, i64 144, !6, i64 152, !13, i64 160, !13, i64 176, !13, i64 192, !13, i64 208, !13, i64 224, !6, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 288, !6, i64 368, !6, i64 376, !6, i64 384}
!28 = !{!"", !10, i64 0, !10, i64 8, !15, i64 16}
!29 = !{!"_SOCK_BUFFER", !15, i64 0, !15, i64 4, !6, i64 8}
!30 = !{!31, !15, i64 48}
!31 = !{!"", !15, i64 0, !10, i64 8, !13, i64 16, !13, i64 32, !15, i64 48, !15, i64 52}
!32 = !{!12, !15, i64 112}
!33 = !{!12, !15, i64 124}
!34 = !{!35, !15, i64 0}
!35 = !{!"_TCP_SEG", !15, i64 0, !15, i64 4, !15, i64 8, !7, i64 12, !16, i64 14, !15, i64 16}
!36 = !{!35, !15, i64 4}
!37 = !{!35, !7, i64 12}
!38 = !{!25, !6, i64 40}
!39 = !{!12, !7, i64 89}
!40 = !{!12, !16, i64 154}
!41 = !{!12, !15, i64 220}
!42 = !{!12, !7, i64 238}
!43 = !{!12, !15, i64 204}
!44 = !{!12, !15, i64 208}
!45 = !{!12, !16, i64 128}


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

@mTcpOutFlag = external dso_local local_unnamed_addr global [11 x i8], align 1
@.str = external hidden unnamed_addr constant [153 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 x i8], align 1
@mTcpStateName = external local_unnamed_addr global [0 x ptr], align 8
@.str.23 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [55 x i8], align 1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

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

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #0

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #0

declare void @DebugPrint(i64 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

declare void @NetbufFree(ptr noundef) local_unnamed_addr #0

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

declare i32 @NetbufTrim(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @TcpToSendData(ptr noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  %3 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %12, label %4

4:                                                ; preds = %2
  %.not97 = icmp eq ptr %0, null
  br i1 %.not97, label %11, label %5

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not98 = icmp eq ptr %7, null
  br i1 %.not98, label %11, label %8

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = load i8, ptr %9, align 8, !tbaa !15
  %.not99 = icmp eq i8 %10, 1
  br i1 %.not99, label %11, label %12

11:                                               ; preds = %8, %5, %4
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 740, ptr noundef nonnull @.str.19) #2
  br label %12

12:                                               ; preds = %8, %11, %2
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  %14 = load i8, ptr %13, align 8, !tbaa !15
  %15 = icmp eq i8 %14, 0
  br i1 %15, label %.thread, label %16

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 80
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = and i32 %18, 1024
  %.not100 = icmp eq i32 %19, 0
  br i1 %.not100, label %.preheader, label %.thread

.preheader:                                       ; preds = %16
  %20 = getelementptr inbounds i8, ptr %0, i64 100
  %21 = getelementptr inbounds i8, ptr %0, i64 92
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = getelementptr inbounds i8, ptr %0, i64 112
  %24 = getelementptr inbounds i8, ptr %0, i64 124
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = getelementptr inbounds i8, ptr %0, i64 89
  %27 = getelementptr inbounds i8, ptr %0, i64 154
  %28 = getelementptr inbounds i8, ptr %0, i64 220
  %29 = getelementptr inbounds i8, ptr %0, i64 238
  %30 = getelementptr inbounds i8, ptr %0, i64 204
  %31 = getelementptr inbounds i8, ptr %0, i64 208
  %32 = getelementptr inbounds i8, ptr %0, i64 128
  br label %33

33:                                               ; preds = %.preheader, %178
  %.093 = phi i64 [ %135, %178 ], [ 0, %.preheader ]
  %34 = tail call i32 @TcpDataToSend(ptr noundef nonnull %0, i64 noundef %1)
  %35 = load i32, ptr %20, align 4, !tbaa !17
  %36 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not101 = icmp eq i8 %36, 0
  %.pre140 = load i8, ptr %13, align 8, !tbaa !15
  %37 = icmp ult i8 %.pre140, 11
  %or.cond147 = select i1 %.not101, i1 true, i1 %37
  br i1 %or.cond147, label %39, label %38

38:                                               ; preds = %33
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 757, ptr noundef nonnull @.str.20) #2
  %.pre = load i8, ptr %13, align 8, !tbaa !15
  br label %39

39:                                               ; preds = %38, %33
  %40 = phi i8 [ %.pre, %38 ], [ %.pre140, %33 ]
  %41 = zext i8 %40 to i64
  %42 = getelementptr inbounds [11 x i8], ptr @mTcpOutFlag, i64 0, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !18
  %44 = zext i8 %43 to i32
  %45 = and i32 %44, 2
  %.not102 = icmp eq i32 %45, 0
  br i1 %.not102, label %48, label %46

46:                                               ; preds = %39
  %47 = load i32, ptr %21, align 4, !tbaa !19
  br label %48

48:                                               ; preds = %46, %39
  %.091 = phi i32 [ 0, %46 ], [ %34, %39 ]
  %.089 = phi i32 [ %47, %46 ], [ %35, %39 ]
  %49 = and i32 %44, 3
  %50 = or i32 %.091, %49
  %or.cond = icmp eq i32 %50, 0
  br i1 %or.cond, label %.thread, label %51

51:                                               ; preds = %48
  %52 = tail call ptr @TcpGetSegment(ptr noundef nonnull %0, i32 noundef %.089, i32 noundef %.091)
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %59

54:                                               ; preds = %51
  %55 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not122 = icmp eq i8 %55, 0
  br i1 %.not122, label %.thread, label %56

56:                                               ; preds = %54
  %57 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not123 = icmp eq i8 %57, 0
  br i1 %.not123, label %.thread, label %58

58:                                               ; preds = %56
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.21, ptr noundef nonnull %0) #2
  br label %.thread

59:                                               ; preds = %51
  %60 = getelementptr inbounds i8, ptr %52, i64 56
  %61 = getelementptr inbounds i8, ptr %52, i64 132
  %62 = load i32, ptr %61, align 4, !tbaa !20
  %63 = lshr exact i32 %45, 1
  %64 = add i32 %.089, %63
  %spec.select = add i32 %64, %62
  %65 = and i32 %44, 1
  %.not104 = icmp eq i32 %65, 0
  br i1 %.not104, label %95, label %66

66:                                               ; preds = %59
  %67 = tail call i32 @TcpGetMaxSndNxt(ptr noundef nonnull %0)
  %68 = load i32, ptr %20, align 4, !tbaa !17
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %70, label %93

70:                                               ; preds = %66
  %71 = load ptr, ptr %22, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 104
  %73 = load ptr, ptr %72, align 8, !tbaa !23
  %74 = getelementptr inbounds i8, ptr %73, i64 48
  %75 = load i32, ptr %74, align 8, !tbaa !27
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %93

77:                                               ; preds = %70
  %78 = add i32 %spec.select, 1
  %79 = load i32, ptr %23, align 8, !tbaa !29
  %80 = load i32, ptr %24, align 4, !tbaa !30
  %81 = add i32 %79, %80
  %82 = sub i32 %78, %81
  %83 = icmp slt i32 %82, 0
  br i1 %83, label %84, label %93

84:                                               ; preds = %77
  %85 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not105 = icmp eq i8 %85, 0
  br i1 %.not105, label %95, label %86

86:                                               ; preds = %84
  %87 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #2
  %.not106 = icmp eq i8 %87, 0
  br i1 %.not106, label %95, label %88

88:                                               ; preds = %86
  %89 = load i8, ptr %13, align 8, !tbaa !15
  %90 = zext i8 %89 to i64
  %91 = getelementptr inbounds [0 x ptr], ptr @mTcpStateName, i64 0, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !31
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.22, ptr noundef nonnull %0, ptr noundef %92) #2
  br label %95

93:                                               ; preds = %77, %70, %66
  %94 = and i8 %43, -2
  br label %95

95:                                               ; preds = %84, %88, %86, %93, %59
  %.092 = phi i8 [ %94, %93 ], [ %43, %59 ], [ %43, %86 ], [ %43, %88 ], [ %43, %84 ]
  %.1 = phi i32 [ %spec.select, %93 ], [ %spec.select, %59 ], [ %78, %86 ], [ %78, %88 ], [ %78, %84 ]
  store i32 %.089, ptr %60, align 4, !tbaa !32
  %96 = getelementptr inbounds i8, ptr %52, i64 60
  store i32 %.1, ptr %96, align 4, !tbaa !34
  %97 = getelementptr inbounds i8, ptr %52, i64 68
  store i8 %.092, ptr %97, align 4, !tbaa !35
  %98 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not107 = icmp eq i8 %98, 0
  br i1 %.not107, label %102, label %99

99:                                               ; preds = %95
  %100 = tail call i64 @TcpVerifySegment(ptr noundef nonnull %52)
  %.not108 = icmp eq i64 %100, 0
  br i1 %.not108, label %101, label %102

101:                                              ; preds = %99
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 825, ptr noundef nonnull @.str.16) #2
  br label %102

102:                                              ; preds = %95, %101, %99
  %103 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not109 = icmp eq i8 %103, 0
  br i1 %.not109, label %107, label %104

104:                                              ; preds = %102
  %105 = tail call i64 @TcpCheckSndQue(ptr noundef nonnull %25)
  %.not110 = icmp eq i64 %105, 0
  br i1 %.not110, label %106, label %107

106:                                              ; preds = %104
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 826, ptr noundef nonnull @.str.23) #2
  br label %107

107:                                              ; preds = %104, %106, %102
  %108 = load i32, ptr %96, align 4, !tbaa !34
  %109 = load i32, ptr %60, align 4, !tbaa !32
  %110 = icmp eq i32 %108, %109
  br i1 %110, label %111, label %117

111:                                              ; preds = %107
  %112 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not120 = icmp eq i8 %112, 0
  br i1 %.not120, label %116, label %113

113:                                              ; preds = %111
  %114 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2) #2
  %.not121 = icmp eq i8 %114, 0
  br i1 %.not121, label %116, label %115

115:                                              ; preds = %113
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2, ptr noundef nonnull @.str.24, ptr noundef nonnull %0) #2
  br label %116

116:                                              ; preds = %113, %115, %111
  tail call void @NetbufFree(ptr noundef nonnull %52) #2
  br label %.thread

117:                                              ; preds = %107
  %118 = tail call i64 @TcpTransmitSegment(ptr noundef nonnull %0, ptr noundef nonnull %52)
  %.not111 = icmp eq i64 %118, 0
  br i1 %.not111, label %132, label %119

119:                                              ; preds = %117
  %120 = getelementptr inbounds i8, ptr %52, i64 40
  %121 = load ptr, ptr %120, align 8, !tbaa !36
  %122 = getelementptr inbounds i8, ptr %121, i64 12
  %123 = load i8, ptr %122, align 1
  %124 = lshr i8 %123, 2
  %125 = and i8 %124, 60
  %126 = zext nneg i8 %125 to i32
  %127 = tail call i32 @NetbufTrim(ptr noundef nonnull %52, i32 noundef %126, i8 noundef zeroext 1) #2
  store ptr null, ptr %120, align 8, !tbaa !36
  %128 = and i8 %.092, 1
  %.not119 = icmp eq i8 %128, 0
  br i1 %.not119, label %182, label %129

129:                                              ; preds = %119
  %130 = load i32, ptr %17, align 8, !tbaa !16
  %131 = or i32 %130, 1024
  store i32 %131, ptr %17, align 8, !tbaa !16
  br label %182

132:                                              ; preds = %117
  %133 = sub i32 %.1, %.089
  %134 = zext i32 %133 to i64
  %135 = add nuw nsw i64 %.093, %134
  %136 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not112 = icmp eq i8 %136, 0
  br i1 %.not112, label %141, label %137

137:                                              ; preds = %132
  %138 = getelementptr inbounds i8, ptr %52, i64 40
  %139 = load ptr, ptr %138, align 8, !tbaa !36
  %.not113 = icmp eq ptr %139, null
  br i1 %.not113, label %140, label %141

140:                                              ; preds = %137
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 855, ptr noundef nonnull @.str.18) #2
  br label %141

141:                                              ; preds = %137, %140, %132
  %142 = getelementptr inbounds i8, ptr %52, i64 40
  %143 = load ptr, ptr %142, align 8, !tbaa !36
  %144 = getelementptr inbounds i8, ptr %143, i64 12
  %145 = load i8, ptr %144, align 1
  %146 = lshr i8 %145, 2
  %147 = and i8 %146, 60
  %148 = zext nneg i8 %147 to i32
  %149 = tail call i32 @NetbufTrim(ptr noundef nonnull %52, i32 noundef %148, i8 noundef zeroext 1) #2
  store ptr null, ptr %142, align 8, !tbaa !36
  tail call void @NetbufFree(ptr noundef nonnull %52) #2
  store i8 0, ptr %26, align 1, !tbaa !37
  %150 = and i8 %.092, 1
  %.not114 = icmp eq i8 %150, 0
  br i1 %.not114, label %154, label %151

151:                                              ; preds = %141
  %152 = load i32, ptr %17, align 8, !tbaa !16
  %153 = or i32 %152, 1024
  store i32 %153, ptr %17, align 8, !tbaa !16
  br label %154

154:                                              ; preds = %151, %141
  %155 = load i32, ptr %20, align 4, !tbaa !17
  %156 = sub i32 %155, %.1
  %157 = icmp slt i32 %156, 0
  br i1 %157, label %158, label %159

158:                                              ; preds = %154
  store i32 %.1, ptr %20, align 4, !tbaa !17
  br label %159

159:                                              ; preds = %158, %154
  %160 = load i16, ptr %27, align 2, !tbaa !38
  %161 = and i16 %160, 2
  %.not115 = icmp eq i16 %161, 0
  br i1 %.not115, label %162, label %164

162:                                              ; preds = %159
  %163 = load i32, ptr %28, align 4, !tbaa !39
  tail call void @TcpSetTimer(ptr noundef nonnull %0, i16 noundef zeroext 1, i32 noundef %163) #2
  br label %164

164:                                              ; preds = %162, %159
  %165 = load i8, ptr %29, align 2, !tbaa !40
  %166 = icmp eq i8 %165, 3
  br i1 %166, label %167, label %178

167:                                              ; preds = %164
  %168 = load i32, ptr %17, align 8, !tbaa !16
  %169 = and i32 %168, 8192
  %.not116 = icmp eq i32 %169, 0
  br i1 %.not116, label %170, label %178

170:                                              ; preds = %167
  %171 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not117 = icmp eq i8 %171, 0
  br i1 %.not117, label %175, label %172

172:                                              ; preds = %170
  %173 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #2
  %.not118 = icmp eq i8 %173, 0
  br i1 %.not118, label %175, label %174

174:                                              ; preds = %172
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.25, i32 noundef %.089, ptr noundef nonnull %0) #2
  br label %175

175:                                              ; preds = %172, %174, %170
  %176 = load i32, ptr %17, align 8, !tbaa !16
  %177 = or i32 %176, 8192
  store i32 %177, ptr %17, align 8, !tbaa !16
  store i32 %.089, ptr %30, align 4, !tbaa !41
  store i32 0, ptr %31, align 8, !tbaa !42
  br label %178

178:                                              ; preds = %175, %167, %164
  %179 = load i16, ptr %32, align 8, !tbaa !43
  %180 = zext i16 %179 to i32
  %181 = icmp eq i32 %62, %180
  br i1 %181, label %33, label %.thread

182:                                              ; preds = %129, %119
  tail call void @NetbufFree(ptr noundef nonnull %52) #2
  br label %.thread

.thread:                                          ; preds = %178, %48, %56, %58, %54, %182, %12, %16, %116
  %.090 = phi i64 [ %.093, %116 ], [ 0, %16 ], [ 0, %12 ], [ %.093, %182 ], [ %.093, %54 ], [ %.093, %58 ], [ %.093, %56 ], [ %135, %178 ], [ %.093, %48 ]
  ret i64 %.090
}

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

declare void @TcpSetTimer(ptr noundef, i16 noundef zeroext, i32 noundef) local_unnamed_addr #0

attributes #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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, !8, i64 24}
!6 = !{!"_TCP_CB", !7, i64 0, !8, i64 16, !8, i64 24, !11, i64 32, !11, i64 40, !7, i64 48, !7, i64 64, !12, i64 80, !12, i64 84, !9, i64 88, !9, i64 89, !13, i64 90, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !13, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148, !13, i64 152, !13, i64 154, !9, i64 156, !12, i64 180, !12, i64 184, !12, i64 188, !9, i64 192, !9, i64 193, !9, i64 194, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !12, i64 232, !13, i64 236, !9, i64 238, !9, i64 239, !12, i64 240, !12, i64 244, !12, i64 248, !9, i64 252, !9, i64 253, !13, i64 254, !12, i64 256, !12, i64 260, !12, i64 264, !9, i64 268, !9, i64 269, !9, i64 270, !14, i64 271, !8, i64 280}
!7 = !{!"_LIST_ENTRY", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"_TCP_PEER", !12, i64 0, !13, i64 4}
!12 = !{!"int", !9, i64 0}
!13 = !{!"short", !9, i64 0}
!14 = !{!"", !9, i64 0}
!15 = !{!6, !9, i64 88}
!16 = !{!6, !12, i64 80}
!17 = !{!6, !12, i64 100}
!18 = !{!9, !9, i64 0}
!19 = !{!6, !12, i64 92}
!20 = !{!21, !12, i64 132}
!21 = !{!"", !12, i64 0, !22, i64 8, !7, i64 16, !9, i64 32, !8, i64 40, !8, i64 48, !9, i64 56, !8, i64 120, !12, i64 128, !12, i64 132, !9, i64 136}
!22 = !{!"long long", !9, i64 0}
!23 = !{!24, !8, i64 104}
!24 = !{!"_SOCKET", !12, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !7, i64 40, !9, i64 56, !12, i64 60, !9, i64 64, !13, i64 66, !25, i64 72, !26, i64 96, !26, i64 112, !22, i64 128, !9, i64 136, !12, i64 140, !12, i64 144, !8, i64 152, !7, i64 160, !7, i64 176, !7, i64 192, !7, i64 208, !7, i64 224, !8, i64 240, !8, i64 248, !8, i64 256, !9, i64 264, !9, i64 288, !8, i64 368, !8, i64 376, !8, i64 384}
!25 = !{!"", !22, i64 0, !22, i64 8, !12, i64 16}
!26 = !{!"_SOCK_BUFFER", !12, i64 0, !12, i64 4, !8, i64 8}
!27 = !{!28, !12, i64 48}
!28 = !{!"", !12, i64 0, !22, i64 8, !7, i64 16, !7, i64 32, !12, i64 48, !12, i64 52}
!29 = !{!6, !12, i64 112}
!30 = !{!6, !12, i64 124}
!31 = !{!8, !8, i64 0}
!32 = !{!33, !12, i64 0}
!33 = !{!"_TCP_SEG", !12, i64 0, !12, i64 4, !12, i64 8, !9, i64 12, !13, i64 14, !12, i64 16}
!34 = !{!33, !12, i64 4}
!35 = !{!33, !9, i64 12}
!36 = !{!21, !8, i64 40}
!37 = !{!6, !9, i64 89}
!38 = !{!6, !13, i64 154}
!39 = !{!6, !12, i64 220}
!40 = !{!6, !9, i64 238}
!41 = !{!6, !12, i64 204}
!42 = !{!6, !12, i64 208}
!43 = !{!6, !13, i64 128}


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