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

; 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_pcb = type { %struct.ip4_addr, %struct.ip4_addr, i8, i8, i8, i8, ptr, ptr, i32, i8, i16, i16, i16, i8, i8, i8, i32, i32, i16, i16, i32, i16, i16, i32, i32, i16, i16, i16, i8, i8, i32, i16, i16, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8 }
%struct.ip4_addr = type { i32 }
%struct.tcp_seg = type { ptr, ptr, i16, i8, ptr }
%struct.pbuf = type { ptr, ptr, i16, i16, i8, i8, i8, i8 }
%struct.tcp_hdr = type { i16, i16, i32, i32, i16, i16, i16, i16 }

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [182 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 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

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

declare zeroext i16 @pbuf_clen(ptr noundef) #1

declare ptr @pbuf_alloc(i32 noundef, i16 noundef zeroext, 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 zeroext i8 @pbuf_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @tcp_create_segment(ptr noundef, ptr noundef, i8 noundef zeroext, i32 noundef, i8 noundef zeroext) #2

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

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

16:                                               ; preds = %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %24, label %19

19:                                               ; preds = %16
  br label %20

20:                                               ; preds = %19
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.15, i32 noundef 843, ptr noundef @.str.2)
  br label %22

22:                                               ; preds = %20
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23, %16
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.tcp_pcb, ptr %27, i32 0, i32 44
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  store ptr %29, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %26
  store i8 -1, ptr %3, align 1
  store i32 1, ptr %15, align 4
  br label %328

33:                                               ; preds = %26
  %34 = load i16, ptr %5, align 2, !tbaa !9
  %35 = zext i16 %34 to i32
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %45

37:                                               ; preds = %33
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.16, i32 noundef 851, ptr noundef @.str.2)
  br label %41

41:                                               ; preds = %39
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  store i8 -6, ptr %3, align 1
  store i32 1, ptr %15, align 4
  br label %328

45:                                               ; preds = %33
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tcp_seg, ptr %46, i32 0, i32 2
  %48 = load i16, ptr %47, align 8, !tbaa !15
  %49 = zext i16 %48 to i32
  %50 = load i16, ptr %5, align 2, !tbaa !9
  %51 = zext i16 %50 to i32
  %52 = icmp sle i32 %49, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %45
  store i8 0, ptr %3, align 1
  store i32 1, ptr %15, align 4
  br label %328

54:                                               ; preds = %45
  br label %55

55:                                               ; preds = %54
  %56 = load i16, ptr %5, align 2, !tbaa !9
  %57 = zext i16 %56 to i32
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tcp_pcb, ptr %58, i32 0, i32 22
  %60 = load i16, ptr %59, align 2, !tbaa !17
  %61 = zext i16 %60 to i32
  %62 = icmp sle i32 %57, %61
  br i1 %62, label %68, label %63

63:                                               ; preds = %55
  br label %64

64:                                               ; preds = %63
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.17, i32 noundef 859, ptr noundef @.str.2)
  br label %66

66:                                               ; preds = %64
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67, %55
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.tcp_seg, ptr %72, i32 0, i32 2
  %74 = load i16, ptr %73, align 8, !tbaa !15
  %75 = zext i16 %74 to i32
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %82, label %77

77:                                               ; preds = %71
  br label %78

78:                                               ; preds = %77
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.18, i32 noundef 860, ptr noundef @.str.2)
  br label %80

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81, %71
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.tcp_seg, ptr %85, i32 0, i32 3
  %87 = load i8, ptr %86, align 2, !tbaa !18
  store i8 %87, ptr %10, align 1, !tbaa !19
  %88 = load i8, ptr %10, align 1, !tbaa !19
  %89 = zext i8 %88 to i32
  %90 = and i32 %89, 1
  %91 = icmp ne i32 %90, 0
  %92 = zext i1 %91 to i64
  %93 = select i1 %91, i32 4, i32 0
  %94 = load i8, ptr %10, align 1, !tbaa !19
  %95 = zext i8 %94 to i32
  %96 = and i32 %95, 2
  %97 = icmp ne i32 %96, 0
  %98 = zext i1 %97 to i64
  %99 = select i1 %97, i32 0, i32 0
  %100 = add nsw i32 %93, %99
  %101 = load i8, ptr %10, align 1, !tbaa !19
  %102 = zext i8 %101 to i32
  %103 = and i32 %102, 8
  %104 = icmp ne i32 %103, 0
  %105 = zext i1 %104 to i64
  %106 = select i1 %104, i32 0, i32 0
  %107 = add nsw i32 %100, %106
  %108 = load i8, ptr %10, align 1, !tbaa !19
  %109 = zext i8 %108 to i32
  %110 = and i32 %109, 16
  %111 = icmp ne i32 %110, 0
  %112 = zext i1 %111 to i64
  %113 = select i1 %111, i32 0, i32 0
  %114 = add nsw i32 %107, %113
  %115 = trunc i32 %114 to i8
  store i8 %115, ptr %9, align 1, !tbaa !19
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.tcp_seg, ptr %116, i32 0, i32 2
  %118 = load i16, ptr %117, align 8, !tbaa !15
  %119 = zext i16 %118 to i32
  %120 = load i16, ptr %5, align 2, !tbaa !9
  %121 = zext i16 %120 to i32
  %122 = sub nsw i32 %119, %121
  %123 = trunc i32 %122 to i16
  store i16 %123, ptr %13, align 2, !tbaa !9
  %124 = load i16, ptr %13, align 2, !tbaa !9
  %125 = zext i16 %124 to i32
  %126 = load i8, ptr %9, align 1, !tbaa !19
  %127 = zext i8 %126 to i32
  %128 = add nsw i32 %125, %127
  %129 = trunc i32 %128 to i16
  %130 = call ptr @pbuf_alloc(i32 noundef 56, i16 noundef zeroext %129, i32 noundef 640)
  store ptr %130, ptr %8, align 8, !tbaa !5
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %134

133:                                              ; preds = %84
  br label %310

134:                                              ; preds = %84
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.tcp_seg, ptr %135, i32 0, i32 1
  %137 = load ptr, ptr %136, align 8, !tbaa !20
  %138 = getelementptr inbounds %struct.pbuf, ptr %137, i32 0, i32 2
  %139 = load i16, ptr %138, align 8, !tbaa !21
  %140 = zext i16 %139 to i32
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.tcp_seg, ptr %141, i32 0, i32 2
  %143 = load i16, ptr %142, align 8, !tbaa !15
  %144 = zext i16 %143 to i32
  %145 = sub nsw i32 %140, %144
  %146 = load i16, ptr %5, align 2, !tbaa !9
  %147 = zext i16 %146 to i32
  %148 = add nsw i32 %145, %147
  %149 = trunc i32 %148 to i16
  store i16 %149, ptr %14, align 2, !tbaa !9
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.tcp_seg, ptr %150, i32 0, i32 1
  %152 = load ptr, ptr %151, align 8, !tbaa !20
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.pbuf, ptr %153, i32 0, i32 1
  %155 = load ptr, ptr %154, align 8, !tbaa !23
  %156 = load i8, ptr %9, align 1, !tbaa !19
  %157 = zext i8 %156 to i32
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i8, ptr %155, i64 %158
  %160 = load i16, ptr %13, align 2, !tbaa !9
  %161 = load i16, ptr %14, align 2, !tbaa !9
  %162 = call zeroext i16 @pbuf_copy_partial(ptr noundef %152, ptr noundef %159, i16 noundef zeroext %160, i16 noundef zeroext %161)
  %163 = zext i16 %162 to i32
  %164 = load i16, ptr %13, align 2, !tbaa !9
  %165 = zext i16 %164 to i32
  %166 = icmp ne i32 %163, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %134
  br label %310

168:                                              ; preds = %134
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.tcp_seg, ptr %169, i32 0, i32 4
  %171 = load ptr, ptr %170, align 8, !tbaa !24
  %172 = getelementptr inbounds %struct.tcp_hdr, ptr %171, i32 0, i32 4
  %173 = load i16, ptr %172, align 1, !tbaa !25
  %174 = call zeroext i16 @lwip_htons(i16 noundef zeroext %173)
  %175 = zext i16 %174 to i32
  %176 = and i32 %175, 63
  %177 = trunc i32 %176 to i8
  store i8 %177, ptr %11, align 1, !tbaa !19
  store i8 0, ptr %12, align 1, !tbaa !19
  %178 = load i8, ptr %11, align 1, !tbaa !19
  %179 = zext i8 %178 to i32
  %180 = and i32 %179, 8
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %182, label %191

182:                                              ; preds = %168
  %183 = load i8, ptr %11, align 1, !tbaa !19
  %184 = zext i8 %183 to i32
  %185 = and i32 %184, -9
  %186 = trunc i32 %185 to i8
  store i8 %186, ptr %11, align 1, !tbaa !19
  %187 = load i8, ptr %12, align 1, !tbaa !19
  %188 = zext i8 %187 to i32
  %189 = or i32 %188, 8
  %190 = trunc i32 %189 to i8
  store i8 %190, ptr %12, align 1, !tbaa !19
  br label %191

191:                                              ; preds = %182, %168
  %192 = load i8, ptr %11, align 1, !tbaa !19
  %193 = zext i8 %192 to i32
  %194 = and i32 %193, 1
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %196, label %205

196:                                              ; preds = %191
  %197 = load i8, ptr %11, align 1, !tbaa !19
  %198 = zext i8 %197 to i32
  %199 = and i32 %198, -2
  %200 = trunc i32 %199 to i8
  store i8 %200, ptr %11, align 1, !tbaa !19
  %201 = load i8, ptr %12, align 1, !tbaa !19
  %202 = zext i8 %201 to i32
  %203 = or i32 %202, 1
  %204 = trunc i32 %203 to i8
  store i8 %204, ptr %12, align 1, !tbaa !19
  br label %205

205:                                              ; preds = %196, %191
  %206 = load ptr, ptr %4, align 8, !tbaa !5
  %207 = load ptr, ptr %8, align 8, !tbaa !5
  %208 = load i8, ptr %12, align 1, !tbaa !19
  %209 = load ptr, ptr %7, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.tcp_seg, ptr %209, i32 0, i32 4
  %211 = load ptr, ptr %210, align 8, !tbaa !24
  %212 = getelementptr inbounds %struct.tcp_hdr, ptr %211, i32 0, i32 2
  %213 = load i32, ptr %212, align 1, !tbaa !27
  %214 = call i32 @lwip_htonl(i32 noundef %213)
  %215 = load i16, ptr %5, align 2, !tbaa !9
  %216 = zext i16 %215 to i32
  %217 = add i32 %214, %216
  %218 = load i8, ptr %10, align 1, !tbaa !19
  %219 = call ptr @tcp_create_segment(ptr noundef %206, ptr noundef %207, i8 noundef zeroext %208, i32 noundef %217, i8 noundef zeroext %218)
  store ptr %219, ptr %6, align 8, !tbaa !5
  %220 = load ptr, ptr %6, align 8, !tbaa !5
  %221 = icmp eq ptr %220, null
  br i1 %221, label %222, label %223

222:                                              ; preds = %205
  br label %310

223:                                              ; preds = %205
  %224 = load ptr, ptr %7, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.tcp_seg, ptr %224, i32 0, i32 1
  %226 = load ptr, ptr %225, align 8, !tbaa !20
  %227 = call zeroext i16 @pbuf_clen(ptr noundef %226)
  %228 = zext i16 %227 to i32
  %229 = load ptr, ptr %4, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.tcp_pcb, ptr %229, i32 0, i32 41
  %231 = load i16, ptr %230, align 2, !tbaa !28
  %232 = zext i16 %231 to i32
  %233 = sub nsw i32 %232, %228
  %234 = trunc i32 %233 to i16
  store i16 %234, ptr %230, align 2, !tbaa !28
  %235 = load ptr, ptr %7, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.tcp_seg, ptr %235, i32 0, i32 1
  %237 = load ptr, ptr %236, align 8, !tbaa !20
  %238 = load ptr, ptr %7, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.tcp_seg, ptr %238, i32 0, i32 1
  %240 = load ptr, ptr %239, align 8, !tbaa !20
  %241 = getelementptr inbounds %struct.pbuf, ptr %240, i32 0, i32 2
  %242 = load i16, ptr %241, align 8, !tbaa !21
  %243 = zext i16 %242 to i32
  %244 = load i16, ptr %13, align 2, !tbaa !9
  %245 = zext i16 %244 to i32
  %246 = sub nsw i32 %243, %245
  %247 = trunc i32 %246 to i16
  call void @pbuf_realloc(ptr noundef %237, i16 noundef zeroext %247)
  %248 = load i16, ptr %13, align 2, !tbaa !9
  %249 = zext i16 %248 to i32
  %250 = load ptr, ptr %7, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.tcp_seg, ptr %250, i32 0, i32 2
  %252 = load i16, ptr %251, align 8, !tbaa !15
  %253 = zext i16 %252 to i32
  %254 = sub nsw i32 %253, %249
  %255 = trunc i32 %254 to i16
  store i16 %255, ptr %251, align 8, !tbaa !15
  %256 = load ptr, ptr %7, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.tcp_seg, ptr %256, i32 0, i32 4
  %258 = load ptr, ptr %257, align 8, !tbaa !24
  %259 = getelementptr inbounds %struct.tcp_hdr, ptr %258, i32 0, i32 4
  %260 = load i16, ptr %259, align 1, !tbaa !25
  %261 = zext i16 %260 to i32
  %262 = load i8, ptr %11, align 1, !tbaa !19
  %263 = zext i8 %262 to i16
  %264 = call zeroext i16 @lwip_htons(i16 noundef zeroext %263)
  %265 = zext i16 %264 to i32
  %266 = or i32 %261, %265
  %267 = trunc i32 %266 to i16
  %268 = load ptr, ptr %7, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.tcp_seg, ptr %268, i32 0, i32 4
  %270 = load ptr, ptr %269, align 8, !tbaa !24
  %271 = getelementptr inbounds %struct.tcp_hdr, ptr %270, i32 0, i32 4
  store i16 %267, ptr %271, align 1, !tbaa !25
  %272 = load ptr, ptr %7, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.tcp_seg, ptr %272, i32 0, i32 1
  %274 = load ptr, ptr %273, align 8, !tbaa !20
  %275 = call zeroext i16 @pbuf_clen(ptr noundef %274)
  %276 = zext i16 %275 to i32
  %277 = load ptr, ptr %4, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.tcp_pcb, ptr %277, i32 0, i32 41
  %279 = load i16, ptr %278, align 2, !tbaa !28
  %280 = zext i16 %279 to i32
  %281 = add nsw i32 %280, %276
  %282 = trunc i32 %281 to i16
  store i16 %282, ptr %278, align 2, !tbaa !28
  %283 = load ptr, ptr %6, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.tcp_seg, ptr %283, i32 0, i32 1
  %285 = load ptr, ptr %284, align 8, !tbaa !20
  %286 = call zeroext i16 @pbuf_clen(ptr noundef %285)
  %287 = zext i16 %286 to i32
  %288 = load ptr, ptr %4, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.tcp_pcb, ptr %288, i32 0, i32 41
  %290 = load i16, ptr %289, align 2, !tbaa !28
  %291 = zext i16 %290 to i32
  %292 = add nsw i32 %291, %287
  %293 = trunc i32 %292 to i16
  store i16 %293, ptr %289, align 2, !tbaa !28
  %294 = load ptr, ptr %7, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.tcp_seg, ptr %294, i32 0, i32 0
  %296 = load ptr, ptr %295, align 8, !tbaa !29
  %297 = load ptr, ptr %6, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.tcp_seg, ptr %297, i32 0, i32 0
  store ptr %296, ptr %298, align 8, !tbaa !29
  %299 = load ptr, ptr %6, align 8, !tbaa !5
  %300 = load ptr, ptr %7, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.tcp_seg, ptr %300, i32 0, i32 0
  store ptr %299, ptr %301, align 8, !tbaa !29
  %302 = load ptr, ptr %6, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.tcp_seg, ptr %302, i32 0, i32 0
  %304 = load ptr, ptr %303, align 8, !tbaa !29
  %305 = icmp eq ptr %304, null
  br i1 %305, label %306, label %309

306:                                              ; preds = %223
  %307 = load ptr, ptr %4, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.tcp_pcb, ptr %307, i32 0, i32 42
  store i16 0, ptr %308, align 8, !tbaa !30
  br label %309

309:                                              ; preds = %306, %223
  store i8 0, ptr %3, align 1
  store i32 1, ptr %15, align 4
  br label %328

310:                                              ; preds = %222, %167, %133
  br label %311

311:                                              ; preds = %310
  %312 = load ptr, ptr %6, align 8, !tbaa !5
  %313 = icmp eq ptr %312, null
  br i1 %313, label %319, label %314

314:                                              ; preds = %311
  br label %315

315:                                              ; preds = %314
  %316 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.19, i32 noundef 984, ptr noundef @.str.2)
  br label %317

317:                                              ; preds = %315
  br label %318

318:                                              ; preds = %317
  br label %319

319:                                              ; preds = %318, %311
  br label %320

320:                                              ; preds = %319
  br label %321

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

324:                                              ; preds = %321
  %325 = load ptr, ptr %8, align 8, !tbaa !5
  %326 = call zeroext i8 @pbuf_free(ptr noundef %325)
  br label %327

327:                                              ; preds = %324, %321
  store i8 -1, ptr %3, align 1
  store i32 1, ptr %15, align 4
  br label %328

328:                                              ; preds = %327, %309, %53, %44, %32
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %329 = load i8, ptr %3, align 1
  ret i8 %329
}

declare zeroext i16 @pbuf_copy_partial(ptr noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext) #1

declare i32 @lwip_htonl(i32 noundef) #1

declare void @pbuf_realloc(ptr noundef, i16 noundef zeroext) #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 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 128}
!12 = !{!"tcp_pcb", !13, i64 0, !13, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 16, !6, i64 24, !14, i64 32, !7, i64 36, !10, i64 38, !10, i64 40, !10, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !14, i64 48, !14, i64 52, !10, i64 56, !10, i64 58, !14, i64 60, !10, i64 64, !10, i64 66, !14, i64 68, !14, i64 72, !10, i64 76, !10, i64 78, !10, i64 80, !7, i64 82, !7, i64 83, !14, i64 84, !10, i64 88, !10, i64 90, !14, i64 92, !14, i64 96, !14, i64 100, !14, i64 104, !14, i64 108, !10, i64 112, !10, i64 114, !10, i64 116, !10, i64 118, !10, i64 120, !10, i64 122, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !14, i64 200, !7, i64 204, !7, i64 205, !7, i64 206, !7, i64 207}
!13 = !{!"ip4_addr", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !10, i64 16}
!16 = !{!"tcp_seg", !6, i64 0, !6, i64 8, !10, i64 16, !7, i64 18, !6, i64 24}
!17 = !{!12, !10, i64 66}
!18 = !{!16, !7, i64 18}
!19 = !{!7, !7, i64 0}
!20 = !{!16, !6, i64 8}
!21 = !{!22, !10, i64 16}
!22 = !{!"pbuf", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 18, !7, i64 20, !7, i64 21, !7, i64 22, !7, i64 23}
!23 = !{!22, !6, i64 8}
!24 = !{!16, !6, i64 24}
!25 = !{!26, !10, i64 12}
!26 = !{!"tcp_hdr", !10, i64 0, !10, i64 2, !14, i64 4, !14, i64 8, !10, i64 12, !10, i64 14, !10, i64 16, !10, i64 18}
!27 = !{!26, !14, i64 4}
!28 = !{!12, !10, i64 118}
!29 = !{!16, !6, i64 0}
!30 = !{!12, !10, i64 120}


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

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [182 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1

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

declare zeroext i16 @pbuf_clen(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @tcp_create_segment(ptr noundef, ptr noundef, i8 noundef zeroext, i32 noundef, i8 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local signext range(i8 -6, 1) i8 @tcp_split_unsent_seg(ptr noundef %0, i16 noundef zeroext %1) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %3, label %5

3:                                                ; preds = %2
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.15, i32 noundef 843, ptr noundef nonnull @.str.2)
  br label %5

5:                                                ; preds = %3, %2
  %6 = getelementptr inbounds i8, ptr %0, i64 128
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %99, label %9

9:                                                ; preds = %5
  %10 = zext i16 %1 to i32
  %11 = icmp eq i16 %1, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.16, i32 noundef 851, ptr noundef nonnull @.str.2)
  br label %99

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %7, i64 16
  %16 = load i16, ptr %15, align 8, !tbaa !13
  %.not76 = icmp ugt i16 %16, %1
  br i1 %.not76, label %17, label %99

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %0, i64 66
  %19 = load i16, ptr %18, align 2, !tbaa !15
  %.not77 = icmp ult i16 %19, %1
  br i1 %.not77, label %20, label %.thread

20:                                               ; preds = %17
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.17, i32 noundef 859, ptr noundef nonnull @.str.2)
  %.pre = load i16, ptr %15, align 8, !tbaa !13
  %.not78 = icmp eq i16 %.pre, 0
  br i1 %.not78, label %22, label %.thread

22:                                               ; preds = %20
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.18, i32 noundef 860, ptr noundef nonnull @.str.2)
  %.pre85 = load i16, ptr %15, align 8, !tbaa !13
  br label %.thread

.thread:                                          ; preds = %17, %22, %20
  %24 = phi i16 [ %.pre85, %22 ], [ %.pre, %20 ], [ %16, %17 ]
  %25 = getelementptr inbounds i8, ptr %7, i64 18
  %26 = load i8, ptr %25, align 2, !tbaa !16
  %27 = shl i8 %26, 2
  %28 = and i8 %27, 4
  %29 = sub i16 %24, %1
  %30 = zext nneg i8 %28 to i16
  %31 = add i16 %29, %30
  %32 = tail call ptr @pbuf_alloc(i32 noundef 56, i16 noundef zeroext %31, i32 noundef 640) #3
  %cond = icmp eq ptr %32, null
  br i1 %cond, label %99, label %33

33:                                               ; preds = %.thread
  %34 = getelementptr inbounds i8, ptr %7, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load i16, ptr %36, align 8, !tbaa !18
  %38 = load i16, ptr %15, align 8, !tbaa !13
  %39 = add i16 %37, %1
  %40 = sub i16 %39, %38
  %41 = getelementptr inbounds i8, ptr %32, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !20
  %43 = zext nneg i8 %28 to i64
  %44 = getelementptr inbounds i8, ptr %42, i64 %43
  %45 = tail call zeroext i16 @pbuf_copy_partial(ptr noundef %35, ptr noundef %44, i16 noundef zeroext %29, i16 noundef zeroext %40) #3
  %.not80 = icmp eq i16 %45, %29
  br i1 %.not80, label %46, label %97

46:                                               ; preds = %33
  %47 = getelementptr inbounds i8, ptr %7, i64 24
  %48 = load ptr, ptr %47, align 8, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %48, i64 12
  %50 = load i16, ptr %49, align 1, !tbaa !22
  %51 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %50) #3
  %52 = trunc i16 %51 to i8
  %53 = and i16 %51, 8
  %spec.select84 = trunc nuw nsw i16 %53 to i8
  %54 = and i8 %52, 1
  %.1 = or disjoint i8 %54, %spec.select84
  %55 = load ptr, ptr %47, align 8, !tbaa !21
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  %57 = load i32, ptr %56, align 1, !tbaa !24
  %58 = tail call i32 @lwip_htonl(i32 noundef %57) #3
  %59 = add i32 %58, %10
  %60 = tail call ptr @tcp_create_segment(ptr noundef nonnull %0, ptr noundef nonnull %32, i8 noundef zeroext %.1, i32 noundef %59, i8 noundef zeroext %26)
  %61 = icmp eq ptr %60, null
  br i1 %61, label %97, label %62

62:                                               ; preds = %46
  %.not82 = icmp eq i8 %54, 0
  %.not81 = icmp eq i16 %53, 0
  %spec.select.v = select i1 %.not81, i8 63, i8 55
  %spec.select = and i8 %spec.select.v, %52
  %63 = and i8 %spec.select, 62
  %.168 = select i1 %.not82, i8 %spec.select, i8 %63
  %64 = load ptr, ptr %34, align 8, !tbaa !17
  %65 = tail call zeroext i16 @pbuf_clen(ptr noundef %64) #3
  %66 = getelementptr inbounds i8, ptr %0, i64 118
  %67 = load i16, ptr %66, align 2, !tbaa !25
  %68 = sub i16 %67, %65
  store i16 %68, ptr %66, align 2, !tbaa !25
  %69 = load ptr, ptr %34, align 8, !tbaa !17
  %70 = getelementptr inbounds i8, ptr %69, i64 16
  %71 = load i16, ptr %70, align 8, !tbaa !18
  %72 = sub i16 %71, %29
  tail call void @pbuf_realloc(ptr noundef %69, i16 noundef zeroext %72) #3
  %73 = load i16, ptr %15, align 8, !tbaa !13
  %74 = sub i16 %73, %29
  store i16 %74, ptr %15, align 8, !tbaa !13
  %75 = load ptr, ptr %47, align 8, !tbaa !21
  %76 = getelementptr inbounds i8, ptr %75, i64 12
  %77 = load i16, ptr %76, align 1, !tbaa !22
  %78 = zext nneg i8 %.168 to i16
  %79 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %78) #3
  %80 = or i16 %79, %77
  %81 = load ptr, ptr %47, align 8, !tbaa !21
  %82 = getelementptr inbounds i8, ptr %81, i64 12
  store i16 %80, ptr %82, align 1, !tbaa !22
  %83 = load ptr, ptr %34, align 8, !tbaa !17
  %84 = tail call zeroext i16 @pbuf_clen(ptr noundef %83) #3
  %85 = load i16, ptr %66, align 2, !tbaa !25
  %86 = add i16 %85, %84
  store i16 %86, ptr %66, align 2, !tbaa !25
  %87 = getelementptr inbounds i8, ptr %60, i64 8
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = tail call zeroext i16 @pbuf_clen(ptr noundef %88) #3
  %90 = load i16, ptr %66, align 2, !tbaa !25
  %91 = add i16 %90, %89
  store i16 %91, ptr %66, align 2, !tbaa !25
  %92 = load ptr, ptr %7, align 8, !tbaa !26
  store ptr %92, ptr %60, align 8, !tbaa !26
  store ptr %60, ptr %7, align 8, !tbaa !26
  %93 = load ptr, ptr %60, align 8, !tbaa !26
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %99

95:                                               ; preds = %62
  %96 = getelementptr inbounds i8, ptr %0, i64 120
  store i16 0, ptr %96, align 8, !tbaa !27
  br label %99

97:                                               ; preds = %33, %46
  %98 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %32) #3
  br label %99

99:                                               ; preds = %.thread, %97, %62, %95, %14, %5, %12
  %.0 = phi i8 [ -6, %12 ], [ -1, %5 ], [ 0, %14 ], [ 0, %95 ], [ 0, %62 ], [ -1, %.thread ], [ -1, %97 ]
  ret i8 %.0
}

declare zeroext i16 @pbuf_copy_partial(ptr noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #1

declare i32 @lwip_htonl(i32 noundef) local_unnamed_addr #1

declare void @pbuf_realloc(ptr noundef, i16 noundef zeroext) local_unnamed_addr #1

attributes #0 = { 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 #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, !11, i64 128}
!6 = !{!"tcp_pcb", !7, i64 0, !7, i64 4, !9, i64 8, !9, i64 9, !9, i64 10, !9, i64 11, !11, i64 16, !11, i64 24, !8, i64 32, !9, i64 36, !12, i64 38, !12, i64 40, !12, i64 42, !9, i64 44, !9, i64 45, !9, i64 46, !8, i64 48, !8, i64 52, !12, i64 56, !12, i64 58, !8, i64 60, !12, i64 64, !12, i64 66, !8, i64 68, !8, i64 72, !12, i64 76, !12, i64 78, !12, i64 80, !9, i64 82, !9, i64 83, !8, i64 84, !12, i64 88, !12, i64 90, !8, i64 92, !8, i64 96, !8, i64 100, !8, i64 104, !8, i64 108, !12, i64 112, !12, i64 114, !12, i64 116, !12, i64 118, !12, i64 120, !12, i64 122, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !8, i64 200, !9, i64 204, !9, i64 205, !9, i64 206, !9, i64 207}
!7 = !{!"ip4_addr", !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"short", !9, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"tcp_seg", !11, i64 0, !11, i64 8, !12, i64 16, !9, i64 18, !11, i64 24}
!15 = !{!6, !12, i64 66}
!16 = !{!14, !9, i64 18}
!17 = !{!14, !11, i64 8}
!18 = !{!19, !12, i64 16}
!19 = !{!"pbuf", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 18, !9, i64 20, !9, i64 21, !9, i64 22, !9, i64 23}
!20 = !{!19, !11, i64 8}
!21 = !{!14, !11, i64 24}
!22 = !{!23, !12, i64 12}
!23 = !{!"tcp_hdr", !12, i64 0, !12, i64 2, !8, i64 4, !8, i64 8, !12, i64 12, !12, i64 14, !12, i64 16, !12, i64 18}
!24 = !{!23, !8, i64 4}
!25 = !{!6, !12, i64 118}
!26 = !{!14, !11, i64 0}
!27 = !{!6, !12, i64 120}


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