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

; 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.netif = type { ptr, %struct.ip4_addr, %struct.ip4_addr, %struct.ip4_addr, ptr, ptr, ptr, ptr, ptr, [1 x ptr], i16, [6 x i8], i8, i8, [2 x i8], i8, i8 }
%struct.ip4_addr = type { i32 }
%struct.pbuf = type { ptr, ptr, i16, i16, i8, i8, i8, i8 }
%struct.ip_hdr = type { i8, i8, i16, i16, i16, i8, i8, i16, %struct.ip4_addr_packed, %struct.ip4_addr_packed }
%struct.ip4_addr_packed = type { i32 }
%struct.pbuf_custom_ref = type { %struct.pbuf_custom, ptr }
%struct.pbuf_custom = type { %struct.pbuf, ptr }

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [188 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 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 i16 @lwip_htons(i16 noundef zeroext) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

declare zeroext i8 @pbuf_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local signext i8 @ip4_frag(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i16, align 2
  %15 = alloca i16, align 2
  %16 = alloca i16, align 2
  %17 = alloca i16, align 2
  %18 = alloca i32, align 4
  %19 = alloca i16, align 2
  %20 = alloca i16, align 2
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i16, align 2
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  store i16 0, ptr %10, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #4
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.netif, ptr %25, i32 0, i32 10
  %27 = load i16, ptr %26, align 8, !tbaa !11
  %28 = zext i16 %27 to i32
  %29 = sub nsw i32 %28, 20
  %30 = sdiv i32 %29, 8
  %31 = trunc i32 %30 to i16
  store i16 %31, ptr %14, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #4
  store i16 20, ptr %19, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.pbuf, ptr %32, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  store ptr %34, ptr %12, align 8, !tbaa !5
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ip_hdr, ptr %36, i32 0, i32 0
  %38 = load i8, ptr %37, align 1, !tbaa !17
  %39 = zext i8 %38 to i32
  %40 = and i32 %39, 15
  %41 = mul nsw i32 %40, 4
  %42 = trunc i32 %41 to i8
  %43 = zext i8 %42 to i32
  %44 = icmp ne i32 %43, 20
  br i1 %44, label %45, label %46

45:                                               ; preds = %3
  store i8 -6, ptr %4, align 1
  store i32 1, ptr %22, align 4
  br label %296

46:                                               ; preds = %3
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.pbuf, ptr %48, i32 0, i32 3
  %50 = load i16, ptr %49, align 2, !tbaa !20
  %51 = zext i16 %50 to i32
  %52 = icmp sge i32 %51, 20
  br i1 %52, label %58, label %53

53:                                               ; preds = %47
  br label %54

54:                                               ; preds = %53
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.5, i32 noundef 764, ptr noundef @.str.2)
  br label %56

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56
  store i8 -6, ptr %4, align 1
  store i32 1, ptr %22, align 4
  br label %296

58:                                               ; preds = %47
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ip_hdr, ptr %61, i32 0, i32 4
  %63 = load i16, ptr %62, align 1, !tbaa !21
  %64 = call zeroext i16 @lwip_htons(i16 noundef zeroext %63)
  store i16 %64, ptr %20, align 2, !tbaa !9
  %65 = load i16, ptr %20, align 2, !tbaa !9
  %66 = zext i16 %65 to i32
  %67 = and i32 %66, 8191
  %68 = trunc i32 %67 to i16
  store i16 %68, ptr %17, align 2, !tbaa !9
  %69 = load i16, ptr %20, align 2, !tbaa !9
  %70 = zext i16 %69 to i32
  %71 = and i32 %70, 8192
  store i32 %71, ptr %21, align 4, !tbaa !22
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.pbuf, ptr %72, i32 0, i32 2
  %74 = load i16, ptr %73, align 8, !tbaa !23
  %75 = zext i16 %74 to i32
  %76 = sub nsw i32 %75, 20
  %77 = trunc i32 %76 to i16
  store i16 %77, ptr %15, align 2, !tbaa !9
  br label %78

78:                                               ; preds = %259, %60
  %79 = load i16, ptr %15, align 2, !tbaa !9
  %80 = icmp ne i16 %79, 0
  br i1 %80, label %81, label %294

81:                                               ; preds = %78
  %82 = load i16, ptr %15, align 2, !tbaa !9
  %83 = zext i16 %82 to i32
  %84 = load i16, ptr %14, align 2, !tbaa !9
  %85 = zext i16 %84 to i32
  %86 = mul nsw i32 %85, 8
  %87 = trunc i32 %86 to i16
  %88 = zext i16 %87 to i32
  %89 = icmp slt i32 %83, %88
  br i1 %89, label %90, label %93

90:                                               ; preds = %81
  %91 = load i16, ptr %15, align 2, !tbaa !9
  %92 = zext i16 %91 to i32
  br label %99

93:                                               ; preds = %81
  %94 = load i16, ptr %14, align 2, !tbaa !9
  %95 = zext i16 %94 to i32
  %96 = mul nsw i32 %95, 8
  %97 = trunc i32 %96 to i16
  %98 = zext i16 %97 to i32
  br label %99

99:                                               ; preds = %93, %90
  %100 = phi i32 [ %92, %90 ], [ %98, %93 ]
  %101 = trunc i32 %100 to i16
  store i16 %101, ptr %16, align 2, !tbaa !9
  %102 = call ptr @pbuf_alloc(i32 noundef 16, i16 noundef zeroext 20, i32 noundef 640)
  store ptr %102, ptr %8, align 8, !tbaa !5
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %106

105:                                              ; preds = %99
  br label %295

106:                                              ; preds = %99
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.pbuf, ptr %108, i32 0, i32 3
  %110 = load i16, ptr %109, align 2, !tbaa !20
  %111 = zext i16 %110 to i32
  %112 = icmp sge i32 %111, 20
  br i1 %112, label %118, label %113

113:                                              ; preds = %107
  br label %114

114:                                              ; preds = %113
  %115 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.6, i32 noundef 805, ptr noundef @.str.2)
  br label %116

116:                                              ; preds = %114
  br label %117

117:                                              ; preds = %116
  br label %118

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

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.pbuf, ptr %121, i32 0, i32 1
  %123 = load ptr, ptr %122, align 8, !tbaa !15
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %123, ptr align 1 %124, i64 20, i1 false)
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.pbuf, ptr %125, i32 0, i32 1
  %127 = load ptr, ptr %126, align 8, !tbaa !15
  store ptr %127, ptr %13, align 8, !tbaa !5
  %128 = load i16, ptr %16, align 2, !tbaa !9
  store i16 %128, ptr %11, align 2, !tbaa !9
  br label %129

129:                                              ; preds = %228, %226, %120
  %130 = load i16, ptr %11, align 2, !tbaa !9
  %131 = icmp ne i16 %130, 0
  br i1 %131, label %132, label %229

132:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %24) #4
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.pbuf, ptr %133, i32 0, i32 3
  %135 = load i16, ptr %134, align 2, !tbaa !20
  %136 = zext i16 %135 to i32
  %137 = load i16, ptr %19, align 2, !tbaa !9
  %138 = zext i16 %137 to i32
  %139 = sub nsw i32 %136, %138
  %140 = trunc i32 %139 to i16
  store i16 %140, ptr %24, align 2, !tbaa !9
  br label %141

141:                                              ; preds = %132
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.pbuf, ptr %142, i32 0, i32 3
  %144 = load i16, ptr %143, align 2, !tbaa !20
  %145 = zext i16 %144 to i32
  %146 = load i16, ptr %19, align 2, !tbaa !9
  %147 = zext i16 %146 to i32
  %148 = icmp sge i32 %145, %147
  br i1 %148, label %154, label %149

149:                                              ; preds = %141
  br label %150

150:                                              ; preds = %149
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.7, i32 noundef 813, ptr noundef @.str.2)
  br label %152

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153, %141
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  %157 = load i16, ptr %11, align 2, !tbaa !9
  %158 = zext i16 %157 to i32
  %159 = load i16, ptr %24, align 2, !tbaa !9
  %160 = zext i16 %159 to i32
  %161 = icmp slt i32 %158, %160
  br i1 %161, label %162, label %165

162:                                              ; preds = %156
  %163 = load i16, ptr %11, align 2, !tbaa !9
  %164 = zext i16 %163 to i32
  br label %168

165:                                              ; preds = %156
  %166 = load i16, ptr %24, align 2, !tbaa !9
  %167 = zext i16 %166 to i32
  br label %168

168:                                              ; preds = %165, %162
  %169 = phi i32 [ %164, %162 ], [ %167, %165 ]
  %170 = trunc i32 %169 to i16
  store i16 %170, ptr %10, align 2, !tbaa !9
  %171 = load i16, ptr %10, align 2, !tbaa !9
  %172 = icmp ne i16 %171, 0
  br i1 %172, label %177, label %173

173:                                              ; preds = %168
  store i16 0, ptr %19, align 2, !tbaa !9
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.pbuf, ptr %174, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8, !tbaa !24
  store ptr %176, ptr %5, align 8, !tbaa !5
  store i32 13, ptr %22, align 4
  br label %226, !llvm.loop !25

177:                                              ; preds = %168
  %178 = call ptr @ip_frag_alloc_pbuf_custom_ref()
  store ptr %178, ptr %23, align 8, !tbaa !5
  %179 = load ptr, ptr %23, align 8, !tbaa !5
  %180 = icmp eq ptr %179, null
  br i1 %180, label %181, label %184

181:                                              ; preds = %177
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = call zeroext i8 @pbuf_free(ptr noundef %182)
  store i32 8, ptr %22, align 4
  br label %226

184:                                              ; preds = %177
  %185 = load i16, ptr %10, align 2, !tbaa !9
  %186 = load ptr, ptr %23, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.pbuf_custom_ref, ptr %186, i32 0, i32 0
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.pbuf, ptr %188, i32 0, i32 1
  %190 = load ptr, ptr %189, align 8, !tbaa !15
  %191 = load i16, ptr %19, align 2, !tbaa !9
  %192 = zext i16 %191 to i32
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds i8, ptr %190, i64 %193
  %195 = load i16, ptr %10, align 2, !tbaa !9
  %196 = call ptr @pbuf_alloced_custom(i32 noundef 0, i16 noundef zeroext %185, i32 noundef 65, ptr noundef %187, ptr noundef %194, i16 noundef zeroext %195)
  store ptr %196, ptr %9, align 8, !tbaa !5
  %197 = load ptr, ptr %9, align 8, !tbaa !5
  %198 = icmp eq ptr %197, null
  br i1 %198, label %199, label %203

199:                                              ; preds = %184
  %200 = load ptr, ptr %23, align 8, !tbaa !5
  call void @ip_frag_free_pbuf_custom_ref(ptr noundef %200)
  %201 = load ptr, ptr %8, align 8, !tbaa !5
  %202 = call zeroext i8 @pbuf_free(ptr noundef %201)
  store i32 8, ptr %22, align 4
  br label %226

203:                                              ; preds = %184
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  call void @pbuf_ref(ptr noundef %204)
  %205 = load ptr, ptr %5, align 8, !tbaa !5
  %206 = load ptr, ptr %23, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.pbuf_custom_ref, ptr %206, i32 0, i32 1
  store ptr %205, ptr %207, align 8, !tbaa !27
  %208 = load ptr, ptr %23, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.pbuf_custom_ref, ptr %208, i32 0, i32 0
  %210 = getelementptr inbounds %struct.pbuf_custom, ptr %209, i32 0, i32 1
  store ptr @ipfrag_free_pbuf_custom, ptr %210, align 8, !tbaa !30
  %211 = load ptr, ptr %8, align 8, !tbaa !5
  %212 = load ptr, ptr %9, align 8, !tbaa !5
  call void @pbuf_cat(ptr noundef %211, ptr noundef %212)
  %213 = load i16, ptr %11, align 2, !tbaa !9
  %214 = zext i16 %213 to i32
  %215 = load i16, ptr %10, align 2, !tbaa !9
  %216 = zext i16 %215 to i32
  %217 = sub nsw i32 %214, %216
  %218 = trunc i32 %217 to i16
  store i16 %218, ptr %11, align 2, !tbaa !9
  %219 = load i16, ptr %11, align 2, !tbaa !9
  %220 = icmp ne i16 %219, 0
  br i1 %220, label %221, label %225

221:                                              ; preds = %203
  store i16 0, ptr %19, align 2, !tbaa !9
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.pbuf, ptr %222, i32 0, i32 0
  %224 = load ptr, ptr %223, align 8, !tbaa !24
  store ptr %224, ptr %5, align 8, !tbaa !5
  br label %225

225:                                              ; preds = %221, %203
  store i32 0, ptr %22, align 4
  br label %226

226:                                              ; preds = %225, %199, %181, %173
  call void @llvm.lifetime.end.p0(i64 2, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  %227 = load i32, ptr %22, align 4
  switch i32 %227, label %296 [
    i32 0, label %228
    i32 13, label %129
    i32 8, label %295
  ]

228:                                              ; preds = %226
  br label %129, !llvm.loop !25

229:                                              ; preds = %129
  %230 = load i16, ptr %19, align 2, !tbaa !9
  %231 = zext i16 %230 to i32
  %232 = load i16, ptr %10, align 2, !tbaa !9
  %233 = zext i16 %232 to i32
  %234 = add nsw i32 %231, %233
  %235 = trunc i32 %234 to i16
  store i16 %235, ptr %19, align 2, !tbaa !9
  %236 = load i16, ptr %15, align 2, !tbaa !9
  %237 = zext i16 %236 to i32
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.netif, ptr %238, i32 0, i32 10
  %240 = load i16, ptr %239, align 8, !tbaa !11
  %241 = zext i16 %240 to i32
  %242 = sub nsw i32 %241, 20
  %243 = icmp sle i32 %237, %242
  %244 = zext i1 %243 to i32
  store i32 %244, ptr %18, align 4, !tbaa !22
  %245 = load i16, ptr %17, align 2, !tbaa !9
  %246 = zext i16 %245 to i32
  %247 = and i32 8191, %246
  %248 = trunc i32 %247 to i16
  store i16 %248, ptr %20, align 2, !tbaa !9
  %249 = load i32, ptr %18, align 4, !tbaa !22
  %250 = icmp ne i32 %249, 0
  br i1 %250, label %251, label %254

251:                                              ; preds = %229
  %252 = load i32, ptr %21, align 4, !tbaa !22
  %253 = icmp ne i32 %252, 0
  br i1 %253, label %254, label %259

254:                                              ; preds = %251, %229
  %255 = load i16, ptr %20, align 2, !tbaa !9
  %256 = zext i16 %255 to i32
  %257 = or i32 %256, 8192
  %258 = trunc i32 %257 to i16
  store i16 %258, ptr %20, align 2, !tbaa !9
  br label %259

259:                                              ; preds = %254, %251
  %260 = load i16, ptr %20, align 2, !tbaa !9
  %261 = call zeroext i16 @lwip_htons(i16 noundef zeroext %260)
  %262 = load ptr, ptr %13, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.ip_hdr, ptr %262, i32 0, i32 4
  store i16 %261, ptr %263, align 1, !tbaa !21
  %264 = load i16, ptr %16, align 2, !tbaa !9
  %265 = zext i16 %264 to i32
  %266 = add nsw i32 %265, 20
  %267 = trunc i32 %266 to i16
  %268 = call zeroext i16 @lwip_htons(i16 noundef zeroext %267)
  %269 = load ptr, ptr %13, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.ip_hdr, ptr %269, i32 0, i32 2
  store i16 %268, ptr %270, align 1, !tbaa !31
  %271 = load ptr, ptr %13, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.ip_hdr, ptr %271, i32 0, i32 7
  store i16 0, ptr %272, align 1, !tbaa !32
  %273 = load ptr, ptr %6, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.netif, ptr %273, i32 0, i32 5
  %275 = load ptr, ptr %274, align 8, !tbaa !33
  %276 = load ptr, ptr %6, align 8, !tbaa !5
  %277 = load ptr, ptr %8, align 8, !tbaa !5
  %278 = load ptr, ptr %7, align 8, !tbaa !5
  %279 = call signext i8 %275(ptr noundef %276, ptr noundef %277, ptr noundef %278)
  %280 = load ptr, ptr %8, align 8, !tbaa !5
  %281 = call zeroext i8 @pbuf_free(ptr noundef %280)
  %282 = load i16, ptr %15, align 2, !tbaa !9
  %283 = zext i16 %282 to i32
  %284 = load i16, ptr %16, align 2, !tbaa !9
  %285 = zext i16 %284 to i32
  %286 = sub nsw i32 %283, %285
  %287 = trunc i32 %286 to i16
  store i16 %287, ptr %15, align 2, !tbaa !9
  %288 = load i16, ptr %17, align 2, !tbaa !9
  %289 = zext i16 %288 to i32
  %290 = load i16, ptr %14, align 2, !tbaa !9
  %291 = zext i16 %290 to i32
  %292 = add nsw i32 %289, %291
  %293 = trunc i32 %292 to i16
  store i16 %293, ptr %17, align 2, !tbaa !9
  br label %78, !llvm.loop !34

294:                                              ; preds = %78
  store i8 0, ptr %4, align 1
  store i32 1, ptr %22, align 4
  br label %296

295:                                              ; preds = %226, %105
  store i8 -1, ptr %4, align 1
  store i32 1, ptr %22, align 4
  br label %296

296:                                              ; preds = %295, %294, %226, %57, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %297 = load i8, ptr %4, align 1
  ret i8 %297
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @ip_frag_alloc_pbuf_custom_ref() #3

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

; Function Attrs: nounwind uwtable
declare hidden void @ip_frag_free_pbuf_custom_ref(ptr noundef) #3

declare void @pbuf_ref(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @ipfrag_free_pbuf_custom(ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!"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, !10, i64 72}
!12 = !{!"netif", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !7, i64 64, !10, i64 72, !7, i64 74, !7, i64 80, !7, i64 81, !7, i64 82, !7, i64 84, !7, i64 85}
!13 = !{!"ip4_addr", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"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}
!17 = !{!18, !7, i64 0}
!18 = !{!"ip_hdr", !7, i64 0, !7, i64 1, !10, i64 2, !10, i64 4, !10, i64 6, !7, i64 8, !7, i64 9, !10, i64 10, !19, i64 12, !19, i64 16}
!19 = !{!"ip4_addr_packed", !14, i64 0}
!20 = !{!16, !10, i64 18}
!21 = !{!18, !10, i64 6}
!22 = !{!14, !14, i64 0}
!23 = !{!16, !10, i64 16}
!24 = !{!16, !6, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!28, !6, i64 32}
!28 = !{!"pbuf_custom_ref", !29, i64 0, !6, i64 32}
!29 = !{!"pbuf_custom", !16, i64 0, !6, i64 24}
!30 = !{!28, !6, i64 24}
!31 = !{!18, !10, i64 2}
!32 = !{!18, !10, i64 10}
!33 = !{!12, !6, i64 32}
!34 = distinct !{!34, !26}


; 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 [188 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef signext i8 @ip4_frag(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #3 {
  %4 = getelementptr inbounds i8, ptr %1, i64 72
  %5 = load i16, ptr %4, align 8, !tbaa !5
  %6 = zext i16 %5 to i32
  %7 = add nsw i32 %6, -20
  %8 = sdiv i32 %7, 8
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = load i8, ptr %10, align 1, !tbaa !15
  %12 = and i8 %11, 15
  %.not = icmp eq i8 %12, 5
  br i1 %.not, label %13, label %.thread

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %0, i64 18
  %15 = load i16, ptr %14, align 2, !tbaa !18
  %16 = icmp ugt i16 %15, 19
  br i1 %16, label %19, label %17

17:                                               ; preds = %13
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.5, i32 noundef 764, ptr noundef nonnull @.str.2)
  br label %.thread

19:                                               ; preds = %13
  %20 = getelementptr inbounds i8, ptr %10, i64 6
  %21 = load i16, ptr %20, align 1, !tbaa !19
  %22 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %21) #5
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load i16, ptr %23, align 8, !tbaa !20
  %25 = add i16 %24, -20
  %.not92116 = icmp eq i16 %25, 0
  br i1 %.not92116, label %.thread, label %.lr.ph123

.lr.ph123:                                        ; preds = %19
  %26 = and i16 %22, 8192
  %27 = shl nsw i32 %8, 3
  %28 = and i32 %27, 65528
  %29 = icmp ne i16 %26, 0
  %30 = getelementptr inbounds i8, ptr %1, i64 32
  %31 = trunc nsw i32 %8 to i16
  %.not93110 = icmp eq i32 %28, 0
  br label %32

32:                                               ; preds = %.lr.ph123, %._crit_edge
  %.075121 = phi ptr [ %0, %.lr.ph123 ], [ %.1.lcssa, %._crit_edge ]
  %.077120 = phi i16 [ 0, %.lr.ph123 ], [ %.178.lcssa, %._crit_edge ]
  %.080119 = phi i16 [ 20, %.lr.ph123 ], [ %90, %._crit_edge ]
  %.086118 = phi i16 [ %22, %.lr.ph123 ], [ %106, %._crit_edge ]
  %.087117 = phi i16 [ %25, %.lr.ph123 ], [ %105, %._crit_edge ]
  %33 = zext i16 %.087117 to i32
  %34 = tail call i32 @llvm.umin.i32(i32 %28, i32 %33)
  %35 = trunc nuw i32 %34 to i16
  %36 = tail call ptr @pbuf_alloc(i32 noundef 16, i16 noundef zeroext 20, i32 noundef 640) #5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %.thread, label %38

38:                                               ; preds = %32
  %39 = getelementptr inbounds i8, ptr %36, i64 18
  %40 = load i16, ptr %39, align 2, !tbaa !18
  %41 = icmp ugt i16 %40, 19
  br i1 %41, label %44, label %42

42:                                               ; preds = %38
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.6, i32 noundef 805, ptr noundef nonnull @.str.2)
  br label %44

44:                                               ; preds = %42, %38
  %45 = getelementptr inbounds i8, ptr %36, i64 8
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(20) %46, ptr noundef nonnull align 1 dereferenceable(20) %10, i64 20, i1 false)
  %47 = load ptr, ptr %45, align 8, !tbaa !13
  br i1 %.not93110, label %._crit_edge, label %.lr.ph.peel

.lr.ph.peel:                                      ; preds = %44
  %48 = getelementptr inbounds i8, ptr %.075121, i64 18
  %49 = load i16, ptr %48, align 2, !tbaa !18
  %50 = sub i16 %49, %.080119
  %.not95.peel = icmp ult i16 %49, %.080119
  br i1 %.not95.peel, label %51, label %53

51:                                               ; preds = %.lr.ph.peel
  %52 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.7, i32 noundef 813, ptr noundef nonnull @.str.2)
  br label %53

53:                                               ; preds = %51, %.lr.ph.peel
  %54 = tail call i16 @llvm.umin.i16(i16 %35, i16 %50)
  %.not96.peel = icmp eq i16 %49, %.080119
  br i1 %.not96.peel, label %69, label %55, !llvm.loop !21

55:                                               ; preds = %53
  %56 = tail call ptr @ip_frag_alloc_pbuf_custom_ref()
  %57 = icmp eq ptr %56, null
  br i1 %57, label %.loopexit, label %58

58:                                               ; preds = %55
  %59 = getelementptr inbounds i8, ptr %.075121, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  %61 = zext i16 %.080119 to i64
  %62 = getelementptr inbounds i8, ptr %60, i64 %61
  %63 = tail call ptr @pbuf_alloced_custom(i32 noundef 0, i16 noundef zeroext %54, i32 noundef 65, ptr noundef nonnull %56, ptr noundef %62, i16 noundef zeroext %54) #5
  %64 = icmp eq ptr %63, null
  br i1 %64, label %.loopexit159, label %65

65:                                               ; preds = %58
  tail call void @pbuf_ref(ptr noundef nonnull %.075121) #5
  %66 = getelementptr inbounds i8, ptr %56, i64 32
  store ptr %.075121, ptr %66, align 8, !tbaa !23
  %67 = getelementptr inbounds i8, ptr %56, i64 24
  store ptr @ipfrag_free_pbuf_custom, ptr %67, align 8, !tbaa !26
  tail call void @pbuf_cat(ptr noundef nonnull %36, ptr noundef nonnull %63) #5
  %68 = sub i16 %35, %54
  %.not97.peel = icmp eq i16 %68, 0
  br i1 %.not97.peel, label %._crit_edge, label %69

69:                                               ; preds = %65, %53
  %.185.peel = phi i16 [ %35, %53 ], [ %68, %65 ]
  %70 = load ptr, ptr %.075121, align 8, !tbaa !27
  %.not93.peel = icmp eq i16 %.185.peel, 0
  br i1 %.not93.peel, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %69, %88
  %.1113 = phi ptr [ %89, %88 ], [ %70, %69 ]
  %.084111 = phi i16 [ %.185, %88 ], [ %.185.peel, %69 ]
  %71 = getelementptr inbounds i8, ptr %.1113, i64 18
  %72 = load i16, ptr %71, align 2, !tbaa !18
  %73 = tail call i16 @llvm.umin.i16(i16 %.084111, i16 %72)
  %.not96 = icmp eq i16 %72, 0
  br i1 %.not96, label %88, label %74, !llvm.loop !21

74:                                               ; preds = %.lr.ph
  %75 = tail call ptr @ip_frag_alloc_pbuf_custom_ref()
  %76 = icmp eq ptr %75, null
  br i1 %76, label %.loopexit, label %78

.loopexit:                                        ; preds = %55, %74
  %77 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %36) #5
  br label %.thread

78:                                               ; preds = %74
  %79 = getelementptr inbounds i8, ptr %.1113, i64 8
  %80 = load ptr, ptr %79, align 8, !tbaa !13
  %81 = tail call ptr @pbuf_alloced_custom(i32 noundef 0, i16 noundef zeroext %73, i32 noundef 65, ptr noundef nonnull %75, ptr noundef %80, i16 noundef zeroext %73) #5
  %82 = icmp eq ptr %81, null
  br i1 %82, label %.loopexit159, label %84

.loopexit159:                                     ; preds = %58, %78
  %.lcssa152 = phi ptr [ %75, %78 ], [ %56, %58 ]
  tail call void @ip_frag_free_pbuf_custom_ref(ptr noundef nonnull %.lcssa152)
  %83 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %36) #5
  br label %.thread

84:                                               ; preds = %78
  tail call void @pbuf_ref(ptr noundef nonnull %.1113) #5
  %85 = getelementptr inbounds i8, ptr %75, i64 32
  store ptr %.1113, ptr %85, align 8, !tbaa !23
  %86 = getelementptr inbounds i8, ptr %75, i64 24
  store ptr @ipfrag_free_pbuf_custom, ptr %86, align 8, !tbaa !26
  tail call void @pbuf_cat(ptr noundef nonnull %36, ptr noundef nonnull %81) #5
  %87 = sub i16 %.084111, %73
  %.not97 = icmp eq i16 %87, 0
  br i1 %.not97, label %._crit_edge, label %88

88:                                               ; preds = %84, %.lr.ph
  %.185 = phi i16 [ %.084111, %.lr.ph ], [ %87, %84 ]
  %89 = load ptr, ptr %.1113, align 8, !tbaa !27
  %.not93 = icmp eq i16 %.185, 0
  br i1 %.not93, label %._crit_edge, label %.lr.ph, !llvm.loop !28

._crit_edge:                                      ; preds = %65, %69, %84, %88, %44
  %.181.lcssa = phi i16 [ %.080119, %44 ], [ %.080119, %65 ], [ 0, %69 ], [ 0, %84 ], [ 0, %88 ]
  %.178.lcssa = phi i16 [ %.077120, %44 ], [ %54, %65 ], [ %54, %69 ], [ %73, %84 ], [ %73, %88 ]
  %.1.lcssa = phi ptr [ %.075121, %44 ], [ %.075121, %65 ], [ %70, %69 ], [ %89, %88 ], [ %.1113, %84 ]
  %90 = add i16 %.178.lcssa, %.181.lcssa
  %91 = load i16, ptr %4, align 8, !tbaa !5
  %92 = zext i16 %91 to i32
  %93 = add nsw i32 %92, -20
  %.not94 = icmp slt i32 %93, %33
  %94 = and i16 %.086118, 8191
  %or.cond = select i1 %.not94, i1 true, i1 %29
  %95 = or disjoint i16 %94, 8192
  %spec.select = select i1 %or.cond, i16 %95, i16 %94
  %96 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %spec.select) #5
  %97 = getelementptr inbounds i8, ptr %47, i64 6
  store i16 %96, ptr %97, align 1, !tbaa !19
  %98 = add i16 %35, 20
  %99 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %98) #5
  %100 = getelementptr inbounds i8, ptr %47, i64 2
  store i16 %99, ptr %100, align 1, !tbaa !30
  %101 = getelementptr inbounds i8, ptr %47, i64 10
  store i16 0, ptr %101, align 1, !tbaa !31
  %102 = load ptr, ptr %30, align 8, !tbaa !32
  %103 = tail call signext i8 %102(ptr noundef %1, ptr noundef nonnull %36, ptr noundef %2) #5
  %104 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %36) #5
  %105 = sub i16 %.087117, %35
  %106 = add i16 %.086118, %31
  %.not92 = icmp eq i16 %105, 0
  br i1 %.not92, label %.thread, label %32, !llvm.loop !33

.thread:                                          ; preds = %._crit_edge, %32, %19, %.loopexit159, %.loopexit, %3, %17
  %.0 = phi i8 [ -6, %17 ], [ -6, %3 ], [ -1, %.loopexit ], [ -1, %.loopexit159 ], [ 0, %19 ], [ 0, %._crit_edge ], [ -1, %32 ]
  ret i8 %.0
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @ip_frag_alloc_pbuf_custom_ref() local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden void @ip_frag_free_pbuf_custom_ref(ptr noundef) local_unnamed_addr #3

declare void @pbuf_ref(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @ipfrag_free_pbuf_custom(ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.umin.i16(i16, i16) #4

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !12, i64 72}
!6 = !{!"netif", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !8, i64 64, !12, i64 72, !8, i64 74, !8, i64 80, !8, i64 81, !8, i64 82, !8, i64 84, !8, i64 85}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"ip4_addr", !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!14, !7, i64 8}
!14 = !{!"pbuf", !7, i64 0, !7, i64 8, !12, i64 16, !12, i64 18, !8, i64 20, !8, i64 21, !8, i64 22, !8, i64 23}
!15 = !{!16, !8, i64 0}
!16 = !{!"ip_hdr", !8, i64 0, !8, i64 1, !12, i64 2, !12, i64 4, !12, i64 6, !8, i64 8, !8, i64 9, !12, i64 10, !17, i64 12, !17, i64 16}
!17 = !{!"ip4_addr_packed", !11, i64 0}
!18 = !{!14, !12, i64 18}
!19 = !{!16, !12, i64 6}
!20 = !{!14, !12, i64 16}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !7, i64 32}
!24 = !{!"pbuf_custom_ref", !25, i64 0, !7, i64 32}
!25 = !{!"pbuf_custom", !14, i64 0, !7, i64 24}
!26 = !{!24, !7, i64 24}
!27 = !{!14, !7, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.peeled.count", i32 1}
!30 = !{!16, !12, i64 2}
!31 = !{!16, !12, i64 10}
!32 = !{!6, !7, i64 32}
!33 = distinct !{!33, !22}


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