; LLVM IR from whoiswelliton/Computer_Engineering_UTFPR-PB :: Embedded_Systems/TIVA Connected TM4C1294XL Projects/01 - lwIP_HTTPServer_on_TIVA (sendmsg)

; 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.netbuf = type { ptr, ptr, %struct.ip4_addr, i16 }
%struct.ip4_addr = type { i32 }
%struct.msghdr = type { ptr, i32, ptr, i32, ptr, i32, i32 }
%struct.lwip_sock = type { ptr, %union.lwip_sock_lastdata, i16, i16, i16, i8 }
%union.lwip_sock_lastdata = type { ptr }
%struct.netconn = type { i32, i32, %union.anon, i8, ptr, ptr, ptr, i32, i32, i32, i8, ptr, ptr }
%union.anon = type { ptr }
%struct.sockaddr_in = type { i8, i8, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.iovec = type { ptr, i64 }
%struct.pbuf = type { ptr, ptr, i16, i16, i8, i8, i8, i8 }

@errno = external global i32, align 4
@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [181 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 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: nounwind uwtable
declare hidden ptr @get_socket(i32 noundef) #1

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

declare i32 @err_to_errno(i8 noundef signext) #2

declare i32 @printf(ptr noundef, ...) #2

declare zeroext i16 @lwip_htons(i16 noundef zeroext) #2

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

; Function Attrs: nounwind uwtable
define dso_local i64 @lwip_sendmsg(i32 noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i64, align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.netbuf, align 8
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca i16, align 2
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  store i8 0, ptr %11, align 1, !tbaa !11
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = call ptr @get_socket(i32 noundef %26)
  store ptr %27, ptr %8, align 8, !tbaa !9
  %28 = load ptr, ptr %8, align 8, !tbaa !9
  %29 = icmp ne ptr %28, null
  br i1 %29, label %31, label %30

30:                                               ; preds = %3
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

31:                                               ; preds = %3
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %6, align 8, !tbaa !9
  %34 = icmp ne ptr %33, null
  br i1 %34, label %52, label %35

35:                                               ; preds = %32
  br label %36

36:                                               ; preds = %35
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.10, i32 noundef 1437, ptr noundef @.str.2)
  br label %38

38:                                               ; preds = %36
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %41 = call i32 @err_to_errno(i8 noundef signext -16)
  store i32 %41, ptr %13, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %40
  %43 = load i32, ptr %13, align 4, !tbaa !5
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %46, ptr @errno, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %45, %42
  br label %48

48:                                               ; preds = %47
  br label %49

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

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

52:                                               ; preds = %32
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.msghdr, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !12
  %59 = icmp ne ptr %58, null
  br i1 %59, label %77, label %60

60:                                               ; preds = %55
  br label %61

61:                                               ; preds = %60
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.11, i32 noundef 1439, ptr noundef @.str.2)
  br label %63

63:                                               ; preds = %61
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %66 = call i32 @err_to_errno(i8 noundef signext -16)
  store i32 %66, ptr %14, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %65
  %68 = load i32, ptr %14, align 4, !tbaa !5
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %67
  %71 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %71, ptr @errno, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %70, %67
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

77:                                               ; preds = %55
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.msghdr, ptr %81, i32 0, i32 3
  %83 = load i32, ptr %82, align 8, !tbaa !14
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %85, label %90

85:                                               ; preds = %80
  %86 = load ptr, ptr %6, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.msghdr, ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 8, !tbaa !14
  %89 = icmp sle i32 %88, 65535
  br i1 %89, label %101, label %90

90:                                               ; preds = %85, %80
  br label %91

91:                                               ; preds = %90
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.12, i32 noundef 1441, ptr noundef @.str.2)
  br label %93

93:                                               ; preds = %91
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 90, ptr %15, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %95
  store i32 90, ptr @errno, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

101:                                              ; preds = %85
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = and i32 %105, -25
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %119, label %108

108:                                              ; preds = %104
  br label %109

109:                                              ; preds = %108
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.13, i32 noundef 1443, ptr noundef @.str.2)
  br label %111

111:                                              ; preds = %109
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 95, ptr %16, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %113
  store i32 95, ptr @errno, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

119:                                              ; preds = %104
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = load ptr, ptr %6, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.msghdr, ptr %122, i32 0, i32 4
  %124 = load ptr, ptr %123, align 8, !tbaa !15
  %125 = load ptr, ptr %6, align 8, !tbaa !9
  %126 = getelementptr inbounds %struct.msghdr, ptr %125, i32 0, i32 5
  %127 = load i32, ptr %126, align 8, !tbaa !16
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.msghdr, ptr %128, i32 0, i32 6
  %130 = load i32, ptr %129, align 4, !tbaa !17
  %131 = load ptr, ptr %8, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct.lwip_sock, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !18
  %134 = getelementptr inbounds %struct.netconn, ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 8, !tbaa !21
  %136 = and i32 %135, 240
  %137 = icmp eq i32 %136, 16
  br i1 %137, label %138, label %185

138:                                              ; preds = %121
  %139 = load i32, ptr %7, align 4, !tbaa !5
  %140 = and i32 %139, 16
  %141 = icmp ne i32 %140, 0
  %142 = zext i1 %141 to i64
  %143 = select i1 %141, i32 2, i32 0
  %144 = or i32 1, %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = and i32 %145, 8
  %147 = icmp ne i32 %146, 0
  %148 = zext i1 %147 to i64
  %149 = select i1 %147, i32 4, i32 0
  %150 = or i32 %144, %149
  %151 = trunc i32 %150 to i8
  store i8 %151, ptr %9, align 1, !tbaa !11
  store i64 0, ptr %10, align 8, !tbaa !23
  %152 = load ptr, ptr %8, align 8, !tbaa !9
  %153 = getelementptr inbounds %struct.lwip_sock, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !18
  %155 = load ptr, ptr %6, align 8, !tbaa !9
  %156 = getelementptr inbounds %struct.msghdr, ptr %155, i32 0, i32 2
  %157 = load ptr, ptr %156, align 8, !tbaa !12
  %158 = load ptr, ptr %6, align 8, !tbaa !9
  %159 = getelementptr inbounds %struct.msghdr, ptr %158, i32 0, i32 3
  %160 = load i32, ptr %159, align 8, !tbaa !14
  %161 = trunc i32 %160 to i16
  %162 = load i8, ptr %9, align 1, !tbaa !11
  %163 = call signext i8 @netconn_write_vectors_partly(ptr noundef %154, ptr noundef %157, i16 noundef zeroext %161, i8 noundef zeroext %162, ptr noundef %10)
  store i8 %163, ptr %11, align 1, !tbaa !11
  br label %164

164:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %165 = load i8, ptr %11, align 1, !tbaa !11
  %166 = call i32 @err_to_errno(i8 noundef signext %165)
  store i32 %166, ptr %17, align 4, !tbaa !5
  br label %167

167:                                              ; preds = %164
  %168 = load i32, ptr %17, align 4, !tbaa !5
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %167
  %171 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %171, ptr @errno, align 4, !tbaa !5
  br label %172

172:                                              ; preds = %170, %167
  br label %173

173:                                              ; preds = %172
  br label %174

174:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  %177 = load i8, ptr %11, align 1, !tbaa !11
  %178 = sext i8 %177 to i32
  %179 = icmp eq i32 %178, 0
  br i1 %179, label %180, label %182

180:                                              ; preds = %176
  %181 = load i64, ptr %10, align 8, !tbaa !23
  br label %183

182:                                              ; preds = %176
  br label %183

183:                                              ; preds = %182, %180
  %184 = phi i64 [ %181, %180 ], [ -1, %182 ]
  store i64 %184, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %376

185:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  store i64 0, ptr %20, align 8, !tbaa !23
  %186 = load i32, ptr %7, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %185
  %188 = load ptr, ptr %6, align 8, !tbaa !9
  %189 = getelementptr inbounds %struct.msghdr, ptr %188, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !25
  %191 = icmp eq ptr %190, null
  br i1 %191, label %192, label %197

192:                                              ; preds = %187
  %193 = load ptr, ptr %6, align 8, !tbaa !9
  %194 = getelementptr inbounds %struct.msghdr, ptr %193, i32 0, i32 1
  %195 = load i32, ptr %194, align 8, !tbaa !26
  %196 = icmp eq i32 %195, 0
  br i1 %196, label %220, label %197

197:                                              ; preds = %192, %187
  %198 = load ptr, ptr %6, align 8, !tbaa !9
  %199 = getelementptr inbounds %struct.msghdr, ptr %198, i32 0, i32 1
  %200 = load i32, ptr %199, align 8, !tbaa !26
  %201 = zext i32 %200 to i64
  %202 = icmp eq i64 %201, 16
  br i1 %202, label %220, label %203

203:                                              ; preds = %197
  br label %204

204:                                              ; preds = %203
  %205 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.14, i32 noundef 1477, ptr noundef @.str.2)
  br label %206

206:                                              ; preds = %204
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %209 = call i32 @err_to_errno(i8 noundef signext -16)
  store i32 %209, ptr %21, align 4, !tbaa !5
  br label %210

210:                                              ; preds = %208
  %211 = load i32, ptr %21, align 4, !tbaa !5
  %212 = icmp ne i32 %211, 0
  br i1 %212, label %213, label %215

213:                                              ; preds = %210
  %214 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %214, ptr @errno, align 4, !tbaa !5
  br label %215

215:                                              ; preds = %213, %210
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %218

218:                                              ; preds = %217
  br label %219

219:                                              ; preds = %218
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %375

220:                                              ; preds = %197, %192
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 24, i1 false)
  %223 = load ptr, ptr %6, align 8, !tbaa !9
  %224 = getelementptr inbounds %struct.msghdr, ptr %223, i32 0, i32 0
  %225 = load ptr, ptr %224, align 8, !tbaa !25
  %226 = icmp ne ptr %225, null
  br i1 %226, label %227, label %247

227:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #4
  br label %228

228:                                              ; preds = %227
  %229 = load ptr, ptr %6, align 8, !tbaa !9
  %230 = getelementptr inbounds %struct.msghdr, ptr %229, i32 0, i32 0
  %231 = load ptr, ptr %230, align 8, !tbaa !25
  %232 = getelementptr inbounds %struct.sockaddr_in, ptr %231, i32 0, i32 3
  %233 = getelementptr inbounds %struct.in_addr, ptr %232, i32 0, i32 0
  %234 = load i32, ptr %233, align 4, !tbaa !27
  %235 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 2
  %236 = getelementptr inbounds %struct.ip4_addr, ptr %235, i32 0, i32 0
  store i32 %234, ptr %236, align 8, !tbaa !30
  %237 = load ptr, ptr %6, align 8, !tbaa !9
  %238 = getelementptr inbounds %struct.msghdr, ptr %237, i32 0, i32 0
  %239 = load ptr, ptr %238, align 8, !tbaa !25
  %240 = getelementptr inbounds %struct.sockaddr_in, ptr %239, i32 0, i32 2
  %241 = load i16, ptr %240, align 2, !tbaa !33
  %242 = call zeroext i16 @lwip_htons(i16 noundef zeroext %241)
  store i16 %242, ptr %22, align 2, !tbaa !34
  br label %243

243:                                              ; preds = %228
  br label %244

244:                                              ; preds = %243
  %245 = load i16, ptr %22, align 2, !tbaa !34
  %246 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 3
  store i16 %245, ptr %246, align 4, !tbaa !35
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #4
  br label %247

247:                                              ; preds = %244, %222
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %248

248:                                              ; preds = %324, %247
  %249 = load i32, ptr %19, align 4, !tbaa !5
  %250 = load ptr, ptr %6, align 8, !tbaa !9
  %251 = getelementptr inbounds %struct.msghdr, ptr %250, i32 0, i32 3
  %252 = load i32, ptr %251, align 8, !tbaa !14
  %253 = icmp slt i32 %249, %252
  br i1 %253, label %254, label %327

254:                                              ; preds = %248
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %255 = load ptr, ptr %6, align 8, !tbaa !9
  %256 = getelementptr inbounds %struct.msghdr, ptr %255, i32 0, i32 2
  %257 = load ptr, ptr %256, align 8, !tbaa !12
  %258 = load i32, ptr %19, align 4, !tbaa !5
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds %struct.iovec, ptr %257, i64 %259
  %261 = getelementptr inbounds %struct.iovec, ptr %260, i32 0, i32 1
  %262 = load i64, ptr %261, align 8, !tbaa !36
  %263 = icmp ugt i64 %262, 65535
  br i1 %263, label %264, label %265

264:                                              ; preds = %254
  store i32 51, ptr %12, align 4
  br label %321

265:                                              ; preds = %254
  %266 = call ptr @pbuf_alloc(i32 noundef 56, i16 noundef zeroext 0, i32 noundef 65)
  store ptr %266, ptr %23, align 8, !tbaa !9
  %267 = load ptr, ptr %23, align 8, !tbaa !9
  %268 = icmp eq ptr %267, null
  br i1 %268, label %269, label %270

269:                                              ; preds = %265
  store i8 -1, ptr %11, align 1, !tbaa !11
  store i32 48, ptr %12, align 4
  br label %321

270:                                              ; preds = %265
  %271 = load ptr, ptr %6, align 8, !tbaa !9
  %272 = getelementptr inbounds %struct.msghdr, ptr %271, i32 0, i32 2
  %273 = load ptr, ptr %272, align 8, !tbaa !12
  %274 = load i32, ptr %19, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds %struct.iovec, ptr %273, i64 %275
  %277 = getelementptr inbounds %struct.iovec, ptr %276, i32 0, i32 0
  %278 = load ptr, ptr %277, align 8, !tbaa !38
  %279 = load ptr, ptr %23, align 8, !tbaa !9
  %280 = getelementptr inbounds %struct.pbuf, ptr %279, i32 0, i32 1
  store ptr %278, ptr %280, align 8, !tbaa !39
  %281 = load ptr, ptr %6, align 8, !tbaa !9
  %282 = getelementptr inbounds %struct.msghdr, ptr %281, i32 0, i32 2
  %283 = load ptr, ptr %282, align 8, !tbaa !12
  %284 = load i32, ptr %19, align 4, !tbaa !5
  %285 = sext i32 %284 to i64
  %286 = getelementptr inbounds %struct.iovec, ptr %283, i64 %285
  %287 = getelementptr inbounds %struct.iovec, ptr %286, i32 0, i32 1
  %288 = load i64, ptr %287, align 8, !tbaa !36
  %289 = trunc i64 %288 to i16
  %290 = load ptr, ptr %23, align 8, !tbaa !9
  %291 = getelementptr inbounds %struct.pbuf, ptr %290, i32 0, i32 2
  store i16 %289, ptr %291, align 8, !tbaa !41
  %292 = load ptr, ptr %23, align 8, !tbaa !9
  %293 = getelementptr inbounds %struct.pbuf, ptr %292, i32 0, i32 3
  store i16 %289, ptr %293, align 2, !tbaa !42
  %294 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 0
  %295 = load ptr, ptr %294, align 8, !tbaa !43
  %296 = icmp eq ptr %295, null
  br i1 %296, label %297, label %301

297:                                              ; preds = %270
  %298 = load ptr, ptr %23, align 8, !tbaa !9
  %299 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 1
  store ptr %298, ptr %299, align 8, !tbaa !44
  %300 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 0
  store ptr %298, ptr %300, align 8, !tbaa !43
  br label %320

301:                                              ; preds = %270
  %302 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 0
  %303 = load ptr, ptr %302, align 8, !tbaa !43
  %304 = getelementptr inbounds %struct.pbuf, ptr %303, i32 0, i32 2
  %305 = load i16, ptr %304, align 8, !tbaa !41
  %306 = zext i16 %305 to i32
  %307 = load ptr, ptr %23, align 8, !tbaa !9
  %308 = getelementptr inbounds %struct.pbuf, ptr %307, i32 0, i32 3
  %309 = load i16, ptr %308, align 2, !tbaa !42
  %310 = zext i16 %309 to i32
  %311 = add nsw i32 %306, %310
  %312 = icmp sgt i32 %311, 65535
  br i1 %312, label %313, label %316

313:                                              ; preds = %301
  %314 = load ptr, ptr %23, align 8, !tbaa !9
  %315 = call zeroext i8 @pbuf_free(ptr noundef %314)
  store i32 51, ptr %12, align 4
  br label %321

316:                                              ; preds = %301
  %317 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 0
  %318 = load ptr, ptr %317, align 8, !tbaa !43
  %319 = load ptr, ptr %23, align 8, !tbaa !9
  call void @pbuf_cat(ptr noundef %318, ptr noundef %319)
  br label %320

320:                                              ; preds = %316, %297
  store i32 0, ptr %12, align 4
  br label %321

321:                                              ; preds = %320, %313, %269, %264
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  %322 = load i32, ptr %12, align 4
  switch i32 %322, label %375 [
    i32 0, label %323
    i32 48, label %327
    i32 51, label %368
  ]

323:                                              ; preds = %321
  br label %324

324:                                              ; preds = %323
  %325 = load i32, ptr %19, align 4, !tbaa !5
  %326 = add nsw i32 %325, 1
  store i32 %326, ptr %19, align 4, !tbaa !5
  br label %248, !llvm.loop !45

327:                                              ; preds = %321, %248
  %328 = load i8, ptr %11, align 1, !tbaa !11
  %329 = sext i8 %328 to i32
  %330 = icmp eq i32 %329, 0
  br i1 %330, label %331, label %337

331:                                              ; preds = %327
  %332 = getelementptr inbounds %struct.netbuf, ptr %18, i32 0, i32 0
  %333 = load ptr, ptr %332, align 8, !tbaa !43
  %334 = getelementptr inbounds %struct.pbuf, ptr %333, i32 0, i32 2
  %335 = load i16, ptr %334, align 8, !tbaa !41
  %336 = zext i16 %335 to i64
  store i64 %336, ptr %20, align 8, !tbaa !23
  br label %337

337:                                              ; preds = %331, %327
  %338 = load i8, ptr %11, align 1, !tbaa !11
  %339 = sext i8 %338 to i32
  %340 = icmp eq i32 %339, 0
  br i1 %340, label %341, label %346

341:                                              ; preds = %337
  %342 = load ptr, ptr %8, align 8, !tbaa !9
  %343 = getelementptr inbounds %struct.lwip_sock, ptr %342, i32 0, i32 0
  %344 = load ptr, ptr %343, align 8, !tbaa !18
  %345 = call signext i8 @netconn_send(ptr noundef %344, ptr noundef %18)
  store i8 %345, ptr %11, align 1, !tbaa !11
  br label %346

346:                                              ; preds = %341, %337
  call void @netbuf_free(ptr noundef %18)
  br label %347

347:                                              ; preds = %346
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %348 = load i8, ptr %11, align 1, !tbaa !11
  %349 = call i32 @err_to_errno(i8 noundef signext %348)
  store i32 %349, ptr %24, align 4, !tbaa !5
  br label %350

350:                                              ; preds = %347
  %351 = load i32, ptr %24, align 4, !tbaa !5
  %352 = icmp ne i32 %351, 0
  br i1 %352, label %353, label %355

353:                                              ; preds = %350
  %354 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %354, ptr @errno, align 4, !tbaa !5
  br label %355

355:                                              ; preds = %353, %350
  br label %356

356:                                              ; preds = %355
  br label %357

357:                                              ; preds = %356
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %358

358:                                              ; preds = %357
  br label %359

359:                                              ; preds = %358
  %360 = load i8, ptr %11, align 1, !tbaa !11
  %361 = sext i8 %360 to i32
  %362 = icmp eq i32 %361, 0
  br i1 %362, label %363, label %365

363:                                              ; preds = %359
  %364 = load i64, ptr %20, align 8, !tbaa !23
  br label %366

365:                                              ; preds = %359
  br label %366

366:                                              ; preds = %365, %363
  %367 = phi i64 [ %364, %363 ], [ -1, %365 ]
  store i64 %367, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %375

368:                                              ; preds = %321
  br label %369

369:                                              ; preds = %368
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  store i32 90, ptr %25, align 4, !tbaa !5
  br label %370

370:                                              ; preds = %369
  store i32 90, ptr @errno, align 4, !tbaa !5
  br label %371

371:                                              ; preds = %370
  br label %372

372:                                              ; preds = %371
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %373

373:                                              ; preds = %372
  br label %374

374:                                              ; preds = %373
  call void @netbuf_free(ptr noundef %18)
  store i64 -1, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %375

375:                                              ; preds = %374, %366, %321, %219
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #4
  br label %376

376:                                              ; preds = %375, %183, %118, %100, %76, %51, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %377 = load i64, ptr %4, align 8
  ret i64 %377
}

declare signext i8 @netconn_write_vectors_partly(ptr noundef, ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) #2

declare ptr @pbuf_alloc(i32 noundef, i16 noundef zeroext, i32 noundef) #2

declare zeroext i8 @pbuf_free(ptr noundef) #2

declare void @pbuf_cat(ptr noundef, ptr noundef) #2

declare signext i8 @netconn_send(ptr noundef, ptr noundef) #2

declare void @netbuf_free(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 16}
!13 = !{!"msghdr", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !6, i64 44}
!14 = !{!13, !6, i64 24}
!15 = !{!13, !10, i64 32}
!16 = !{!13, !6, i64 40}
!17 = !{!13, !6, i64 44}
!18 = !{!19, !10, i64 0}
!19 = !{!"lwip_sock", !10, i64 0, !7, i64 8, !20, i64 16, !20, i64 18, !20, i64 20, !7, i64 22}
!20 = !{!"short", !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"netconn", !6, i64 0, !6, i64 4, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !7, i64 60, !10, i64 64, !10, i64 72}
!23 = !{!24, !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!13, !10, i64 0}
!26 = !{!13, !6, i64 8}
!27 = !{!28, !6, i64 4}
!28 = !{!"sockaddr_in", !7, i64 0, !7, i64 1, !20, i64 2, !29, i64 4, !7, i64 8}
!29 = !{!"in_addr", !6, i64 0}
!30 = !{!31, !6, i64 16}
!31 = !{!"netbuf", !10, i64 0, !10, i64 8, !32, i64 16, !20, i64 20}
!32 = !{!"ip4_addr", !6, i64 0}
!33 = !{!28, !20, i64 2}
!34 = !{!20, !20, i64 0}
!35 = !{!31, !20, i64 20}
!36 = !{!37, !24, i64 8}
!37 = !{!"iovec", !10, i64 0, !24, i64 8}
!38 = !{!37, !10, i64 0}
!39 = !{!40, !10, i64 8}
!40 = !{!"pbuf", !10, i64 0, !10, i64 8, !20, i64 16, !20, i64 18, !7, i64 20, !7, i64 21, !7, i64 22, !7, i64 23}
!41 = !{!40, !20, i64 16}
!42 = !{!40, !20, i64 18}
!43 = !{!31, !10, i64 0}
!44 = !{!31, !10, i64 8}
!45 = distinct !{!45, !46}
!46 = !{!"llvm.loop.mustprogress"}


; 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.netbuf = type { ptr, ptr, %struct.ip4_addr, i16 }
%struct.ip4_addr = type { i32 }
%struct.iovec = type { ptr, i64 }

@errno = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [181 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [34 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: nounwind uwtable
declare hidden ptr @get_socket(i32 noundef) local_unnamed_addr #1

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

declare i32 @err_to_errno(i8 noundef signext) local_unnamed_addr #2

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

declare zeroext i16 @lwip_htons(i16 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local i64 @lwip_sendmsg(i32 noundef %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca i64, align 8
  %5 = alloca %struct.netbuf, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %6 = tail call ptr @get_socket(i32 noundef %0)
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %121, label %7

7:                                                ; preds = %3
  %.not77 = icmp eq ptr %1, null
  br i1 %.not77, label %8, label %12

8:                                                ; preds = %7
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.10, i32 noundef 1437, ptr noundef nonnull @.str.2)
  %10 = tail call i32 @err_to_errno(i8 noundef signext -16) #6
  %.not78 = icmp eq i32 %10, 0
  br i1 %.not78, label %121, label %11

11:                                               ; preds = %8
  store i32 %10, ptr @errno, align 4, !tbaa !5
  br label %121

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %.not79 = icmp eq ptr %14, null
  br i1 %.not79, label %15, label %19

15:                                               ; preds = %12
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.11, i32 noundef 1439, ptr noundef nonnull @.str.2)
  %17 = tail call i32 @err_to_errno(i8 noundef signext -16) #6
  %.not80 = icmp eq i32 %17, 0
  br i1 %.not80, label %121, label %18

18:                                               ; preds = %15
  store i32 %17, ptr @errno, align 4, !tbaa !5
  br label %121

19:                                               ; preds = %12
  %20 = getelementptr inbounds i8, ptr %1, i64 24
  %21 = load i32, ptr %20, align 8, !tbaa !12
  %22 = add i32 %21, -1
  %or.cond = icmp ult i32 %22, 65535
  br i1 %or.cond, label %25, label %23

23:                                               ; preds = %19
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.12, i32 noundef 1441, ptr noundef nonnull @.str.2)
  store i32 90, ptr @errno, align 4, !tbaa !5
  br label %121

25:                                               ; preds = %19
  %26 = and i32 %2, -25
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %30, label %28

28:                                               ; preds = %25
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.13, i32 noundef 1443, ptr noundef nonnull @.str.2)
  store i32 95, ptr @errno, align 4, !tbaa !5
  br label %121

30:                                               ; preds = %25
  %31 = load ptr, ptr %6, align 8, !tbaa !13
  %32 = load i32, ptr %31, align 8, !tbaa !16
  %33 = and i32 %32, 240
  %34 = icmp eq i32 %33, 16
  br i1 %34, label %35, label %49

35:                                               ; preds = %30
  %.not84 = icmp ult i32 %2, 16
  %36 = select i1 %.not84, i32 1, i32 3
  %37 = lshr exact i32 %2, 1
  %38 = and i32 %37, 4
  %39 = or disjoint i32 %36, %38
  %40 = trunc nuw nsw i32 %39 to i8
  store i64 0, ptr %4, align 8, !tbaa !18
  %41 = trunc nuw i32 %21 to i16
  %42 = call signext i8 @netconn_write_vectors_partly(ptr noundef nonnull %31, ptr noundef nonnull %14, i16 noundef zeroext %41, i8 noundef zeroext %40, ptr noundef nonnull %4) #6
  %43 = call i32 @err_to_errno(i8 noundef signext %42) #6
  %.not86 = icmp eq i32 %43, 0
  br i1 %.not86, label %45, label %44

44:                                               ; preds = %35
  store i32 %43, ptr @errno, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %44, %35
  %46 = icmp eq i8 %42, 0
  %47 = load i64, ptr %4, align 8
  %48 = select i1 %46, i64 %47, i64 -1
  br label %121

49:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  %50 = load ptr, ptr %1, align 8, !tbaa !20
  %51 = icmp eq ptr %50, null
  %52 = getelementptr inbounds i8, ptr %1, i64 8
  %53 = load i32, ptr %52, align 8, !tbaa !21
  br i1 %51, label %54, label %.thread87

54:                                               ; preds = %49
  switch i32 %53, label %56 [
    i32 0, label %.lr.ph.sink.split
    i32 16, label %.lr.ph.sink.split
  ]

.thread87:                                        ; preds = %49
  %55 = icmp eq i32 %53, 16
  br i1 %55, label %60, label %56

56:                                               ; preds = %54, %.thread87
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.14, i32 noundef 1477, ptr noundef nonnull @.str.2)
  %58 = tail call i32 @err_to_errno(i8 noundef signext -16) #6
  %.not81 = icmp eq i32 %58, 0
  br i1 %.not81, label %120, label %59

59:                                               ; preds = %56
  store i32 %58, ptr @errno, align 4, !tbaa !5
  br label %120

60:                                               ; preds = %.thread87
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  %61 = getelementptr inbounds i8, ptr %50, i64 4
  %62 = load i32, ptr %61, align 4, !tbaa !22
  %63 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 %62, ptr %63, align 8, !tbaa !25
  %64 = getelementptr inbounds i8, ptr %50, i64 2
  %65 = load i16, ptr %64, align 2, !tbaa !28
  %66 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %65) #6
  %67 = getelementptr inbounds i8, ptr %5, i64 20
  store i16 %66, ptr %67, align 4, !tbaa !29
  %.pre = load i32, ptr %20, align 8, !tbaa !12
  %68 = icmp sgt i32 %.pre, 0
  tail call void @llvm.assume(i1 %68)
  br label %.lr.ph

.lr.ph.sink.split:                                ; preds = %54, %54
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  br label %.lr.ph

.lr.ph:                                           ; preds = %60, %.lr.ph.sink.split
  %69 = getelementptr inbounds i8, ptr %5, i64 8
  br label %70

70:                                               ; preds = %.lr.ph, %102
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %102 ]
  %71 = phi ptr [ null, %.lr.ph ], [ %103, %102 ]
  %72 = phi ptr [ null, %.lr.ph ], [ %104, %102 ]
  %73 = load ptr, ptr %13, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.iovec, ptr %73, i64 %indvars.iv, i32 1
  %75 = load i64, ptr %74, align 8, !tbaa !30
  %76 = icmp ugt i64 %75, 65535
  br i1 %76, label %.loopexit, label %77

77:                                               ; preds = %70
  %78 = tail call ptr @pbuf_alloc(i32 noundef 56, i16 noundef zeroext 0, i32 noundef 65) #6
  %79 = icmp eq ptr %78, null
  br i1 %79, label %.loopexit106, label %80

80:                                               ; preds = %77
  %81 = load ptr, ptr %13, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.iovec, ptr %81, i64 %indvars.iv
  %83 = load ptr, ptr %82, align 8, !tbaa !32
  %84 = getelementptr inbounds i8, ptr %78, i64 8
  store ptr %83, ptr %84, align 8, !tbaa !33
  %85 = getelementptr inbounds %struct.iovec, ptr %81, i64 %indvars.iv, i32 1
  %86 = load i64, ptr %85, align 8, !tbaa !30
  %87 = trunc i64 %86 to i16
  %88 = getelementptr inbounds i8, ptr %78, i64 16
  store i16 %87, ptr %88, align 8, !tbaa !35
  %89 = getelementptr inbounds i8, ptr %78, i64 18
  store i16 %87, ptr %89, align 2, !tbaa !36
  %90 = icmp eq ptr %72, null
  br i1 %90, label %102, label %91

91:                                               ; preds = %80
  %92 = getelementptr inbounds i8, ptr %72, i64 16
  %93 = load i16, ptr %92, align 8, !tbaa !35
  %94 = zext i16 %93 to i32
  %95 = trunc i64 %86 to i32
  %96 = and i32 %95, 65535
  %97 = add nuw nsw i32 %96, %94
  %98 = icmp ugt i32 %97, 65535
  br i1 %98, label %99, label %101

99:                                               ; preds = %91
  store ptr %71, ptr %69, align 8, !tbaa !37
  store ptr %72, ptr %5, align 8, !tbaa !38
  %100 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %78) #6
  br label %119

101:                                              ; preds = %91
  tail call void @pbuf_cat(ptr noundef nonnull %72, ptr noundef nonnull %78) #6
  br label %102

102:                                              ; preds = %80, %101
  %103 = phi ptr [ %71, %101 ], [ %78, %80 ]
  %104 = phi ptr [ %72, %101 ], [ %78, %80 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %105 = load i32, ptr %20, align 8, !tbaa !12
  %106 = sext i32 %105 to i64
  %107 = icmp slt i64 %indvars.iv.next, %106
  br i1 %107, label %70, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %102
  store ptr %103, ptr %69, align 8, !tbaa !37
  store ptr %104, ptr %5, align 8, !tbaa !38
  %108 = getelementptr inbounds i8, ptr %104, i64 16
  %109 = load i16, ptr %108, align 8, !tbaa !35
  %110 = zext i16 %109 to i64
  %111 = load ptr, ptr %6, align 8, !tbaa !13
  %112 = call signext i8 @netconn_send(ptr noundef %111, ptr noundef nonnull %5) #6
  br label %113

.loopexit106:                                     ; preds = %77
  store ptr %71, ptr %69, align 8, !tbaa !37
  store ptr %72, ptr %5, align 8, !tbaa !38
  br label %113

113:                                              ; preds = %.loopexit106, %._crit_edge
  %.065104 = phi i64 [ %110, %._crit_edge ], [ 0, %.loopexit106 ]
  %.3 = phi i8 [ %112, %._crit_edge ], [ -1, %.loopexit106 ]
  call void @netbuf_free(ptr noundef nonnull %5) #6
  %114 = call i32 @err_to_errno(i8 noundef signext %.3) #6
  %.not83 = icmp eq i32 %114, 0
  br i1 %.not83, label %116, label %115

115:                                              ; preds = %113
  store i32 %114, ptr @errno, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %115, %113
  %117 = icmp eq i8 %.3, 0
  %118 = select i1 %117, i64 %.065104, i64 -1
  br label %120

.loopexit:                                        ; preds = %70
  store ptr %71, ptr %69, align 8, !tbaa !37
  store ptr %72, ptr %5, align 8, !tbaa !38
  br label %119

119:                                              ; preds = %.loopexit, %99
  store i32 90, ptr @errno, align 4, !tbaa !5
  call void @netbuf_free(ptr noundef nonnull %5) #6
  br label %120

120:                                              ; preds = %56, %59, %119, %116
  %.0 = phi i64 [ -1, %119 ], [ %118, %116 ], [ -1, %59 ], [ -1, %56 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %121

121:                                              ; preds = %15, %18, %8, %11, %3, %120, %45, %28, %23
  %.1 = phi i64 [ %48, %45 ], [ %.0, %120 ], [ -1, %28 ], [ -1, %23 ], [ -1, %3 ], [ -1, %11 ], [ -1, %8 ], [ -1, %18 ], [ -1, %15 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret i64 %.1
}

declare signext i8 @netconn_write_vectors_partly(ptr noundef, ptr noundef, i16 noundef zeroext, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

declare ptr @pbuf_alloc(i32 noundef, i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

declare zeroext i8 @pbuf_free(ptr noundef) local_unnamed_addr #2

declare void @pbuf_cat(ptr noundef, ptr noundef) local_unnamed_addr #2

declare signext i8 @netconn_send(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @netbuf_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 16}
!10 = !{!"msghdr", !11, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !6, i64 44}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 24}
!13 = !{!14, !11, i64 0}
!14 = !{!"lwip_sock", !11, i64 0, !7, i64 8, !15, i64 16, !15, i64 18, !15, i64 20, !7, i64 22}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"netconn", !6, i64 0, !6, i64 4, !7, i64 8, !7, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !6, i64 48, !6, i64 52, !6, i64 56, !7, i64 60, !11, i64 64, !11, i64 72}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!10, !11, i64 0}
!21 = !{!10, !6, i64 8}
!22 = !{!23, !6, i64 4}
!23 = !{!"sockaddr_in", !7, i64 0, !7, i64 1, !15, i64 2, !24, i64 4, !7, i64 8}
!24 = !{!"in_addr", !6, i64 0}
!25 = !{!26, !6, i64 16}
!26 = !{!"netbuf", !11, i64 0, !11, i64 8, !27, i64 16, !15, i64 20}
!27 = !{!"ip4_addr", !6, i64 0}
!28 = !{!23, !15, i64 2}
!29 = !{!26, !15, i64 20}
!30 = !{!31, !19, i64 8}
!31 = !{!"iovec", !11, i64 0, !19, i64 8}
!32 = !{!31, !11, i64 0}
!33 = !{!34, !11, i64 8}
!34 = !{!"pbuf", !11, i64 0, !11, i64 8, !15, i64 16, !15, i64 18, !7, i64 20, !7, i64 21, !7, i64 22, !7, i64 23}
!35 = !{!34, !15, i64 16}
!36 = !{!34, !15, i64 18}
!37 = !{!26, !11, i64 8}
!38 = !{!26, !11, i64 0}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


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