; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/UefiPxeBcDxe_ (PxeBcDhcp4CallBack)

; 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._PXEBC_PRIVATE_DATA = type { i32, ptr, ptr, %struct._PXEBC_PRIVATE_PROTOCOL, 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_PXE_BASE_CODE_PROTOCOL, %struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL, ptr, ptr, %struct.EFI_PXE_BASE_CODE_MODE, i32, i32, i32, i64, %struct.EFI_UDP4_CONFIG_DATA, %struct.EFI_UDP6_CONFIG_DATA, %struct.EFI_IP4_CONFIG_DATA, %struct.EFI_IP6_CONFIG_DATA, ptr, ptr, %struct.EFI_IP4_COMPLETION_TOKEN, %struct.EFI_IP6_COMPLETION_TOKEN, i8, i8, i8, i8, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, i16, i32, i32, i32, ptr, i64, i64, %union.PXEBC_DHCP_PACKET_CACHE, %union.PXEBC_DHCP_PACKET_CACHE, %union.PXEBC_DHCP_PACKET_CACHE, ptr, %struct.EFI_DHCP4_PACKET, i32, i32, [16 x %union.PXEBC_DHCP_PACKET_CACHE], i32, [8 x i32], [8 x [16 x i32]] }
%struct._PXEBC_PRIVATE_PROTOCOL = type { i64 }
%struct._EFI_PXE_BASE_CODE_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL = type { i64, ptr }
%struct.EFI_PXE_BASE_CODE_MODE = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %struct.EFI_PXE_BASE_CODE_IP_FILTER, i32, [8 x %struct.EFI_PXE_BASE_CODE_ARP_ENTRY], i32, [8 x %struct.EFI_PXE_BASE_CODE_ROUTE_ENTRY], %struct.EFI_PXE_BASE_CODE_ICMP_ERROR, %struct.EFI_PXE_BASE_CODE_TFTP_ERROR }
%union.EFI_PXE_BASE_CODE_PACKET = type { %struct.EFI_PXE_BASE_CODE_DHCPV6_PACKET, [444 x i8] }
%struct.EFI_PXE_BASE_CODE_DHCPV6_PACKET = type { i32, [1024 x i8] }
%struct.EFI_PXE_BASE_CODE_IP_FILTER = type { i8, i8, i16, [8 x %union.EFI_IP_ADDRESS] }
%struct.EFI_PXE_BASE_CODE_ARP_ENTRY = type { %union.EFI_IP_ADDRESS, %struct.EFI_MAC_ADDRESS }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_PXE_BASE_CODE_ROUTE_ENTRY = type { %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS }
%struct.EFI_PXE_BASE_CODE_ICMP_ERROR = type { i8, i8, i16, %union.anon, [494 x i8] }
%union.anon = type { i32 }
%struct.EFI_PXE_BASE_CODE_TFTP_ERROR = type { i8, [127 x i8] }
%struct.EFI_UDP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.EFI_UDP6_CONFIG_DATA = type { i8, i8, i8, i8, i8, i32, i32, %struct.EFI_IPv6_ADDRESS, i16, %struct.EFI_IPv6_ADDRESS, i16 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_IP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, i8, i8, i8, i32, i32 }
%struct.EFI_IP6_CONFIG_DATA = type { i8, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32, i32 }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon.0 }
%union.anon.0 = type { ptr }
%struct.EFI_IP6_COMPLETION_TOKEN = type { ptr, i64, %union.anon.1 }
%union.anon.1 = type { ptr }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.PXEBC_DHCP_PACKET_CACHE = type { %struct.PXEBC_DHCP4_PACKET_CACHE }
%struct.PXEBC_DHCP4_PACKET_CACHE = type { %union.PXEBC_DHCP4_PACKET, i32, [7 x ptr], %struct.PXEBC_VENDOR_OPTION }
%union.PXEBC_DHCP4_PACKET = type { [1472 x i8] }
%struct.PXEBC_VENDOR_OPTION = type { [8 x i32], %struct.EFI_IPv4_ADDRESS, i16, i16, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16, i16, ptr, i8, ptr, i8, ptr, i8, ptr, i8 }
%struct.EFI_DHCP4_PACKET = type <{ i32, i32, %struct.anon.2 }>
%struct.anon.2 = type <{ %struct.EFI_DHCP4_HEADER, i32, [1 x i8] }>
%struct.EFI_DHCP4_HEADER = type { i8, i8, i8, i8, i32, i16, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, [16 x i8], [64 x i8], [128 x i8] }
%struct.EFI_DHCP4_PACKET_OPTION = type { i8, i8, [1 x i8] }

@.str = external hidden unnamed_addr constant [138 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @PxeBcParseDhcp4Options(ptr noundef, i32 noundef, i8 noundef zeroext) #0

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

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

declare zeroext i8 @DebugAssertEnabled() #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #2

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

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

declare i64 @NetLibGetSystemGuid(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcCopyDhcp4Ack(ptr noundef, ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcCacheDhcp4Offer(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcSelectDhcp4Offer(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @PxeBcDhcp4CallBack(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i16, align 2
  %19 = alloca i64, align 8
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #3
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 2
  br i1 %23, label %24, label %34

24:                                               ; preds = %6
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 3
  br i1 %26, label %27, label %34

27:                                               ; preds = %24
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 1
  br i1 %29, label %30, label %34

30:                                               ; preds = %27
  %31 = load i32, ptr %11, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 5
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i64 0, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %183

34:                                               ; preds = %30, %27, %24, %6
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %35, ptr %14, align 8, !tbaa !5
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %36, i32 0, i32 31
  %38 = getelementptr inbounds %struct._EFI_PXE_BASE_CODE_PROTOCOL, ptr %37, i32 0, i32 13
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  store ptr %39, ptr %15, align 8, !tbaa !5
  %40 = load ptr, ptr %14, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %40, i32 0, i32 33
  %42 = load ptr, ptr %41, align 8, !tbaa !31
  store ptr %42, ptr %16, align 8, !tbaa !5
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %43, i32 0, i32 2
  %45 = getelementptr inbounds %struct.anon.2, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds [1 x i8], ptr %45, i64 0, i64 0
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 1, !tbaa !32
  %50 = zext i32 %49 to i64
  %51 = sub i64 %50, 236
  %52 = sub i64 %51, 4
  %53 = trunc i64 %52 to i32
  %54 = call ptr @PxeBcParseDhcp4Options(ptr noundef %46, i32 noundef %53, i8 noundef zeroext 57)
  store ptr %54, ptr %17, align 8, !tbaa !5
  %55 = load ptr, ptr %17, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %63

57:                                               ; preds = %34
  %58 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 1464)
  store i16 %58, ptr %18, align 2, !tbaa !33
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.EFI_DHCP4_PACKET_OPTION, ptr %59, i32 0, i32 2
  %61 = getelementptr inbounds [1 x i8], ptr %60, i64 0, i64 0
  %62 = call ptr @CopyMem(ptr noundef %61, ptr noundef %18, i64 noundef 2)
  br label %63

63:                                               ; preds = %57, %34
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 3
  br i1 %65, label %66, label %98

66:                                               ; preds = %63
  %67 = load ptr, ptr %16, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %98

69:                                               ; preds = %66
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = icmp eq i32 %70, 2
  br i1 %71, label %75, label %72

72:                                               ; preds = %69
  %73 = load i32, ptr %11, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 5
  br label %75

75:                                               ; preds = %72, %69
  %76 = phi i1 [ true, %69 ], [ %74, %72 ]
  %77 = zext i1 %76 to i32
  %78 = trunc i32 %77 to i8
  store i8 %78, ptr %20, align 1, !tbaa !34
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL, ptr %79, i32 0, i32 1
  %81 = load ptr, ptr %80, align 8, !tbaa !35
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %83, i32 0, i32 36
  %85 = load i32, ptr %84, align 8, !tbaa !36
  %86 = load i8, ptr %20, align 1, !tbaa !34
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 1, !tbaa !32
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %90, i32 0, i32 2
  %92 = call i32 %81(ptr noundef %82, i32 noundef %85, i8 noundef zeroext %86, i32 noundef %89, ptr noundef %91)
  %93 = zext i32 %92 to i64
  store i64 %93, ptr %19, align 8, !tbaa !37
  %94 = load i64, ptr %19, align 8, !tbaa !37
  %95 = icmp ne i64 %94, 1
  br i1 %95, label %96, label %97

96:                                               ; preds = %75
  store i64 -9223372036854775787, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %183

97:                                               ; preds = %75
  br label %98

98:                                               ; preds = %97, %66, %63
  store i64 0, ptr %19, align 8, !tbaa !37
  %99 = load i32, ptr %11, align 4, !tbaa !9
  switch i32 %99, label %180 [
    i32 1, label %100
    i32 4, label %110
    i32 2, label %136
    i32 3, label %145
    i32 5, label %164
  ]

100:                                              ; preds = %98
  %101 = load ptr, ptr %15, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %101, i32 0, i32 21
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %105, i32 0, i32 1
  %107 = load i32, ptr %106, align 1, !tbaa !32
  %108 = zext i32 %107 to i64
  %109 = call ptr @CopyMem(ptr noundef %102, ptr noundef %104, i64 noundef %108)
  br label %110

110:                                              ; preds = %100, %98
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %111, i32 0, i32 7
  %113 = load i8, ptr %112, align 1, !tbaa !38
  %114 = icmp ne i8 %113, 0
  br i1 %114, label %115, label %135

115:                                              ; preds = %110
  %116 = load ptr, ptr %12, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %116, i32 0, i32 2
  %118 = getelementptr inbounds %struct.anon.2, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %118, i32 0, i32 11
  %120 = getelementptr inbounds [16 x i8], ptr %119, i64 0, i64 0
  %121 = call i64 @NetLibGetSystemGuid(ptr noundef %120)
  %122 = icmp slt i64 %121, 0
  br i1 %122, label %123, label %130

123:                                              ; preds = %115
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %124, i32 0, i32 2
  %126 = getelementptr inbounds %struct.anon.2, ptr %125, i32 0, i32 0
  %127 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %126, i32 0, i32 11
  %128 = getelementptr inbounds [16 x i8], ptr %127, i64 0, i64 0
  %129 = call ptr @ZeroMem(ptr noundef %128, i64 noundef 16)
  br label %130

130:                                              ; preds = %123, %115
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %131, i32 0, i32 2
  %133 = getelementptr inbounds %struct.anon.2, ptr %132, i32 0, i32 0
  %134 = getelementptr inbounds %struct.EFI_DHCP4_HEADER, ptr %133, i32 0, i32 2
  store i8 16, ptr %134, align 1, !tbaa !39
  br label %135

135:                                              ; preds = %130, %110
  br label %181

136:                                              ; preds = %98
  store i64 -9223372036854775802, ptr %19, align 8, !tbaa !37
  %137 = load ptr, ptr %14, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %137, i32 0, i32 71
  %139 = load i32, ptr %138, align 8, !tbaa !40
  %140 = icmp ult i32 %139, 16
  br i1 %140, label %141, label %144

141:                                              ; preds = %136
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  call void @PxeBcCacheDhcp4Offer(ptr noundef %142, ptr noundef %143)
  br label %144

144:                                              ; preds = %141, %136
  br label %181

145:                                              ; preds = %98
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  call void @PxeBcSelectDhcp4Offer(ptr noundef %146)
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %147, i32 0, i32 68
  %149 = load i32, ptr %148, align 4, !tbaa !41
  %150 = icmp eq i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %145
  store i64 -9223372036854775787, ptr %19, align 8, !tbaa !37
  br label %163

152:                                              ; preds = %145
  %153 = load ptr, ptr %14, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %153, i32 0, i32 70
  %155 = load ptr, ptr %14, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %155, i32 0, i32 68
  %157 = load i32, ptr %156, align 4, !tbaa !41
  %158 = sub i32 %157, 1
  %159 = zext i32 %158 to i64
  %160 = getelementptr inbounds [16 x %union.PXEBC_DHCP_PACKET_CACHE], ptr %154, i64 0, i64 %159
  %161 = getelementptr inbounds %struct.PXEBC_DHCP4_PACKET_CACHE, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %161, ptr %162, align 8, !tbaa !5
  br label %163

163:                                              ; preds = %152, %151
  br label %181

164:                                              ; preds = %98
  br label %165

165:                                              ; preds = %164
  %166 = call zeroext i8 @DebugAssertEnabled()
  %167 = icmp ne i8 %166, 0
  br i1 %167, label %168, label %175

168:                                              ; preds = %165
  %169 = load ptr, ptr %14, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %169, i32 0, i32 68
  %171 = load i32, ptr %170, align 4, !tbaa !41
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %174, label %173

173:                                              ; preds = %168
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1260, ptr noundef @.str.15)
  br label %174

174:                                              ; preds = %173, %168
  br label %175

175:                                              ; preds = %174, %165
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  %178 = load ptr, ptr %14, align 8, !tbaa !5
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  call void @PxeBcCopyDhcp4Ack(ptr noundef %178, ptr noundef %179, i8 noundef zeroext 0)
  br label %181

180:                                              ; preds = %98
  br label %181

181:                                              ; preds = %180, %177, %163, %144, %135
  %182 = load i64, ptr %19, align 8, !tbaa !37
  store i64 %182, ptr %7, align 8
  store i32 1, ptr %21, align 4
  br label %183

183:                                              ; preds = %181, %96, %33
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %184 = load i64, ptr %7, align 8
  ret i64 %184
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 352}
!12 = !{!"_PXEBC_PRIVATE_DATA", !10, i64 0, !6, i64 8, !6, i64 16, !13, 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, !15, i64 248, !16, i64 360, !6, i64 376, !6, i64 384, !17, i64 392, !10, i64 10816, !10, i64 10820, !10, i64 10824, !14, i64 10832, !22, i64 10840, !24, i64 10876, !25, i64 10928, !26, i64 10956, !6, i64 11008, !6, i64 11016, !27, i64 11024, !27, i64 11048, !7, i64 11072, !7, i64 11073, !7, i64 11074, !7, i64 11075, !7, i64 11076, !7, i64 11092, !7, i64 11108, !7, i64 11124, !19, i64 11140, !10, i64 11144, !10, i64 11148, !10, i64 11152, !6, i64 11160, !14, i64 11168, !14, i64 11176, !7, i64 11184, !7, i64 12848, !7, i64 14512, !6, i64 16176, !28, i64 16184, !10, i64 16436, !10, i64 16440, !7, i64 16448, !10, i64 43072, !7, i64 43076, !7, i64 43108}
!13 = !{!"_PXEBC_PRIVATE_PROTOCOL", !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"_EFI_PXE_BASE_CODE_PROTOCOL", !14, 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, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!16 = !{!"_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL", !14, i64 0, !6, i64 8}
!17 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 20, !7, i64 36, !7, i64 52, !7, i64 1524, !7, i64 2996, !7, i64 4468, !7, i64 5940, !7, i64 7412, !18, i64 8884, !10, i64 9016, !7, i64 9020, !10, i64 9404, !7, i64 9408, !20, i64 9792, !21, i64 10296}
!18 = !{!"", !7, i64 0, !7, i64 1, !19, i64 2, !7, i64 4}
!19 = !{!"short", !7, i64 0}
!20 = !{!"", !7, i64 0, !7, i64 1, !19, i64 2, !7, i64 4, !7, i64 8}
!21 = !{!"", !7, i64 0, !7, i64 1}
!22 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !10, i64 8, !10, i64 12, !7, i64 16, !23, i64 17, !23, i64 21, !19, i64 26, !23, i64 28, !19, i64 32}
!23 = !{!"", !7, i64 0}
!24 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !10, i64 8, !10, i64 12, !23, i64 16, !19, i64 32, !23, i64 34, !19, i64 50}
!25 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !23, i64 6, !23, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !10, i64 20, !10, i64 24}
!26 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !23, i64 4, !23, i64 20, !7, i64 36, !7, i64 37, !10, i64 40, !10, i64 44, !10, i64 48}
!27 = !{!"", !6, i64 0, !14, i64 8, !7, i64 16}
!28 = !{!"", !10, i64 0, !10, i64 4, !29, i64 8}
!29 = !{!"", !30, i64 0, !10, i64 236, !7, i64 240}
!30 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !10, i64 4, !19, i64 8, !19, i64 10, !23, i64 12, !23, i64 16, !23, i64 20, !23, i64 24, !7, i64 28, !7, i64 44, !7, i64 108}
!31 = !{!12, !6, i64 376}
!32 = !{!28, !10, i64 4}
!33 = !{!19, !19, i64 0}
!34 = !{!7, !7, i64 0}
!35 = !{!16, !6, i64 8}
!36 = !{!12, !10, i64 10816}
!37 = !{!14, !14, i64 0}
!38 = !{!17, !7, i64 7}
!39 = !{!28, !7, i64 10}
!40 = !{!12, !10, i64 43072}
!41 = !{!12, !10, i64 16436}


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

%union.PXEBC_DHCP_PACKET_CACHE = type { %struct.PXEBC_DHCP4_PACKET_CACHE }
%struct.PXEBC_DHCP4_PACKET_CACHE = type { %union.PXEBC_DHCP4_PACKET, i32, [7 x ptr], %struct.PXEBC_VENDOR_OPTION }
%union.PXEBC_DHCP4_PACKET = type { [1472 x i8] }
%struct.PXEBC_VENDOR_OPTION = type { [8 x i32], %struct.EFI_IPv4_ADDRESS, i16, i16, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16, i16, ptr, i8, ptr, i8, ptr, i8, ptr, i8 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }

@.str = external hidden unnamed_addr constant [138 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @PxeBcParseDhcp4Options(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

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

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

declare i64 @NetLibGetSystemGuid(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcCopyDhcp4Ack(ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcCacheDhcp4Offer(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @PxeBcSelectDhcp4Offer(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775802, 1) i64 @PxeBcDhcp4CallBack(ptr nocapture noundef readnone %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #0 {
  %7 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) #3
  %8 = icmp ne i32 %3, 3
  switch i32 %3, label %75 [
    i32 5, label %9
    i32 3, label %9
    i32 2, label %9
    i32 1, label %9
  ]

9:                                                ; preds = %6, %6, %6, %6
  %10 = getelementptr inbounds i8, ptr %1, i64 352
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 376
  %13 = load ptr, ptr %12, align 8, !tbaa !29
  %14 = getelementptr inbounds i8, ptr %4, i64 8
  %15 = getelementptr inbounds i8, ptr %4, i64 248
  %16 = getelementptr inbounds i8, ptr %4, i64 4
  %17 = load i32, ptr %16, align 1, !tbaa !30
  %18 = add i32 %17, -240
  %19 = tail call ptr @PxeBcParseDhcp4Options(ptr noundef nonnull %15, i32 noundef %18, i8 noundef zeroext 57)
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %24, label %20

20:                                               ; preds = %9
  %21 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext 1464) #3
  store i16 %21, ptr %7, align 2, !tbaa !31
  %22 = getelementptr inbounds i8, ptr %19, i64 2
  %23 = call ptr @CopyMem(ptr noundef nonnull %22, ptr noundef nonnull %7, i64 noundef 2) #3
  br label %24

24:                                               ; preds = %20, %9
  %25 = icmp ne ptr %13, null
  %or.cond7 = select i1 %8, i1 %25, i1 false
  br i1 %or.cond7, label %26, label %37

26:                                               ; preds = %24
  %27 = icmp eq i32 %3, 2
  %28 = icmp eq i32 %3, 5
  %29 = or i1 %27, %28
  %30 = zext i1 %29 to i8
  %31 = getelementptr inbounds i8, ptr %13, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !32
  %33 = getelementptr inbounds i8, ptr %1, i64 10816
  %34 = load i32, ptr %33, align 8, !tbaa !33
  %35 = load i32, ptr %16, align 1, !tbaa !30
  %36 = call i32 %32(ptr noundef nonnull %13, i32 noundef %34, i8 noundef zeroext %30, i32 noundef %35, ptr noundef nonnull %14) #3
  %.not54 = icmp eq i32 %36, 1
  br i1 %.not54, label %37, label %75

37:                                               ; preds = %26, %24
  switch i32 %3, label %default.unreachable [
    i32 1, label %38
    i32 4, label %43
    i32 2, label %54
    i32 3, label %59
    i32 5, label %68
  ]

38:                                               ; preds = %37
  %39 = getelementptr inbounds i8, ptr %11, i64 52
  %40 = load i32, ptr %16, align 1, !tbaa !30
  %41 = zext i32 %40 to i64
  %42 = call ptr @CopyMem(ptr noundef nonnull %39, ptr noundef nonnull %14, i64 noundef %41) #3
  br label %43

43:                                               ; preds = %38, %37
  %44 = getelementptr inbounds i8, ptr %11, i64 7
  %45 = load i8, ptr %44, align 1, !tbaa !34
  %.not57 = icmp eq i8 %45, 0
  br i1 %.not57, label %75, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %4, i64 36
  %48 = call i64 @NetLibGetSystemGuid(ptr noundef nonnull %47) #3
  %49 = icmp slt i64 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  %51 = call ptr @ZeroMem(ptr noundef nonnull %47, i64 noundef 16) #3
  br label %52

52:                                               ; preds = %50, %46
  %53 = getelementptr inbounds i8, ptr %4, i64 10
  store i8 16, ptr %53, align 1, !tbaa !35
  br label %75

54:                                               ; preds = %37
  %55 = getelementptr inbounds i8, ptr %1, i64 43072
  %56 = load i32, ptr %55, align 8, !tbaa !36
  %57 = icmp ult i32 %56, 16
  br i1 %57, label %58, label %75

58:                                               ; preds = %54
  call void @PxeBcCacheDhcp4Offer(ptr noundef nonnull %1, ptr noundef nonnull %4)
  br label %75

59:                                               ; preds = %37
  call void @PxeBcSelectDhcp4Offer(ptr noundef nonnull %1)
  %60 = getelementptr inbounds i8, ptr %1, i64 16436
  %61 = load i32, ptr %60, align 4, !tbaa !37
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %75, label %63

63:                                               ; preds = %59
  %64 = getelementptr inbounds i8, ptr %1, i64 16448
  %65 = add i32 %61, -1
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds [16 x %union.PXEBC_DHCP_PACKET_CACHE], ptr %64, i64 0, i64 %66
  store ptr %67, ptr %5, align 8, !tbaa !38
  br label %75

68:                                               ; preds = %37
  %69 = call zeroext i8 @DebugAssertEnabled() #3
  %.not55 = icmp eq i8 %69, 0
  br i1 %.not55, label %74, label %70

70:                                               ; preds = %68
  %71 = getelementptr inbounds i8, ptr %1, i64 16436
  %72 = load i32, ptr %71, align 4, !tbaa !37
  %.not56 = icmp eq i32 %72, 0
  br i1 %.not56, label %73, label %74

73:                                               ; preds = %70
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1260, ptr noundef nonnull @.str.15) #3
  br label %74

74:                                               ; preds = %70, %73, %68
  call void @PxeBcCopyDhcp4Ack(ptr noundef nonnull %1, ptr noundef nonnull %4, i8 noundef zeroext 0)
  br label %75

default.unreachable:                              ; preds = %37
  unreachable

75:                                               ; preds = %74, %52, %43, %58, %54, %63, %59, %26, %6
  %.0 = phi i64 [ 0, %6 ], [ -9223372036854775787, %26 ], [ 0, %74 ], [ 0, %63 ], [ -9223372036854775802, %58 ], [ -9223372036854775802, %54 ], [ 0, %52 ], [ 0, %43 ], [ -9223372036854775787, %59 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) #3
  ret i64 %.0
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 352}
!6 = !{!"_PXEBC_PRIVATE_DATA", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !13, i64 248, !14, i64 360, !10, i64 376, !10, i64 384, !15, i64 392, !7, i64 10816, !7, i64 10820, !7, i64 10824, !12, i64 10832, !20, i64 10840, !22, i64 10876, !23, i64 10928, !24, i64 10956, !10, i64 11008, !10, i64 11016, !25, i64 11024, !25, i64 11048, !8, i64 11072, !8, i64 11073, !8, i64 11074, !8, i64 11075, !8, i64 11076, !8, i64 11092, !8, i64 11108, !8, i64 11124, !17, i64 11140, !7, i64 11144, !7, i64 11148, !7, i64 11152, !10, i64 11160, !12, i64 11168, !12, i64 11176, !8, i64 11184, !8, i64 12848, !8, i64 14512, !10, i64 16176, !26, i64 16184, !7, i64 16436, !7, i64 16440, !8, i64 16448, !7, i64 43072, !8, i64 43076, !8, i64 43108}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_PXEBC_PRIVATE_PROTOCOL", !12, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"_EFI_PXE_BASE_CODE_PROTOCOL", !12, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!"_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL", !12, i64 0, !10, i64 8}
!15 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !8, i64 18, !8, i64 20, !8, i64 36, !8, i64 52, !8, i64 1524, !8, i64 2996, !8, i64 4468, !8, i64 5940, !8, i64 7412, !16, i64 8884, !7, i64 9016, !8, i64 9020, !7, i64 9404, !8, i64 9408, !18, i64 9792, !19, i64 10296}
!16 = !{!"", !8, i64 0, !8, i64 1, !17, i64 2, !8, i64 4}
!17 = !{!"short", !8, i64 0}
!18 = !{!"", !8, i64 0, !8, i64 1, !17, i64 2, !8, i64 4, !8, i64 8}
!19 = !{!"", !8, i64 0, !8, i64 1}
!20 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !7, i64 8, !7, i64 12, !8, i64 16, !21, i64 17, !21, i64 21, !17, i64 26, !21, i64 28, !17, i64 32}
!21 = !{!"", !8, i64 0}
!22 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !7, i64 8, !7, i64 12, !21, i64 16, !17, i64 32, !21, i64 34, !17, i64 50}
!23 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !21, i64 6, !21, i64 10, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !7, i64 20, !7, i64 24}
!24 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !21, i64 4, !21, i64 20, !8, i64 36, !8, i64 37, !7, i64 40, !7, i64 44, !7, i64 48}
!25 = !{!"", !10, i64 0, !12, i64 8, !8, i64 16}
!26 = !{!"", !7, i64 0, !7, i64 4, !27, i64 8}
!27 = !{!"", !28, i64 0, !7, i64 236, !8, i64 240}
!28 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !7, i64 4, !17, i64 8, !17, i64 10, !21, i64 12, !21, i64 16, !21, i64 20, !21, i64 24, !8, i64 28, !8, i64 44, !8, i64 108}
!29 = !{!6, !10, i64 376}
!30 = !{!26, !7, i64 4}
!31 = !{!17, !17, i64 0}
!32 = !{!14, !10, i64 8}
!33 = !{!6, !7, i64 10816}
!34 = !{!15, !8, i64 7}
!35 = !{!26, !8, i64 10}
!36 = !{!6, !7, i64 43072}
!37 = !{!6, !7, i64 16436}
!38 = !{!10, !10, i64 0}


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