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

; 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._EFI_NET_SESSION_DATA = type { %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.IP_IO_IP_HEADER, i32, i8 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.IP_IO_IP_HEADER = type { ptr }
%struct._IP_IO = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, i8, i8, %union.IP_IO_IP_COMPLETION_TOKEN, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, i8 }
%union.IP_IO_IP_PROTOCOL = type { ptr }
%union.IP_IO_IP_COMPLETION_TOKEN = type { %struct.EFI_IP4_COMPLETION_TOKEN }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IP6_COMPLETION_TOKEN = type { ptr, i64, %union.anon.0 }
%union.anon.0 = type { ptr }
%struct.EFI_IP4_RECEIVE_DATA = type { %struct.EFI_TIME, ptr, i32, ptr, i32, ptr, i32, i32, [1 x %struct.EFI_IP4_FRAGMENT_DATA] }
%struct.EFI_TIME = type { i16, i8, i8, i8, i8, i8, i8, i32, i16, i8, i8 }
%struct.EFI_IP4_FRAGMENT_DATA = type { i32, ptr }
%struct.EFI_IP4_HEADER = type { i8, i8, i16, i16, i16, i8, i8, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._EFI_IP6_RECEIVE_DATA = type { %struct.EFI_TIME, ptr, i32, ptr, i32, i32, [1 x %struct._EFI_IP6_FRAGMENT_DATA] }
%struct._EFI_IP6_FRAGMENT_DATA = type { i32, ptr }
%struct._EFI_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct._EFI_IP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_IP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@gBS = external global ptr, 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
declare dso_local i64 @IpIoIcmpHandler(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @IpIoExtFree(ptr noundef) #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

declare void @NetbufFree(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @IpIoListenHandlerDpc(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct._EFI_NET_SESSION_DATA, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %9, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._IP_IO, ptr %10, i32 0, i32 14
  %12 = load i8, ptr %11, align 8, !tbaa !9
  %13 = zext i8 %12 to i32
  %14 = icmp eq i32 %13, 4
  br i1 %14, label %15, label %24

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._IP_IO, ptr %16, i32 0, i32 8
  %18 = getelementptr inbounds %struct.EFI_IP4_COMPLETION_TOKEN, ptr %17, i32 0, i32 1
  %19 = load i64, ptr %18, align 8, !tbaa !12
  store i64 %19, ptr %4, align 8, !tbaa !13
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._IP_IO, ptr %20, i32 0, i32 8
  %22 = getelementptr inbounds %struct.EFI_IP4_COMPLETION_TOKEN, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  store ptr %23, ptr %5, align 8, !tbaa !5
  br label %41

24:                                               ; preds = %1
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._IP_IO, ptr %25, i32 0, i32 14
  %27 = load i8, ptr %26, align 8, !tbaa !9
  %28 = zext i8 %27 to i32
  %29 = icmp eq i32 %28, 6
  br i1 %29, label %30, label %39

30:                                               ; preds = %24
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._IP_IO, ptr %31, i32 0, i32 8
  %33 = getelementptr inbounds %struct.EFI_IP6_COMPLETION_TOKEN, ptr %32, i32 0, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !12
  store i64 %34, ptr %4, align 8, !tbaa !13
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._IP_IO, ptr %35, i32 0, i32 8
  %37 = getelementptr inbounds %struct.EFI_IP6_COMPLETION_TOKEN, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  store ptr %38, ptr %5, align 8, !tbaa !5
  br label %40

39:                                               ; preds = %24
  store i32 1, ptr %8, align 4
  br label %249

40:                                               ; preds = %30
  br label %41

41:                                               ; preds = %40, %15
  %42 = load i64, ptr %4, align 8, !tbaa !13
  %43 = icmp eq i64 -9223372036854775787, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store i32 1, ptr %8, align 4
  br label %249

45:                                               ; preds = %41
  %46 = load i64, ptr %4, align 8, !tbaa !13
  %47 = icmp ne i64 0, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %45
  %49 = load i64, ptr %4, align 8, !tbaa !13
  %50 = icmp ne i64 -9223372036854775786, %49
  br i1 %50, label %54, label %51

51:                                               ; preds = %48, %45
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = icmp eq ptr null, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %51, %48
  br label %218

55:                                               ; preds = %51
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._IP_IO, ptr %56, i32 0, i32 12
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  %59 = icmp eq ptr null, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %55
  br label %195

61:                                               ; preds = %55
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._IP_IO, ptr %62, i32 0, i32 14
  %64 = load i8, ptr %63, align 8, !tbaa !9
  %65 = zext i8 %64 to i32
  %66 = icmp eq i32 %65, 4
  br i1 %66, label %67, label %130

67:                                               ; preds = %61
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !12
  %71 = getelementptr inbounds %struct.EFI_IP4_HEADER, ptr %70, i32 0, i32 8
  %72 = getelementptr inbounds %struct.EFI_IPv4_ADDRESS, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds [4 x i8], ptr %72, i64 0, i64 0
  %74 = load i32, ptr %73, align 1, !tbaa !16
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %88

76:                                               ; preds = %67
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %77, i32 0, i32 3
  %79 = load ptr, ptr %78, align 8, !tbaa !18
  %80 = getelementptr inbounds %struct.EFI_IP4_HEADER, ptr %79, i32 0, i32 8
  %81 = getelementptr inbounds %struct.EFI_IPv4_ADDRESS, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds [4 x i8], ptr %81, i64 0, i64 0
  %83 = load i32, ptr %82, align 1, !tbaa !16
  %84 = call i32 @SwapBytes32(i32 noundef %83)
  %85 = call zeroext i8 @NetIp4IsUnicast(i32 noundef %84, i32 noundef 0)
  %86 = icmp ne i8 %85, 0
  br i1 %86, label %88, label %87

87:                                               ; preds = %76
  br label %195

88:                                               ; preds = %76, %67
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %89, i32 0, i32 8
  %91 = getelementptr inbounds [1 x %struct.EFI_IP4_FRAGMENT_DATA], ptr %90, i64 0, i64 0
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %92, i32 0, i32 7
  %94 = load i32, ptr %93, align 4, !tbaa !12
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %95, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !12
  %98 = call ptr @NetbufFromExt(ptr noundef %91, i32 noundef %94, i32 noundef 0, i32 noundef 0, ptr noundef @IpIoExtFree, ptr noundef %97)
  store ptr %98, ptr %7, align 8, !tbaa !5
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = icmp eq ptr null, %99
  br i1 %100, label %101, label %102

101:                                              ; preds = %88
  br label %195

102:                                              ; preds = %88
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %103, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !12
  %106 = getelementptr inbounds %struct.EFI_IP4_HEADER, ptr %105, i32 0, i32 8
  %107 = getelementptr inbounds %struct.EFI_IPv4_ADDRESS, ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds [4 x i8], ptr %107, i64 0, i64 0
  %109 = load i32, ptr %108, align 1, !tbaa !16
  %110 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 0
  %111 = getelementptr inbounds [4 x i32], ptr %110, i64 0, i64 0
  store i32 %109, ptr %111, align 8, !tbaa !12
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %112, i32 0, i32 3
  %114 = load ptr, ptr %113, align 8, !tbaa !12
  %115 = getelementptr inbounds %struct.EFI_IP4_HEADER, ptr %114, i32 0, i32 9
  %116 = getelementptr inbounds %struct.EFI_IPv4_ADDRESS, ptr %115, i32 0, i32 0
  %117 = getelementptr inbounds [4 x i8], ptr %116, i64 0, i64 0
  %118 = load i32, ptr %117, align 1, !tbaa !16
  %119 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 1
  %120 = getelementptr inbounds [4 x i32], ptr %119, i64 0, i64 0
  store i32 %118, ptr %120, align 8, !tbaa !12
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %121, i32 0, i32 3
  %123 = load ptr, ptr %122, align 8, !tbaa !12
  %124 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 2
  store ptr %123, ptr %124, align 8, !tbaa !12
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 8, !tbaa !12
  %128 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 3
  store i32 %127, ptr %128, align 8, !tbaa !22
  %129 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 4
  store i8 4, ptr %129, align 4, !tbaa !24
  br label %174

130:                                              ; preds = %61
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %131, i32 0, i32 3
  %133 = load ptr, ptr %132, align 8, !tbaa !12
  %134 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %133, i32 0, i32 5
  %135 = call zeroext i8 @NetIp6IsValidUnicast(ptr noundef %134)
  %136 = icmp ne i8 %135, 0
  br i1 %136, label %138, label %137

137:                                              ; preds = %130
  br label %195

138:                                              ; preds = %130
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %139, i32 0, i32 6
  %141 = getelementptr inbounds [1 x %struct._EFI_IP6_FRAGMENT_DATA], ptr %140, i64 0, i64 0
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %142, i32 0, i32 5
  %144 = load i32, ptr %143, align 4, !tbaa !12
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %145, i32 0, i32 1
  %147 = load ptr, ptr %146, align 8, !tbaa !12
  %148 = call ptr @NetbufFromExt(ptr noundef %141, i32 noundef %144, i32 noundef 0, i32 noundef 0, ptr noundef @IpIoExtFree, ptr noundef %147)
  store ptr %148, ptr %7, align 8, !tbaa !5
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = icmp eq ptr null, %149
  br i1 %150, label %151, label %152

151:                                              ; preds = %138
  br label %195

152:                                              ; preds = %138
  %153 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 0
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %154, i32 0, i32 3
  %156 = load ptr, ptr %155, align 8, !tbaa !12
  %157 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %156, i32 0, i32 5
  %158 = call ptr @CopyMem(ptr noundef %153, ptr noundef %157, i64 noundef 16)
  %159 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 1
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %160, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !12
  %163 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %162, i32 0, i32 6
  %164 = call ptr @CopyMem(ptr noundef %159, ptr noundef %163, i64 noundef 16)
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %165, i32 0, i32 3
  %167 = load ptr, ptr %166, align 8, !tbaa !12
  %168 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 2
  store ptr %167, ptr %168, align 8, !tbaa !12
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %169, i32 0, i32 2
  %171 = load i32, ptr %170, align 8, !tbaa !12
  %172 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 3
  store i32 %171, ptr %172, align 8, !tbaa !22
  %173 = getelementptr inbounds %struct._EFI_NET_SESSION_DATA, ptr %6, i32 0, i32 4
  store i8 6, ptr %173, align 4, !tbaa !24
  br label %174

174:                                              ; preds = %152, %102
  %175 = load i64, ptr %4, align 8, !tbaa !13
  %176 = icmp eq i64 0, %175
  br i1 %176, label %177, label %185

177:                                              ; preds = %174
  %178 = load ptr, ptr %3, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._IP_IO, ptr %178, i32 0, i32 12
  %180 = load ptr, ptr %179, align 8, !tbaa !15
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = load ptr, ptr %3, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct._IP_IO, ptr %182, i32 0, i32 10
  %184 = load ptr, ptr %183, align 8, !tbaa !25
  call void %180(i64 noundef 0, i8 noundef zeroext 0, ptr noundef %6, ptr noundef %181, ptr noundef %184)
  br label %194

185:                                              ; preds = %174
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = call i64 @IpIoIcmpHandler(ptr noundef %186, ptr noundef %187, ptr noundef %6)
  store i64 %188, ptr %4, align 8, !tbaa !13
  %189 = load i64, ptr %4, align 8, !tbaa !13
  %190 = icmp slt i64 %189, 0
  br i1 %190, label %191, label %193

191:                                              ; preds = %185
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %192)
  br label %193

193:                                              ; preds = %191, %185
  br label %194

194:                                              ; preds = %193, %177
  br label %218

195:                                              ; preds = %151, %137, %101, %87, %60
  %196 = load ptr, ptr %3, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct._IP_IO, ptr %196, i32 0, i32 14
  %198 = load i8, ptr %197, align 8, !tbaa !9
  %199 = zext i8 %198 to i32
  %200 = icmp eq i32 %199, 4
  br i1 %200, label %201, label %209

201:                                              ; preds = %195
  %202 = load ptr, ptr @gBS, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %202, i32 0, i32 11
  %204 = load ptr, ptr %203, align 8, !tbaa !26
  %205 = load ptr, ptr %5, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.EFI_IP4_RECEIVE_DATA, ptr %205, i32 0, i32 1
  %207 = load ptr, ptr %206, align 8, !tbaa !12
  %208 = call i64 %204(ptr noundef %207)
  br label %217

209:                                              ; preds = %195
  %210 = load ptr, ptr @gBS, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %210, i32 0, i32 11
  %212 = load ptr, ptr %211, align 8, !tbaa !26
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct._EFI_IP6_RECEIVE_DATA, ptr %213, i32 0, i32 1
  %215 = load ptr, ptr %214, align 8, !tbaa !12
  %216 = call i64 %212(ptr noundef %215)
  br label %217

217:                                              ; preds = %209, %201
  br label %218

218:                                              ; preds = %217, %194, %54
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct._IP_IO, ptr %219, i32 0, i32 14
  %221 = load i8, ptr %220, align 8, !tbaa !9
  %222 = zext i8 %221 to i32
  %223 = icmp eq i32 %222, 4
  br i1 %223, label %224, label %236

224:                                              ; preds = %218
  %225 = load ptr, ptr %3, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct._IP_IO, ptr %225, i32 0, i32 5
  %227 = load ptr, ptr %226, align 8, !tbaa !12
  %228 = getelementptr inbounds %struct._EFI_IP4_PROTOCOL, ptr %227, i32 0, i32 5
  %229 = load ptr, ptr %228, align 8, !tbaa !29
  %230 = load ptr, ptr %3, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct._IP_IO, ptr %230, i32 0, i32 5
  %232 = load ptr, ptr %231, align 8, !tbaa !12
  %233 = load ptr, ptr %3, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct._IP_IO, ptr %233, i32 0, i32 8
  %235 = call i64 %229(ptr noundef %232, ptr noundef %234)
  br label %248

236:                                              ; preds = %218
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct._IP_IO, ptr %237, i32 0, i32 5
  %239 = load ptr, ptr %238, align 8, !tbaa !12
  %240 = getelementptr inbounds %struct._EFI_IP6_PROTOCOL, ptr %239, i32 0, i32 6
  %241 = load ptr, ptr %240, align 8, !tbaa !31
  %242 = load ptr, ptr %3, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct._IP_IO, ptr %242, i32 0, i32 5
  %244 = load ptr, ptr %243, align 8, !tbaa !12
  %245 = load ptr, ptr %3, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct._IP_IO, ptr %245, i32 0, i32 8
  %247 = call i64 %241(ptr noundef %244, ptr noundef %246)
  br label %248

248:                                              ; preds = %236, %224
  store i32 0, ptr %8, align 4
  br label %249

249:                                              ; preds = %248, %44, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %250 = load i32, ptr %8, align 4
  switch i32 %250, label %252 [
    i32 0, label %251
    i32 1, label %251
  ]

251:                                              ; preds = %249, %249
  ret void

252:                                              ; preds = %249
  unreachable
}

declare zeroext i8 @NetIp4IsUnicast(i32 noundef, i32 noundef) #2

declare i32 @SwapBytes32(i32 noundef) #2

declare ptr @NetbufFromExt(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #2

declare zeroext i8 @NetIp6IsValidUnicast(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !7, i64 144}
!10 = !{!"_IP_IO", !11, i64 0, !11, i64 16, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !7, i64 64, !7, i64 65, !7, i64 72, !11, i64 96, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!11 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!10, !6, i64 128}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !6, i64 32}
!19 = !{!"", !20, i64 0, !6, i64 16, !17, i64 24, !6, i64 32, !17, i64 40, !6, i64 48, !17, i64 56, !17, i64 60, !7, i64 64}
!20 = !{!"", !21, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !17, i64 8, !21, i64 12, !7, i64 14, !7, i64 15}
!21 = !{!"short", !7, i64 0}
!22 = !{!23, !17, i64 40}
!23 = !{!"_EFI_NET_SESSION_DATA", !7, i64 0, !7, i64 16, !7, i64 32, !17, i64 40, !7, i64 44}
!24 = !{!23, !7, i64 44}
!25 = !{!10, !6, i64 112}
!26 = !{!27, !6, i64 104}
!27 = !{!"", !28, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !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, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!28 = !{!"", !14, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!29 = !{!30, !6, i64 40}
!30 = !{!"_EFI_IP4_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!31 = !{!32, !6, i64 48}
!32 = !{!"_EFI_IP6_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}


; 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._EFI_NET_SESSION_DATA = type { %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.IP_IO_IP_HEADER, i32, i8 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.IP_IO_IP_HEADER = type { ptr }

@gBS = external local_unnamed_addr global ptr, align 8

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @IpIoExtFree(ptr noundef) #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @NetbufFree(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @IpIoListenHandlerDpc(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca %struct._EFI_NET_SESSION_DATA, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 144
  %4 = load i8, ptr %3, align 8, !tbaa !5
  switch i8 %4, label %90 [
    i8 4, label %5
    i8 6, label %5
  ]

5:                                                ; preds = %1, %1
  %.052.in = getelementptr inbounds i8, ptr %0, i64 88
  %.052 = load ptr, ptr %.052.in, align 8, !tbaa !11
  %.053.in = getelementptr inbounds i8, ptr %0, i64 80
  %.053 = load i64, ptr %.053.in, align 8, !tbaa !11
  %6 = icmp eq i64 %.053, -9223372036854775787
  br i1 %6, label %90, label %7

7:                                                ; preds = %5
  %8 = icmp ne i64 %.053, 0
  %9 = icmp ne i64 %.053, -9223372036854775786
  %or.cond = and i1 %8, %9
  %10 = icmp eq ptr %.052, null
  %or.cond3 = select i1 %or.cond, i1 true, i1 %10
  br i1 %or.cond3, label %.sink.split, label %11

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 128
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = icmp eq ptr %13, null
  br i1 %14, label %75, label %15

15:                                               ; preds = %11
  %16 = icmp eq i8 %4, 4
  %17 = getelementptr inbounds i8, ptr %.052, i64 32
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  br i1 %16, label %19, label %40

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %18, i64 12
  %21 = load i32, ptr %20, align 1, !tbaa !13
  %.not58 = icmp eq i32 %21, 0
  br i1 %.not58, label %25, label %22

22:                                               ; preds = %19
  %23 = tail call i32 @SwapBytes32(i32 noundef %21) #3
  %24 = tail call zeroext i8 @NetIp4IsUnicast(i32 noundef %23, i32 noundef 0) #3
  %.not59 = icmp eq i8 %24, 0
  br i1 %.not59, label %75, label %25

25:                                               ; preds = %22, %19
  %26 = getelementptr inbounds i8, ptr %.052, i64 64
  %27 = getelementptr inbounds i8, ptr %.052, i64 60
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %.052, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = tail call ptr @NetbufFromExt(ptr noundef nonnull %26, i32 noundef %28, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @IpIoExtFree, ptr noundef %30) #3
  %32 = icmp eq ptr %31, null
  br i1 %32, label %75, label %33

33:                                               ; preds = %25
  %34 = load ptr, ptr %17, align 8, !tbaa !11
  %35 = getelementptr inbounds i8, ptr %34, i64 12
  %36 = load i32, ptr %35, align 1, !tbaa !13
  store i32 %36, ptr %2, align 8, !tbaa !11
  %37 = getelementptr inbounds i8, ptr %34, i64 16
  %38 = load i32, ptr %37, align 1, !tbaa !13
  %39 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 %38, ptr %39, align 8, !tbaa !11
  br label %60

40:                                               ; preds = %15
  %41 = getelementptr inbounds i8, ptr %18, i64 8
  %42 = tail call zeroext i8 @NetIp6IsValidUnicast(ptr noundef nonnull %41) #3
  %.not = icmp eq i8 %42, 0
  br i1 %.not, label %75, label %43

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %.052, i64 48
  %45 = getelementptr inbounds i8, ptr %.052, i64 44
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = getelementptr inbounds i8, ptr %.052, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = tail call ptr @NetbufFromExt(ptr noundef nonnull %44, i32 noundef %46, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @IpIoExtFree, ptr noundef %48) #3
  %50 = icmp eq ptr %49, null
  br i1 %50, label %75, label %51

51:                                               ; preds = %43
  %52 = load ptr, ptr %17, align 8, !tbaa !11
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = call ptr @CopyMem(ptr noundef nonnull %2, ptr noundef nonnull %53, i64 noundef 16) #3
  %55 = getelementptr inbounds i8, ptr %2, i64 16
  %56 = load ptr, ptr %17, align 8, !tbaa !11
  %57 = getelementptr inbounds i8, ptr %56, i64 24
  %58 = call ptr @CopyMem(ptr noundef nonnull %55, ptr noundef nonnull %57, i64 noundef 16) #3
  %59 = load ptr, ptr %17, align 8, !tbaa !11
  br label %60

60:                                               ; preds = %51, %33
  %.sink64 = phi ptr [ %59, %51 ], [ %34, %33 ]
  %.sink = phi i8 [ 6, %51 ], [ 4, %33 ]
  %.0 = phi ptr [ %49, %51 ], [ %31, %33 ]
  %61 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr %.sink64, ptr %61, align 8, !tbaa !11
  %62 = getelementptr inbounds i8, ptr %.052, i64 24
  %63 = load i32, ptr %62, align 8, !tbaa !11
  %64 = getelementptr inbounds i8, ptr %2, i64 40
  store i32 %63, ptr %64, align 8, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %2, i64 44
  store i8 %.sink, ptr %65, align 4, !tbaa !17
  %66 = icmp eq i64 %.053, 0
  br i1 %66, label %67, label %71

67:                                               ; preds = %60
  %68 = load ptr, ptr %12, align 8, !tbaa !12
  %69 = getelementptr inbounds i8, ptr %0, i64 112
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  call void %68(i64 noundef 0, i8 noundef zeroext 0, ptr noundef nonnull %2, ptr noundef nonnull %.0, ptr noundef %70) #3
  br label %.sink.split

71:                                               ; preds = %60
  %72 = call i64 @IpIoIcmpHandler(ptr noundef nonnull %0, ptr noundef nonnull %.0, ptr noundef nonnull %2)
  %73 = icmp slt i64 %72, 0
  br i1 %73, label %74, label %.sink.split

74:                                               ; preds = %71
  call void @NetbufFree(ptr noundef nonnull %.0) #3
  br label %.sink.split

75:                                               ; preds = %43, %40, %25, %22, %11
  %76 = load ptr, ptr @gBS, align 8, !tbaa !19
  %77 = getelementptr inbounds i8, ptr %76, i64 104
  %78 = load ptr, ptr %77, align 8, !tbaa !20
  %79 = getelementptr inbounds i8, ptr %.052, i64 16
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  %81 = tail call i64 %78(ptr noundef %80) #3
  br label %.sink.split

.sink.split:                                      ; preds = %75, %67, %74, %71, %7
  %82 = load i8, ptr %3, align 8, !tbaa !5
  %83 = icmp eq i8 %82, 4
  %84 = getelementptr inbounds i8, ptr %0, i64 56
  %85 = load ptr, ptr %84, align 8, !tbaa !11
  %86 = getelementptr inbounds i8, ptr %0, i64 72
  %. = select i1 %83, i64 40, i64 48
  %87 = getelementptr inbounds i8, ptr %85, i64 %.
  %88 = load ptr, ptr %87, align 8, !tbaa !19
  %89 = call i64 %88(ptr noundef %85, ptr noundef nonnull %86) #3
  br label %90

90:                                               ; preds = %.sink.split, %5, %1
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #3
  ret void
}

declare zeroext i8 @NetIp4IsUnicast(i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #2

declare ptr @NetbufFromExt(ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !9, i64 144}
!6 = !{!"_IP_IO", !7, i64 0, !7, i64 16, !8, i64 32, !8, i64 40, !8, i64 48, !9, i64 56, !9, i64 64, !9, i64 65, !9, i64 72, !7, i64 96, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !9, i64 144}
!7 = !{!"_LIST_ENTRY", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!9, !9, i64 0}
!12 = !{!6, !8, i64 128}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !9, i64 0}
!15 = !{!16, !14, i64 40}
!16 = !{!"_EFI_NET_SESSION_DATA", !9, i64 0, !9, i64 16, !9, i64 32, !14, i64 40, !9, i64 44}
!17 = !{!16, !9, i64 44}
!18 = !{!6, !8, i64 112}
!19 = !{!8, !8, i64 0}
!20 = !{!21, !8, i64 104}
!21 = !{!"", !22, i64 0, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !8, i64 160, !8, i64 168, !8, i64 176, !8, i64 184, !8, i64 192, !8, i64 200, !8, i64 208, !8, i64 216, !8, i64 224, !8, i64 232, !8, i64 240, !8, i64 248, !8, i64 256, !8, i64 264, !8, i64 272, !8, i64 280, !8, i64 288, !8, i64 296, !8, i64 304, !8, i64 312, !8, i64 320, !8, i64 328, !8, i64 336, !8, i64 344, !8, i64 352, !8, i64 360, !8, i64 368}
!22 = !{!"", !23, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!23 = !{!"long long", !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass