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

; 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.ip_globals = type { ptr, ptr, ptr, i16, %struct.ip4_addr, %struct.ip4_addr }
%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.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.udp_hdr = type { i16, i16, i16, i16 }

@netif_list = external global ptr, align 8
@ip_data = external global %struct.ip_globals, align 8

; 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

; Function Attrs: nounwind uwtable
define dso_local signext i8 @ip4_input(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 1, ptr %10, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.pbuf, ptr %13, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  store ptr %15, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ip_hdr, ptr %16, i32 0, i32 0
  %18 = load i8, ptr %17, align 1, !tbaa !14
  %19 = zext i8 %18 to i32
  %20 = ashr i32 %19, 4
  %21 = icmp ne i32 %20, 4
  br i1 %21, label %22, label %25

22:                                               ; preds = %2
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call zeroext i8 @pbuf_free(ptr noundef %23)
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

25:                                               ; preds = %2
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ip_hdr, ptr %26, i32 0, i32 0
  %28 = load i8, ptr %27, align 1, !tbaa !14
  %29 = zext i8 %28 to i32
  %30 = and i32 %29, 15
  %31 = mul nsw i32 %30, 4
  %32 = trunc i32 %31 to i8
  %33 = zext i8 %32 to i16
  store i16 %33, ptr %8, align 2, !tbaa !17
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ip_hdr, ptr %34, i32 0, i32 2
  %36 = load i16, ptr %35, align 1, !tbaa !18
  %37 = call zeroext i16 @lwip_htons(i16 noundef zeroext %36)
  store i16 %37, ptr %9, align 2, !tbaa !17
  %38 = load i16, ptr %9, align 2, !tbaa !17
  %39 = zext i16 %38 to i32
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.pbuf, ptr %40, i32 0, i32 2
  %42 = load i16, ptr %41, align 8, !tbaa !19
  %43 = zext i16 %42 to i32
  %44 = icmp slt i32 %39, %43
  br i1 %44, label %45, label %48

45:                                               ; preds = %25
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i16, ptr %9, align 2, !tbaa !17
  call void @pbuf_realloc(ptr noundef %46, i16 noundef zeroext %47)
  br label %48

48:                                               ; preds = %45, %25
  %49 = load i16, ptr %8, align 2, !tbaa !17
  %50 = zext i16 %49 to i32
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.pbuf, ptr %51, i32 0, i32 3
  %53 = load i16, ptr %52, align 2, !tbaa !20
  %54 = zext i16 %53 to i32
  %55 = icmp sgt i32 %50, %54
  br i1 %55, label %68, label %56

56:                                               ; preds = %48
  %57 = load i16, ptr %9, align 2, !tbaa !17
  %58 = zext i16 %57 to i32
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.pbuf, ptr %59, i32 0, i32 2
  %61 = load i16, ptr %60, align 8, !tbaa !19
  %62 = zext i16 %61 to i32
  %63 = icmp sgt i32 %58, %62
  br i1 %63, label %68, label %64

64:                                               ; preds = %56
  %65 = load i16, ptr %8, align 2, !tbaa !17
  %66 = zext i16 %65 to i32
  %67 = icmp slt i32 %66, 20
  br i1 %67, label %68, label %94

68:                                               ; preds = %64, %56, %48
  %69 = load i16, ptr %8, align 2, !tbaa !17
  %70 = zext i16 %69 to i32
  %71 = icmp slt i32 %70, 20
  br i1 %71, label %72, label %73

72:                                               ; preds = %68
  br label %73

73:                                               ; preds = %72, %68
  %74 = load i16, ptr %8, align 2, !tbaa !17
  %75 = zext i16 %74 to i32
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.pbuf, ptr %76, i32 0, i32 3
  %78 = load i16, ptr %77, align 2, !tbaa !20
  %79 = zext i16 %78 to i32
  %80 = icmp sgt i32 %75, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %73
  br label %82

82:                                               ; preds = %81, %73
  %83 = load i16, ptr %9, align 2, !tbaa !17
  %84 = zext i16 %83 to i32
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.pbuf, ptr %85, i32 0, i32 2
  %87 = load i16, ptr %86, align 8, !tbaa !19
  %88 = zext i16 %87 to i32
  %89 = icmp sgt i32 %84, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %82
  br label %91

91:                                               ; preds = %90, %82
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = call zeroext i8 @pbuf_free(ptr noundef %92)
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

94:                                               ; preds = %64
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ip_hdr, ptr %95, i32 0, i32 9
  %97 = getelementptr inbounds %struct.ip4_addr_packed, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 1, !tbaa !21
  store i32 %98, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ip_hdr, ptr %99, i32 0, i32 8
  %101 = getelementptr inbounds %struct.ip4_addr_packed, ptr %100, i32 0, i32 0
  %102 = load i32, ptr %101, align 1, !tbaa !25
  store i32 %102, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 4), align 4, !tbaa !26
  %103 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  %104 = zext i32 %103 to i64
  %105 = and i64 %104, 240
  %106 = icmp eq i64 %105, 224
  br i1 %106, label %107, label %126

107:                                              ; preds = %94
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.netif, ptr %108, i32 0, i32 13
  %110 = load i8, ptr %109, align 1, !tbaa !27
  %111 = zext i8 %110 to i32
  %112 = and i32 %111, 1
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %115

114:                                              ; preds = %107
  br i1 true, label %116, label %124

115:                                              ; preds = %107
  br i1 false, label %116, label %124

116:                                              ; preds = %115, %114
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.netif, ptr %117, i32 0, i32 1
  %119 = getelementptr inbounds %struct.ip4_addr, ptr %118, i32 0, i32 0
  %120 = load i32, ptr %119, align 8, !tbaa !29
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %124, label %122

122:                                              ; preds = %116
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %123, ptr %7, align 8, !tbaa !5
  br label %125

124:                                              ; preds = %116, %115, %114
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %125

125:                                              ; preds = %124, %122
  br label %159

126:                                              ; preds = %94
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = call i32 @ip4_input_accept(ptr noundef %127)
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %132

130:                                              ; preds = %126
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %131, ptr %7, align 8, !tbaa !5
  br label %158

132:                                              ; preds = %126
  store ptr null, ptr %7, align 8, !tbaa !5
  %133 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  %134 = and i32 %133, 255
  %135 = icmp eq i32 %134, 127
  br i1 %135, label %157, label %136

136:                                              ; preds = %132
  %137 = load ptr, ptr @netif_list, align 8, !tbaa !5
  store ptr %137, ptr %7, align 8, !tbaa !5
  br label %138

138:                                              ; preds = %152, %136
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %156

141:                                              ; preds = %138
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = icmp eq ptr %142, %143
  br i1 %144, label %145, label %146

145:                                              ; preds = %141
  br label %152

146:                                              ; preds = %141
  %147 = load ptr, ptr %7, align 8, !tbaa !5
  %148 = call i32 @ip4_input_accept(ptr noundef %147)
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %151

150:                                              ; preds = %146
  br label %156

151:                                              ; preds = %146
  br label %152

152:                                              ; preds = %151, %145
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.netif, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !30
  store ptr %155, ptr %7, align 8, !tbaa !5
  br label %138, !llvm.loop !31

156:                                              ; preds = %150, %138
  br label %157

157:                                              ; preds = %156, %132
  br label %158

158:                                              ; preds = %157, %130
  br label %159

159:                                              ; preds = %158, %125
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = icmp eq ptr %160, null
  br i1 %161, label %162, label %183

162:                                              ; preds = %159
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.ip_hdr, ptr %163, i32 0, i32 6
  %165 = load i8, ptr %164, align 1, !tbaa !33
  %166 = zext i8 %165 to i32
  %167 = icmp eq i32 %166, 17
  br i1 %167, label %168, label %182

168:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = load i16, ptr %8, align 2, !tbaa !17
  %171 = zext i16 %170 to i32
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds i8, ptr %169, i64 %172
  store ptr %173, ptr %12, align 8, !tbaa !5
  %174 = load ptr, ptr %12, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.udp_hdr, ptr %174, i32 0, i32 1
  %176 = load i16, ptr %175, align 1, !tbaa !34
  %177 = zext i16 %176 to i32
  %178 = icmp eq i32 %177, 17408
  br i1 %178, label %179, label %181

179:                                              ; preds = %168
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %180, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %179, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %182

182:                                              ; preds = %181, %162
  br label %183

183:                                              ; preds = %182, %159
  %184 = load i32, ptr %10, align 4, !tbaa !9
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %186, label %204

186:                                              ; preds = %183
  %187 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 4), align 4, !tbaa !26
  %188 = icmp eq i32 %187, 0
  br i1 %188, label %204, label %189

189:                                              ; preds = %186
  %190 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 4), align 4, !tbaa !26
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = call zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef %190, ptr noundef %191)
  %193 = zext i8 %192 to i32
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %200, label %195

195:                                              ; preds = %189
  %196 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 4), align 4, !tbaa !26
  %197 = zext i32 %196 to i64
  %198 = and i64 %197, 240
  %199 = icmp eq i64 %198, 224
  br i1 %199, label %200, label %203

200:                                              ; preds = %195, %189
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  %202 = call zeroext i8 @pbuf_free(ptr noundef %201)
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

203:                                              ; preds = %195
  br label %204

204:                                              ; preds = %203, %186, %183
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = icmp eq ptr %205, null
  br i1 %206, label %207, label %210

207:                                              ; preds = %204
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = call zeroext i8 @pbuf_free(ptr noundef %208)
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

210:                                              ; preds = %204
  %211 = load ptr, ptr %6, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.ip_hdr, ptr %211, i32 0, i32 4
  %213 = load i16, ptr %212, align 1, !tbaa !36
  %214 = zext i16 %213 to i32
  %215 = and i32 %214, 65343
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %227

217:                                              ; preds = %210
  %218 = load ptr, ptr %4, align 8, !tbaa !5
  %219 = call ptr @ip4_reass(ptr noundef %218)
  store ptr %219, ptr %4, align 8, !tbaa !5
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = icmp eq ptr %220, null
  br i1 %221, label %222, label %223

222:                                              ; preds = %217
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

223:                                              ; preds = %217
  %224 = load ptr, ptr %4, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.pbuf, ptr %224, i32 0, i32 1
  %226 = load ptr, ptr %225, align 8, !tbaa !11
  store ptr %226, ptr %6, align 8, !tbaa !5
  br label %227

227:                                              ; preds = %223, %210
  %228 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %228, ptr @ip_data, align 8, !tbaa !37
  %229 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %229, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 1), align 8, !tbaa !38
  %230 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %230, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 2), align 8, !tbaa !39
  %231 = load ptr, ptr %6, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.ip_hdr, ptr %231, i32 0, i32 0
  %233 = load i8, ptr %232, align 1, !tbaa !14
  %234 = zext i8 %233 to i32
  %235 = and i32 %234, 15
  %236 = mul nsw i32 %235, 4
  %237 = trunc i32 %236 to i8
  %238 = zext i8 %237 to i16
  store i16 %238, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 3), align 8, !tbaa !40
  %239 = load ptr, ptr %4, align 8, !tbaa !5
  %240 = load i16, ptr %8, align 2, !tbaa !17
  %241 = zext i16 %240 to i64
  %242 = call zeroext i8 @pbuf_remove_header(ptr noundef %239, i64 noundef %241)
  %243 = load ptr, ptr %6, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.ip_hdr, ptr %243, i32 0, i32 6
  %245 = load i8, ptr %244, align 1, !tbaa !33
  %246 = zext i8 %245 to i32
  switch i32 %246, label %256 [
    i32 17, label %247
    i32 6, label %250
    i32 1, label %253
  ]

247:                                              ; preds = %227
  %248 = load ptr, ptr %4, align 8, !tbaa !5
  %249 = load ptr, ptr %5, align 8, !tbaa !5
  call void @udp_input(ptr noundef %248, ptr noundef %249)
  br label %274

250:                                              ; preds = %227
  %251 = load ptr, ptr %4, align 8, !tbaa !5
  %252 = load ptr, ptr %5, align 8, !tbaa !5
  call void @tcp_input(ptr noundef %251, ptr noundef %252)
  br label %274

253:                                              ; preds = %227
  %254 = load ptr, ptr %4, align 8, !tbaa !5
  %255 = load ptr, ptr %5, align 8, !tbaa !5
  call void @icmp_input(ptr noundef %254, ptr noundef %255)
  br label %274

256:                                              ; preds = %227
  %257 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  %258 = load ptr, ptr %7, align 8, !tbaa !5
  %259 = call zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef %257, ptr noundef %258)
  %260 = icmp ne i8 %259, 0
  br i1 %260, label %271, label %261

261:                                              ; preds = %256
  %262 = load i32, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  %263 = zext i32 %262 to i64
  %264 = and i64 %263, 240
  %265 = icmp eq i64 %264, 224
  br i1 %265, label %271, label %266

266:                                              ; preds = %261
  %267 = load ptr, ptr %4, align 8, !tbaa !5
  %268 = load i16, ptr %8, align 2, !tbaa !17
  %269 = call zeroext i8 @pbuf_header_force(ptr noundef %267, i16 noundef signext %268)
  %270 = load ptr, ptr %4, align 8, !tbaa !5
  call void @icmp_dest_unreach(ptr noundef %270, i32 noundef 2)
  br label %271

271:                                              ; preds = %266, %261, %256
  %272 = load ptr, ptr %4, align 8, !tbaa !5
  %273 = call zeroext i8 @pbuf_free(ptr noundef %272)
  br label %274

274:                                              ; preds = %271, %253, %250, %247
  store ptr null, ptr @ip_data, align 8, !tbaa !37
  store ptr null, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 1), align 8, !tbaa !38
  store ptr null, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 2), align 8, !tbaa !39
  store i16 0, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 3), align 8, !tbaa !40
  store i32 0, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 4), align 4, !tbaa !26
  store i32 0, ptr getelementptr inbounds (%struct.ip_globals, ptr @ip_data, i32 0, i32 5), align 8, !tbaa !22
  store i8 0, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %275

275:                                              ; preds = %274, %222, %207, %200, %91, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 2, 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
  %276 = load i8, ptr %3, align 1
  ret i8 %276
}

declare zeroext i8 @pbuf_free(ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ip4_input_accept(ptr noundef) #1

declare zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef, ptr noundef) #2

declare ptr @ip4_reass(ptr noundef) #2

declare zeroext i8 @pbuf_remove_header(ptr noundef, i64 noundef) #2

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

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

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

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

declare void @icmp_dest_unreach(ptr noundef, i32 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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"pbuf", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 18, !7, i64 20, !7, i64 21, !7, i64 22, !7, i64 23}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"ip_hdr", !7, i64 0, !7, i64 1, !13, i64 2, !13, i64 4, !13, i64 6, !7, i64 8, !7, i64 9, !13, i64 10, !16, i64 12, !16, i64 16}
!16 = !{!"ip4_addr_packed", !10, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{!15, !13, i64 2}
!19 = !{!12, !13, i64 16}
!20 = !{!12, !13, i64 18}
!21 = !{!15, !10, i64 16}
!22 = !{!23, !10, i64 32}
!23 = !{!"ip_globals", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !24, i64 28, !24, i64 32}
!24 = !{!"ip4_addr", !10, i64 0}
!25 = !{!15, !10, i64 12}
!26 = !{!23, !10, i64 28}
!27 = !{!28, !7, i64 81}
!28 = !{!"netif", !6, i64 0, !24, i64 8, !24, i64 12, !24, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !7, i64 64, !13, i64 72, !7, i64 74, !7, i64 80, !7, i64 81, !7, i64 82, !7, i64 84, !7, i64 85}
!29 = !{!24, !10, i64 0}
!30 = !{!28, !6, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!15, !7, i64 9}
!34 = !{!35, !13, i64 2}
!35 = !{!"udp_hdr", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6}
!36 = !{!15, !13, i64 6}
!37 = !{!23, !6, i64 0}
!38 = !{!23, !6, i64 8}
!39 = !{!23, !6, i64 16}
!40 = !{!23, !13, i64 24}


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

@netif_list = external local_unnamed_addr global ptr, align 8
@ip_data = external local_unnamed_addr global %struct.ip_globals, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef signext i8 @ip4_input(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load i8, ptr %4, align 1, !tbaa !11
  %6 = and i8 %5, -16
  %.not = icmp eq i8 %6, 64
  br i1 %.not, label %9, label %7

7:                                                ; preds = %2
  %8 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %0) #3
  br label %113

9:                                                ; preds = %2
  %10 = shl i8 %5, 2
  %11 = zext nneg i8 %10 to i16
  %12 = getelementptr inbounds i8, ptr %4, i64 2
  %13 = load i16, ptr %12, align 1, !tbaa !15
  %14 = tail call zeroext i16 @lwip_htons(i16 noundef zeroext %13) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i16, ptr %15, align 8, !tbaa !16
  %17 = icmp ult i16 %14, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %9
  tail call void @pbuf_realloc(ptr noundef nonnull %0, i16 noundef zeroext %14) #3
  br label %19

19:                                               ; preds = %18, %9
  %20 = getelementptr inbounds i8, ptr %0, i64 18
  %21 = load i16, ptr %20, align 2, !tbaa !17
  %22 = icmp ult i16 %21, %11
  br i1 %22, label %27, label %23

23:                                               ; preds = %19
  %24 = load i16, ptr %15, align 8, !tbaa !16
  %25 = icmp ugt i16 %14, %24
  %26 = icmp ult i8 %10, 20
  %or.cond = or i1 %26, %25
  br i1 %or.cond, label %27, label %29

27:                                               ; preds = %23, %19
  %28 = tail call zeroext i8 @pbuf_free(ptr noundef nonnull %0) #3
  br label %113

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %4, i64 16
  %31 = load i32, ptr %30, align 1, !tbaa !18
  store i32 %31, ptr getelementptr inbounds (i8, ptr @ip_data, i64 32), align 8, !tbaa !19
  %32 = getelementptr inbounds i8, ptr %4, i64 12
  %33 = load i32, ptr %32, align 1, !tbaa !22
  store i32 %33, ptr getelementptr inbounds (i8, ptr @ip_data, i64 28), align 4, !tbaa !23
  %34 = and i32 %31, 240
  %35 = icmp eq i32 %34, 224
  br i1 %35, label %36, label %44

36:                                               ; preds = %29
  %37 = getelementptr inbounds i8, ptr %1, i64 81
  %38 = load i8, ptr %37, align 1, !tbaa !24
  %39 = and i8 %38, 1
  %.not79 = icmp eq i8 %39, 0
  br i1 %.not79, label %.thread, label %40

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %1, i64 8
  %42 = load i32, ptr %41, align 8, !tbaa !26
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %.thread, label %.thread85

44:                                               ; preds = %29
  %45 = tail call i32 @ip4_input_accept(ptr noundef %1)
  %.not76 = icmp eq i32 %45, 0
  br i1 %.not76, label %46, label %54

46:                                               ; preds = %44
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @ip_data, i64 32), align 8, !tbaa !19
  %48 = and i32 %47, 255
  %49 = icmp eq i32 %48, 127
  %.07288 = load ptr, ptr @netif_list, align 8
  %.not7789 = icmp eq ptr %.07288, null
  %or.cond91 = select i1 %49, i1 true, i1 %.not7789
  br i1 %or.cond91, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %46, %53
  %.07290 = phi ptr [ %.072, %53 ], [ %.07288, %46 ]
  %50 = icmp eq ptr %.07290, %1
  br i1 %50, label %53, label %51

51:                                               ; preds = %.lr.ph
  %52 = tail call i32 @ip4_input_accept(ptr noundef nonnull %.07290)
  %.not78 = icmp eq i32 %52, 0
  br i1 %.not78, label %53, label %.thread85

53:                                               ; preds = %51, %.lr.ph
  %.072 = load ptr, ptr %.07290, align 8, !tbaa !27
  %.not77 = icmp eq ptr %.072, null
  br i1 %.not77, label %.thread, label %.lr.ph, !llvm.loop !28

54:                                               ; preds = %44
  %55 = icmp eq ptr %1, null
  br i1 %55, label %.thread, label %.thread85

.thread:                                          ; preds = %53, %40, %36, %46, %54
  %56 = getelementptr inbounds i8, ptr %4, i64 9
  %57 = load i8, ptr %56, align 1, !tbaa !30
  %58 = icmp eq i8 %57, 17
  br i1 %58, label %59, label %.thread85

59:                                               ; preds = %.thread
  %60 = zext nneg i8 %10 to i64
  %61 = getelementptr inbounds i8, ptr %4, i64 %60
  %62 = getelementptr inbounds i8, ptr %61, i64 2
  %63 = load i16, ptr %62, align 1, !tbaa !31
  %64 = icmp eq i16 %63, 17408
  %spec.select = select i1 %64, ptr %1, ptr null
  br label %.thread85

.thread85:                                        ; preds = %51, %40, %.thread, %59, %54
  %.3 = phi ptr [ %spec.select, %59 ], [ null, %.thread ], [ %1, %54 ], [ %1, %40 ], [ %.07290, %51 ]
  %.1 = phi i1 [ %64, %59 ], [ false, %.thread ], [ false, %54 ], [ false, %40 ], [ false, %51 ]
  %65 = load i32, ptr getelementptr inbounds (i8, ptr @ip_data, i64 28), align 4
  %66 = icmp eq i32 %65, 0
  %or.cond4 = select i1 %.1, i1 true, i1 %66
  br i1 %or.cond4, label %75, label %67

67:                                               ; preds = %.thread85
  %68 = tail call zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef %65, ptr noundef %1) #3
  %.not80 = icmp eq i8 %68, 0
  br i1 %.not80, label %69, label %73

69:                                               ; preds = %67
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @ip_data, i64 28), align 4, !tbaa !23
  %71 = and i32 %70, 240
  %72 = icmp eq i32 %71, 224
  br i1 %72, label %73, label %75

73:                                               ; preds = %69, %67
  %74 = tail call zeroext i8 @pbuf_free(ptr noundef %0) #3
  br label %113

75:                                               ; preds = %69, %.thread85
  %76 = icmp eq ptr %.3, null
  br i1 %76, label %77, label %79

77:                                               ; preds = %75
  %78 = tail call zeroext i8 @pbuf_free(ptr noundef %0) #3
  br label %113

79:                                               ; preds = %75
  %80 = getelementptr inbounds i8, ptr %4, i64 6
  %81 = load i16, ptr %80, align 1, !tbaa !33
  %82 = and i16 %81, -193
  %.not81 = icmp eq i16 %82, 0
  br i1 %.not81, label %89, label %83

83:                                               ; preds = %79
  %84 = tail call ptr @ip4_reass(ptr noundef %0) #3
  %85 = icmp eq ptr %84, null
  br i1 %85, label %113, label %86

86:                                               ; preds = %83
  %87 = getelementptr inbounds i8, ptr %84, i64 8
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %86, %79
  %.071 = phi ptr [ %88, %86 ], [ %4, %79 ]
  %.070 = phi ptr [ %84, %86 ], [ %0, %79 ]
  store ptr %.3, ptr @ip_data, align 8, !tbaa !34
  store ptr %1, ptr getelementptr inbounds (i8, ptr @ip_data, i64 8), align 8, !tbaa !35
  store ptr %.071, ptr getelementptr inbounds (i8, ptr @ip_data, i64 16), align 8, !tbaa !36
  %90 = load i8, ptr %.071, align 1, !tbaa !11
  %91 = shl i8 %90, 2
  %92 = and i8 %91, 60
  %93 = zext nneg i8 %92 to i16
  store i16 %93, ptr getelementptr inbounds (i8, ptr @ip_data, i64 24), align 8, !tbaa !37
  %94 = zext nneg i8 %10 to i64
  %95 = tail call zeroext i8 @pbuf_remove_header(ptr noundef %.070, i64 noundef %94) #3
  %96 = getelementptr inbounds i8, ptr %.071, i64 9
  %97 = load i8, ptr %96, align 1, !tbaa !30
  switch i8 %97, label %101 [
    i8 17, label %98
    i8 6, label %99
    i8 1, label %100
  ]

98:                                               ; preds = %89
  tail call void @udp_input(ptr noundef %.070, ptr noundef %1) #3
  br label %112

99:                                               ; preds = %89
  tail call void @tcp_input(ptr noundef %.070, ptr noundef %1) #3
  br label %112

100:                                              ; preds = %89
  tail call void @icmp_input(ptr noundef %.070, ptr noundef %1) #3
  br label %112

101:                                              ; preds = %89
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @ip_data, i64 32), align 8, !tbaa !19
  %103 = tail call zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef %102, ptr noundef nonnull %.3) #3
  %.not82 = icmp eq i8 %103, 0
  br i1 %.not82, label %104, label %110

104:                                              ; preds = %101
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @ip_data, i64 32), align 8, !tbaa !19
  %106 = and i32 %105, 240
  %107 = icmp eq i32 %106, 224
  br i1 %107, label %110, label %108

108:                                              ; preds = %104
  %109 = tail call zeroext i8 @pbuf_header_force(ptr noundef %.070, i16 noundef signext %11) #3
  tail call void @icmp_dest_unreach(ptr noundef %.070, i32 noundef 2) #3
  br label %110

110:                                              ; preds = %108, %104, %101
  %111 = tail call zeroext i8 @pbuf_free(ptr noundef %.070) #3
  br label %112

112:                                              ; preds = %110, %100, %99, %98
  store i32 0, ptr getelementptr inbounds (i8, ptr @ip_data, i64 28), align 4, !tbaa !23
  store i32 0, ptr getelementptr inbounds (i8, ptr @ip_data, i64 32), align 8, !tbaa !19
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(26) @ip_data, i8 0, i64 26, i1 false)
  br label %113

113:                                              ; preds = %83, %112, %77, %73, %27, %7
  ret i8 0
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ip4_input_accept(ptr noundef) local_unnamed_addr #0

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

declare ptr @ip4_reass(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @pbuf_remove_header(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @udp_input(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @tcp_input(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @icmp_input(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i8 @pbuf_header_force(ptr noundef, i16 noundef signext) local_unnamed_addr #1

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

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

attributes #0 = { 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 #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: write) }
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, !7, i64 8}
!6 = !{!"pbuf", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 18, !8, i64 20, !8, i64 21, !8, i64 22, !8, i64 23}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!12, !8, i64 0}
!12 = !{!"ip_hdr", !8, i64 0, !8, i64 1, !10, i64 2, !10, i64 4, !10, i64 6, !8, i64 8, !8, i64 9, !10, i64 10, !13, i64 12, !13, i64 16}
!13 = !{!"ip4_addr_packed", !14, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = !{!12, !10, i64 2}
!16 = !{!6, !10, i64 16}
!17 = !{!6, !10, i64 18}
!18 = !{!12, !14, i64 16}
!19 = !{!20, !14, i64 32}
!20 = !{!"ip_globals", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !21, i64 28, !21, i64 32}
!21 = !{!"ip4_addr", !14, i64 0}
!22 = !{!12, !14, i64 12}
!23 = !{!20, !14, i64 28}
!24 = !{!25, !8, i64 81}
!25 = !{!"netif", !7, i64 0, !21, i64 8, !21, i64 12, !21, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !8, i64 64, !10, i64 72, !8, i64 74, !8, i64 80, !8, i64 81, !8, i64 82, !8, i64 84, !8, i64 85}
!26 = !{!21, !14, i64 0}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!12, !8, i64 9}
!31 = !{!32, !10, i64 2}
!32 = !{!"udp_hdr", !10, i64 0, !10, i64 2, !10, i64 4, !10, i64 6}
!33 = !{!12, !10, i64 6}
!34 = !{!20, !7, i64 0}
!35 = !{!20, !7, i64 8}
!36 = !{!20, !7, i64 16}
!37 = !{!20, !10, i64 24}


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