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

; 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_IPv6_ADDRESS = type { [16 x i8] }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%struct._LIST_ENTRY = type { ptr, ptr }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._EFI_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }
%struct.IP6_CLIP_INFO = type { i32, i32, i32, i32, i32, i32, i64, i32, i16, i8, i8, i32 }
%struct._IP6_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, %struct.IP6_LINK_RX_TOKEN, %struct.IP6_ASSEMBLE_TABLE, %struct.IP6_MLD_SERVICE_DATA, %struct.EFI_IPv6_ADDRESS, i8, i8, i8, i8, i8, i32, i32, i32, i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i8, ptr, i8, i8, i32, ptr, ptr, ptr, ptr, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, %struct.EFI_SIMPLE_NETWORK_MODE, ptr, ptr, %struct._IP6_CONFIG_INSTANCE, ptr, i32, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct.IP6_LINK_RX_TOKEN = type { i32, ptr, ptr, %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN }
%struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct.IP6_ASSEMBLE_TABLE = type { [127 x %struct._LIST_ENTRY] }
%struct.IP6_MLD_SERVICE_DATA = type { i64, %struct._LIST_ENTRY }
%struct.EFI_MANAGED_NETWORK_CONFIG_DATA = type { i32, i32, i16, i8, i8, i8, i8, i8, i8, i8 }
%struct.EFI_SIMPLE_NETWORK_MODE = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x %struct.EFI_MAC_ADDRESS], %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i8, i8, i8, i8, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct._IP6_CONFIG_INSTANCE = type { i32, i8, %struct._LIST_ENTRY, i16, %struct.EFI_IP6_CONFIG_INTERFACE_INFO, %struct.EFI_IP6_CONFIG_INTERFACE_ID, i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, [7 x %struct.IP6_CONFIG_DATA_ITEM], %struct.NET_MAP, %struct.NET_MAP, %struct._EFI_IP6_CONFIG_PROTOCOL, ptr, ptr, ptr, ptr, i8, i32, ptr, i32, ptr, i32, %struct._IP6_FORM_CALLBACK_INFO, %struct.IP6_CONFIG_NVDATA }
%struct.EFI_IP6_CONFIG_INTERFACE_INFO = type { [32 x i16], i8, i32, %struct.EFI_MAC_ADDRESS, i32, ptr, i32, ptr }
%struct.EFI_IP6_CONFIG_INTERFACE_ID = type { [8 x i8] }
%struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS = type { i32 }
%struct.IP6_CONFIG_DATA_ITEM = type { ptr, ptr, i64, i8, %struct.NET_MAP, %union.IP6_CONFIG_DATA, i64 }
%union.IP6_CONFIG_DATA = type { ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct._EFI_IP6_CONFIG_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._IP6_FORM_CALLBACK_INFO = type { i32, ptr, %struct._EFI_HII_CONFIG_ACCESS_PROTOCOL, ptr, ptr }
%struct._EFI_HII_CONFIG_ACCESS_PROTOCOL = type { ptr, ptr, ptr }
%struct.IP6_CONFIG_NVDATA = type { i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, %struct.EFI_IP6_CONFIG_INTERFACE_ID, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32 }
%struct._IP6_FRAGMENT_HEADER = type { i8, i8, i16, i32 }

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

declare ptr @AllocatePool(i64 noundef) #1

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

declare void @FreePool(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @Ip6Reassemble(ptr noundef, ptr noundef) #2

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 noundef) #1

declare ptr @NetbufGetByte(ptr noundef, i32 noundef, ptr noundef) #1

declare ptr @Ip6NtohHead(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6PreProcessPacket(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #2 {
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i16, align 2
  %21 = alloca i16, align 2
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca i16, align 2
  %26 = alloca ptr, align 8
  %27 = alloca %struct.EFI_IPv6_ADDRESS, align 1
  %28 = alloca i32, align 4
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store i32 %2, ptr %13, align 4, !tbaa !9
  store ptr %3, ptr %14, align 8, !tbaa !5
  store ptr %4, ptr %15, align 8, !tbaa !5
  store ptr %5, ptr %16, align 8, !tbaa !5
  store ptr %6, ptr %17, align 8, !tbaa !5
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %25) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #3
  store i32 0, ptr %23, align 4, !tbaa !9
  store i16 0, ptr %20, align 2, !tbaa !11
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.NET_BUF, ptr %30, i32 0, i32 9
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = icmp ult i32 %32, 40
  br i1 %33, label %34, label %35

34:                                               ; preds = %9
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

35:                                               ; preds = %9
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = call ptr @NetbufGetByte(ptr noundef %37, i32 noundef 0, ptr noundef null)
  %39 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %38, ptr %39, align 8, !tbaa !5
  %40 = load ptr, ptr %19, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %35
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

44:                                               ; preds = %35
  %45 = load ptr, ptr %19, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = load i16, ptr %46, align 1
  %48 = lshr i16 %47, 4
  %49 = and i16 %48, 15
  %50 = trunc i16 %49 to i8
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 6
  br i1 %52, label %62, label %53

53:                                               ; preds = %44
  %54 = load ptr, ptr %19, align 8, !tbaa !5
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %55, i32 0, i32 5
  %57 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [16 x i8], ptr %57, i64 0, i64 0
  %59 = load i8, ptr %58, align 1, !tbaa !17
  %60 = zext i8 %59 to i32
  %61 = icmp eq i32 %60, 255
  br i1 %61, label %62, label %63

62:                                               ; preds = %53, %44
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

63:                                               ; preds = %53
  %64 = call ptr @ZeroMem(ptr noundef %27, i64 noundef 16)
  %65 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %27, i32 0, i32 0
  %66 = getelementptr inbounds [16 x i8], ptr %65, i64 0, i64 15
  store i8 1, ptr %66, align 1, !tbaa !17
  %67 = load ptr, ptr %19, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %68, i32 0, i32 6
  %70 = call i64 @CompareMem(ptr noundef %27, ptr noundef %69, i64 noundef 16)
  %71 = icmp eq i64 %70, 0
  br i1 %71, label %79, label %72

72:                                               ; preds = %63
  %73 = load ptr, ptr %19, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %74, i32 0, i32 6
  %76 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef %75)
  %77 = zext i8 %76 to i32
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %72, %63
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

80:                                               ; preds = %72
  %81 = load ptr, ptr %19, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = call ptr @Ip6NtohHead(ptr noundef %82)
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.NET_BUF, ptr %85, i32 0, i32 3
  store ptr %83, ptr %86, align 8, !tbaa !17
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.NET_BUF, ptr %88, i32 0, i32 6
  %90 = getelementptr inbounds [64 x i8], ptr %89, i64 0, i64 0
  store ptr %90, ptr %26, align 8, !tbaa !5
  %91 = load i32, ptr %13, align 4, !tbaa !9
  %92 = load ptr, ptr %26, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %92, i32 0, i32 0
  store i32 %91, ptr %93, align 8, !tbaa !18
  %94 = load ptr, ptr %26, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %94, i32 0, i32 1
  store i32 0, ptr %95, align 4, !tbaa !20
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._IP6_SERVICE, ptr %96, i32 0, i32 35
  %98 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, ptr %97, i32 0, i32 6
  %99 = load i8, ptr %98, align 1, !tbaa !21
  %100 = icmp ne i8 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %80
  %102 = load ptr, ptr %26, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %102, i32 0, i32 1
  store i32 1, ptr %103, align 4, !tbaa !20
  br label %104

104:                                              ; preds = %101, %80
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load ptr, ptr %19, align 8, !tbaa !5
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %107, i32 0, i32 6
  %109 = call zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef %105, ptr noundef %108, ptr noundef null, ptr noundef null)
  %110 = icmp ne i8 %109, 0
  br i1 %110, label %111, label %114

111:                                              ; preds = %104
  %112 = load ptr, ptr %26, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %112, i32 0, i32 1
  store i32 2, ptr %113, align 4, !tbaa !20
  br label %135

114:                                              ; preds = %104
  %115 = load ptr, ptr %19, align 8, !tbaa !5
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %116, i32 0, i32 6
  %118 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds [16 x i8], ptr %118, i64 0, i64 0
  %120 = load i8, ptr %119, align 1, !tbaa !17
  %121 = zext i8 %120 to i32
  %122 = icmp eq i32 %121, 255
  br i1 %122, label %123, label %134

123:                                              ; preds = %114
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr %19, align 8, !tbaa !5
  %126 = load ptr, ptr %125, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %126, i32 0, i32 6
  %128 = call ptr @Ip6FindMldEntry(ptr noundef %124, ptr noundef %127)
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %133

130:                                              ; preds = %123
  %131 = load ptr, ptr %26, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %131, i32 0, i32 1
  store i32 3, ptr %132, align 4, !tbaa !20
  br label %133

133:                                              ; preds = %130, %123
  br label %134

134:                                              ; preds = %133, %114
  br label %135

135:                                              ; preds = %134, %111
  %136 = load ptr, ptr %26, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %136, i32 0, i32 1
  %138 = load i32, ptr %137, align 4, !tbaa !20
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %141

140:                                              ; preds = %135
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

141:                                              ; preds = %135
  %142 = load ptr, ptr %19, align 8, !tbaa !5
  %143 = load ptr, ptr %142, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %143, i32 0, i32 2
  %145 = load i16, ptr %144, align 1, !tbaa !38
  store i16 %145, ptr %20, align 2, !tbaa !11
  %146 = load ptr, ptr %26, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %146, i32 0, i32 2
  store i32 0, ptr %147, align 8, !tbaa !40
  %148 = load i16, ptr %20, align 2, !tbaa !11
  %149 = zext i16 %148 to i32
  %150 = load ptr, ptr %26, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %150, i32 0, i32 4
  store i32 %149, ptr %151, align 8, !tbaa !41
  %152 = load ptr, ptr %26, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %152, i32 0, i32 2
  %154 = load i32, ptr %153, align 8, !tbaa !40
  %155 = load ptr, ptr %26, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %155, i32 0, i32 4
  %157 = load i32, ptr %156, align 8, !tbaa !41
  %158 = add nsw i32 %154, %157
  %159 = load ptr, ptr %26, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %159, i32 0, i32 3
  store i32 %158, ptr %160, align 4, !tbaa !42
  %161 = load ptr, ptr %26, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %161, i32 0, i32 8
  store i16 40, ptr %162, align 4, !tbaa !43
  %163 = load ptr, ptr %26, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %163, i32 0, i32 6
  store i64 0, ptr %164, align 8, !tbaa !44
  %165 = load ptr, ptr %26, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %165, i32 0, i32 10
  store i8 0, ptr %166, align 1, !tbaa !45
  %167 = load i16, ptr %20, align 2, !tbaa !11
  %168 = zext i16 %167 to i64
  %169 = add i64 %168, 40
  %170 = trunc i64 %169 to i16
  store i16 %170, ptr %21, align 2, !tbaa !11
  %171 = load i16, ptr %21, align 2, !tbaa !11
  %172 = zext i16 %171 to i32
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = load ptr, ptr %173, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.NET_BUF, ptr %174, i32 0, i32 9
  %176 = load i32, ptr %175, align 4, !tbaa !13
  %177 = icmp ult i32 %172, %176
  br i1 %177, label %178, label %189

178:                                              ; preds = %141
  %179 = load ptr, ptr %12, align 8, !tbaa !5
  %180 = load ptr, ptr %179, align 8, !tbaa !5
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  %182 = load ptr, ptr %181, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.NET_BUF, ptr %182, i32 0, i32 9
  %184 = load i32, ptr %183, align 4, !tbaa !13
  %185 = load i16, ptr %21, align 2, !tbaa !11
  %186 = zext i16 %185 to i32
  %187 = sub i32 %184, %186
  %188 = call i32 @NetbufTrim(ptr noundef %180, i32 noundef %187, i8 noundef zeroext 0)
  br label %189

189:                                              ; preds = %178, %141
  %190 = load i16, ptr %21, align 2, !tbaa !11
  %191 = zext i16 %190 to i32
  %192 = load ptr, ptr %12, align 8, !tbaa !5
  %193 = load ptr, ptr %192, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.NET_BUF, ptr %193, i32 0, i32 9
  %195 = load i32, ptr %194, align 4, !tbaa !13
  %196 = icmp ne i32 %191, %195
  br i1 %196, label %197, label %198

197:                                              ; preds = %189
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

198:                                              ; preds = %189
  %199 = load i16, ptr %20, align 2, !tbaa !11
  %200 = zext i16 %199 to i32
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %219

202:                                              ; preds = %198
  %203 = load i16, ptr %20, align 2, !tbaa !11
  %204 = zext i16 %203 to i64
  %205 = call ptr @AllocatePool(i64 noundef %204)
  %206 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %205, ptr %206, align 8, !tbaa !5
  %207 = load ptr, ptr %14, align 8, !tbaa !5
  %208 = load ptr, ptr %207, align 8, !tbaa !5
  %209 = icmp eq ptr %208, null
  br i1 %209, label %210, label %211

210:                                              ; preds = %202
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

211:                                              ; preds = %202
  %212 = load ptr, ptr %12, align 8, !tbaa !5
  %213 = load ptr, ptr %212, align 8, !tbaa !5
  %214 = load i16, ptr %20, align 2, !tbaa !11
  %215 = zext i16 %214 to i32
  %216 = load ptr, ptr %14, align 8, !tbaa !5
  %217 = load ptr, ptr %216, align 8, !tbaa !5
  %218 = call i32 @NetbufCopy(ptr noundef %213, i32 noundef 40, i32 noundef %215, ptr noundef %217)
  br label %219

219:                                              ; preds = %211, %198
  %220 = load ptr, ptr %11, align 8, !tbaa !5
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = load ptr, ptr %221, align 8, !tbaa !5
  %223 = load ptr, ptr %19, align 8, !tbaa !5
  %224 = load ptr, ptr %223, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %224, i32 0, i32 3
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  %227 = load ptr, ptr %226, align 8, !tbaa !5
  %228 = load i16, ptr %20, align 2, !tbaa !11
  %229 = zext i16 %228 to i32
  %230 = load ptr, ptr %15, align 8, !tbaa !5
  %231 = load ptr, ptr %16, align 8, !tbaa !5
  %232 = load ptr, ptr %17, align 8, !tbaa !5
  %233 = load ptr, ptr %18, align 8, !tbaa !5
  %234 = call zeroext i8 @Ip6IsExtsValid(ptr noundef %220, ptr noundef %222, ptr noundef %225, ptr noundef %227, i32 noundef %229, i8 noundef zeroext 1, ptr noundef %22, ptr noundef %230, ptr noundef %231, ptr noundef %232, ptr noundef %233)
  %235 = icmp ne i8 %234, 0
  br i1 %235, label %237, label %236

236:                                              ; preds = %219
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

237:                                              ; preds = %219
  %238 = load ptr, ptr %17, align 8, !tbaa !5
  %239 = load i32, ptr %238, align 4, !tbaa !9
  %240 = zext i32 %239 to i64
  %241 = add i64 40, %240
  %242 = trunc i64 %241 to i32
  store i32 %242, ptr %23, align 4, !tbaa !9
  %243 = load ptr, ptr %18, align 8, !tbaa !5
  %244 = load i8, ptr %243, align 1, !tbaa !17
  %245 = icmp ne i8 %244, 0
  br i1 %245, label %246, label %397

246:                                              ; preds = %237
  %247 = load ptr, ptr %12, align 8, !tbaa !5
  %248 = load ptr, ptr %247, align 8, !tbaa !5
  %249 = load i32, ptr %23, align 4, !tbaa !9
  %250 = call ptr @NetbufGetByte(ptr noundef %248, i32 noundef %249, ptr noundef null)
  store ptr %250, ptr %24, align 8, !tbaa !5
  %251 = load ptr, ptr %24, align 8, !tbaa !5
  %252 = icmp eq ptr %251, null
  br i1 %252, label %253, label %254

253:                                              ; preds = %246
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

254:                                              ; preds = %246
  %255 = load ptr, ptr %24, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct._IP6_FRAGMENT_HEADER, ptr %255, i32 0, i32 2
  %257 = load i16, ptr %256, align 2, !tbaa !46
  %258 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %257)
  store i16 %258, ptr %25, align 2, !tbaa !11
  %259 = load i16, ptr %25, align 2, !tbaa !11
  %260 = zext i16 %259 to i32
  %261 = and i32 %260, 1
  %262 = icmp eq i32 %261, 0
  br i1 %262, label %263, label %266

263:                                              ; preds = %254
  %264 = load ptr, ptr %26, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %264, i32 0, i32 10
  store i8 1, ptr %265, align 1, !tbaa !45
  br label %266

266:                                              ; preds = %263, %254
  %267 = load i16, ptr %25, align 2, !tbaa !11
  %268 = zext i16 %267 to i32
  %269 = and i32 %268, -2
  %270 = trunc i32 %269 to i16
  store i16 %270, ptr %25, align 2, !tbaa !11
  %271 = load i16, ptr %25, align 2, !tbaa !11
  %272 = zext i16 %271 to i32
  %273 = icmp eq i32 %272, 0
  br i1 %273, label %274, label %280

274:                                              ; preds = %266
  %275 = load ptr, ptr %24, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._IP6_FRAGMENT_HEADER, ptr %275, i32 0, i32 0
  %277 = load i8, ptr %276, align 4, !tbaa !48
  %278 = load ptr, ptr %26, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %278, i32 0, i32 9
  store i8 %277, ptr %279, align 2, !tbaa !49
  br label %280

280:                                              ; preds = %274, %266
  %281 = load i32, ptr %23, align 4, !tbaa !9
  %282 = trunc i32 %281 to i16
  %283 = load ptr, ptr %26, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %283, i32 0, i32 8
  store i16 %282, ptr %284, align 4, !tbaa !43
  %285 = load i32, ptr %23, align 4, !tbaa !9
  %286 = zext i32 %285 to i64
  %287 = add i64 %286, 8
  %288 = trunc i64 %287 to i32
  store i32 %288, ptr %23, align 4, !tbaa !9
  %289 = load i16, ptr %25, align 2, !tbaa !11
  %290 = zext i16 %289 to i32
  %291 = load ptr, ptr %26, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %291, i32 0, i32 2
  store i32 %290, ptr %292, align 8, !tbaa !40
  %293 = load i16, ptr %21, align 2, !tbaa !11
  %294 = zext i16 %293 to i32
  %295 = load i32, ptr %23, align 4, !tbaa !9
  %296 = trunc i32 %295 to i16
  %297 = zext i16 %296 to i32
  %298 = sub nsw i32 %294, %297
  %299 = load ptr, ptr %26, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %299, i32 0, i32 4
  store i32 %298, ptr %300, align 8, !tbaa !41
  %301 = load ptr, ptr %26, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %301, i32 0, i32 2
  %303 = load i32, ptr %302, align 8, !tbaa !40
  %304 = load ptr, ptr %26, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %304, i32 0, i32 4
  %306 = load i32, ptr %305, align 8, !tbaa !41
  %307 = add nsw i32 %303, %306
  %308 = load ptr, ptr %26, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %308, i32 0, i32 3
  store i32 %307, ptr %309, align 4, !tbaa !42
  %310 = load ptr, ptr %24, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct._IP6_FRAGMENT_HEADER, ptr %310, i32 0, i32 3
  %312 = load i32, ptr %311, align 4, !tbaa !50
  %313 = load ptr, ptr %26, align 8, !tbaa !5
  %314 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %313, i32 0, i32 7
  store i32 %312, ptr %314, align 8, !tbaa !51
  %315 = load i32, ptr %22, align 4, !tbaa !9
  %316 = load ptr, ptr %26, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %316, i32 0, i32 11
  store i32 %315, ptr %317, align 8, !tbaa !52
  %318 = load ptr, ptr %26, align 8, !tbaa !5
  %319 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %318, i32 0, i32 10
  %320 = load i8, ptr %319, align 1, !tbaa !45
  %321 = zext i8 %320 to i32
  %322 = icmp eq i32 %321, 0
  br i1 %322, label %323, label %330

323:                                              ; preds = %280
  %324 = load ptr, ptr %26, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %324, i32 0, i32 4
  %326 = load i32, ptr %325, align 8, !tbaa !41
  %327 = srem i32 %326, 8
  %328 = icmp ne i32 %327, 0
  br i1 %328, label %329, label %330

329:                                              ; preds = %323
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

330:                                              ; preds = %323, %280
  %331 = load ptr, ptr %11, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct._IP6_SERVICE, ptr %331, i32 0, i32 9
  %333 = load ptr, ptr %12, align 8, !tbaa !5
  %334 = load ptr, ptr %333, align 8, !tbaa !5
  %335 = call ptr @Ip6Reassemble(ptr noundef %332, ptr noundef %334)
  %336 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %335, ptr %336, align 8, !tbaa !5
  %337 = load ptr, ptr %12, align 8, !tbaa !5
  %338 = load ptr, ptr %337, align 8, !tbaa !5
  %339 = icmp eq ptr %338, null
  br i1 %339, label %340, label %341

340:                                              ; preds = %330
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

341:                                              ; preds = %330
  %342 = load ptr, ptr %12, align 8, !tbaa !5
  %343 = load ptr, ptr %342, align 8, !tbaa !5
  %344 = getelementptr inbounds %struct.NET_BUF, ptr %343, i32 0, i32 3
  %345 = load ptr, ptr %344, align 8, !tbaa !17
  %346 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %345, ptr %346, align 8, !tbaa !5
  %347 = load ptr, ptr %19, align 8, !tbaa !5
  %348 = load ptr, ptr %347, align 8, !tbaa !5
  %349 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %348, i32 0, i32 2
  %350 = load i16, ptr %349, align 1, !tbaa !38
  store i16 %350, ptr %20, align 2, !tbaa !11
  %351 = load i16, ptr %20, align 2, !tbaa !11
  %352 = zext i16 %351 to i32
  %353 = icmp ne i32 %352, 0
  br i1 %353, label %354, label %378

354:                                              ; preds = %341
  %355 = load ptr, ptr %14, align 8, !tbaa !5
  %356 = load ptr, ptr %355, align 8, !tbaa !5
  %357 = icmp ne ptr %356, null
  br i1 %357, label %358, label %361

358:                                              ; preds = %354
  %359 = load ptr, ptr %14, align 8, !tbaa !5
  %360 = load ptr, ptr %359, align 8, !tbaa !5
  call void @FreePool(ptr noundef %360)
  br label %361

361:                                              ; preds = %358, %354
  %362 = load i16, ptr %20, align 2, !tbaa !11
  %363 = zext i16 %362 to i64
  %364 = call ptr @AllocatePool(i64 noundef %363)
  %365 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %364, ptr %365, align 8, !tbaa !5
  %366 = load ptr, ptr %14, align 8, !tbaa !5
  %367 = load ptr, ptr %366, align 8, !tbaa !5
  %368 = icmp eq ptr %367, null
  br i1 %368, label %369, label %370

369:                                              ; preds = %361
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

370:                                              ; preds = %361
  %371 = load ptr, ptr %12, align 8, !tbaa !5
  %372 = load ptr, ptr %371, align 8, !tbaa !5
  %373 = load i16, ptr %20, align 2, !tbaa !11
  %374 = zext i16 %373 to i32
  %375 = load ptr, ptr %14, align 8, !tbaa !5
  %376 = load ptr, ptr %375, align 8, !tbaa !5
  %377 = call i32 @NetbufCopy(ptr noundef %372, i32 noundef 40, i32 noundef %374, ptr noundef %376)
  br label %378

378:                                              ; preds = %370, %341
  %379 = load ptr, ptr %11, align 8, !tbaa !5
  %380 = load ptr, ptr %12, align 8, !tbaa !5
  %381 = load ptr, ptr %380, align 8, !tbaa !5
  %382 = load ptr, ptr %19, align 8, !tbaa !5
  %383 = load ptr, ptr %382, align 8, !tbaa !5
  %384 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %383, i32 0, i32 3
  %385 = load ptr, ptr %14, align 8, !tbaa !5
  %386 = load ptr, ptr %385, align 8, !tbaa !5
  %387 = load i16, ptr %20, align 2, !tbaa !11
  %388 = zext i16 %387 to i32
  %389 = load ptr, ptr %15, align 8, !tbaa !5
  %390 = load ptr, ptr %16, align 8, !tbaa !5
  %391 = load ptr, ptr %17, align 8, !tbaa !5
  %392 = load ptr, ptr %18, align 8, !tbaa !5
  %393 = call zeroext i8 @Ip6IsExtsValid(ptr noundef %379, ptr noundef %381, ptr noundef %384, ptr noundef %386, i32 noundef %388, i8 noundef zeroext 1, ptr noundef null, ptr noundef %389, ptr noundef %390, ptr noundef %391, ptr noundef %392)
  %394 = icmp ne i8 %393, 0
  br i1 %394, label %396, label %395

395:                                              ; preds = %378
  store i64 -9223372036854775806, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

396:                                              ; preds = %378
  br label %397

397:                                              ; preds = %396, %237
  %398 = load ptr, ptr %12, align 8, !tbaa !5
  %399 = load ptr, ptr %398, align 8, !tbaa !5
  %400 = load ptr, ptr %16, align 8, !tbaa !5
  %401 = load i32, ptr %400, align 4, !tbaa !9
  %402 = zext i32 %401 to i64
  %403 = add i64 40, %402
  %404 = trunc i64 %403 to i32
  %405 = call i32 @NetbufTrim(ptr noundef %399, i32 noundef %404, i8 noundef zeroext 1)
  store i64 0, ptr %10, align 8
  store i32 1, ptr %28, align 4
  br label %406

406:                                              ; preds = %397, %395, %369, %340, %329, %253, %236, %210, %197, %140, %79, %62, %43, %34
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %20) #3
  %407 = load i64, ptr %10, align 8
  ret i64 %407
}

declare zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef) #1

declare zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @Ip6FindMldEntry(ptr noundef, ptr noundef) #1

declare i32 @NetbufCopy(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !10, i64 132}
!14 = !{!"", !10, i64 0, !15, i64 8, !16, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !10, i64 128, !10, i64 132, !7, i64 136}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !10, i64 0}
!19 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !15, i64 24, !10, i64 32, !12, i64 36, !7, i64 38, !7, i64 39, !10, i64 40}
!20 = !{!19, !10, i64 4}
!21 = !{!22, !7, i64 2365}
!22 = !{!"_IP6_SERVICE", !10, i64 0, !23, i64 8, !15, i64 24, !15, i64 32, !16, i64 40, !16, i64 56, !6, i64 72, !6, i64 80, !24, i64 88, !26, i64 136, !27, i64 2168, !26, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !10, i64 2216, !10, i64 2220, !10, i64 2224, !10, i64 2228, !16, i64 2232, !16, i64 2248, !16, i64 2264, !16, i64 2280, !10, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !10, i64 2316, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !28, i64 2352, !29, i64 2372, !6, i64 3032, !6, i64 3040, !30, i64 3048, !6, i64 4176, !10, i64 4184, !10, i64 4188}
!23 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!24 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !25, i64 24}
!25 = !{!"", !6, i64 0, !15, i64 8, !7, i64 16}
!26 = !{!"", !7, i64 0}
!27 = !{!"", !15, i64 0, !16, i64 8}
!28 = !{!"", !10, i64 0, !10, i64 4, !12, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!29 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !7, i64 40, !26, i64 552, !26, i64 584, !26, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!"_IP6_CONFIG_INSTANCE", !10, i64 0, !7, i64 4, !16, i64 8, !12, i64 24, !31, i64 32, !26, i64 168, !10, i64 176, !32, i64 180, !7, i64 184, !33, i64 800, !33, i64 840, !34, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !10, i64 948, !6, i64 952, !10, i64 960, !6, i64 968, !10, i64 976, !35, i64 984, !37, i64 1040}
!31 = !{!"", !7, i64 0, !7, i64 64, !10, i64 68, !26, i64 72, !10, i64 104, !6, i64 112, !10, i64 120, !6, i64 128}
!32 = !{!"", !10, i64 0}
!33 = !{!"", !16, i64 0, !16, i64 16, !15, i64 32}
!34 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!35 = !{!"_IP6_FORM_CALLBACK_INFO", !10, i64 0, !6, i64 8, !36, i64 16, !6, i64 40, !6, i64 48}
!36 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!37 = !{!"", !10, i64 0, !32, i64 4, !26, i64 8, !16, i64 16, !10, i64 32, !16, i64 40, !10, i64 56, !16, i64 64, !10, i64 80}
!38 = !{!39, !12, i64 4}
!39 = !{!"_EFI_IP6_HEADER", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !12, i64 2, !12, i64 4, !7, i64 6, !7, i64 7, !26, i64 8, !26, i64 24}
!40 = !{!19, !10, i64 8}
!41 = !{!19, !10, i64 16}
!42 = !{!19, !10, i64 12}
!43 = !{!19, !12, i64 36}
!44 = !{!19, !15, i64 24}
!45 = !{!19, !7, i64 39}
!46 = !{!47, !12, i64 2}
!47 = !{!"_IP6_FRAGMENT_HEADER", !7, i64 0, !7, i64 1, !12, i64 2, !10, i64 4}
!48 = !{!47, !7, i64 0}
!49 = !{!19, !7, i64 38}
!50 = !{!47, !10, i64 4}
!51 = !{!19, !10, i64 32}
!52 = !{!19, !10, i64 40}


; 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_IPv6_ADDRESS = type { [16 x i8] }

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

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

declare void @FreePool(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @Ip6Reassemble(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare ptr @NetbufGetByte(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @Ip6NtohHead(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @Ip6PreProcessPacket(ptr noundef %0, ptr nocapture noundef %1, i32 noundef %2, ptr nocapture noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr nocapture noundef %8) local_unnamed_addr #2 {
  %10 = alloca i32, align 4
  %11 = alloca %struct.EFI_IPv6_ADDRESS, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #3
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 132
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = icmp ult i32 %14, 40
  br i1 %15, label %163, label %16

16:                                               ; preds = %9
  %17 = tail call ptr @NetbufGetByte(ptr noundef nonnull %12, i32 noundef 0, ptr noundef null) #3
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %163, label %19

19:                                               ; preds = %16
  %20 = load i16, ptr %17, align 1
  %21 = and i16 %20, 240
  %.not = icmp eq i16 %21, 96
  br i1 %.not, label %22, label %163

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %17, i64 8
  %24 = load i8, ptr %23, align 1, !tbaa !14
  %25 = icmp eq i8 %24, -1
  br i1 %25, label %163, label %26

26:                                               ; preds = %22
  %27 = call ptr @ZeroMem(ptr noundef nonnull %11, i64 noundef 16) #3
  %28 = getelementptr inbounds i8, ptr %11, i64 15
  store i8 1, ptr %28, align 1, !tbaa !14
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 24
  %31 = call i64 @CompareMem(ptr noundef nonnull %11, ptr noundef nonnull %30, i64 noundef 16) #3
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %163, label %33

33:                                               ; preds = %26
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  %36 = call zeroext i8 @NetIp6IsUnspecifiedAddr(ptr noundef nonnull %35) #3
  %.not123 = icmp eq i8 %36, 0
  br i1 %.not123, label %37, label %163

37:                                               ; preds = %33
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call ptr @Ip6NtohHead(ptr noundef %38) #3
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 32
  store ptr %39, ptr %41, align 8, !tbaa !14
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i64 56
  store i32 %2, ptr %43, align 8, !tbaa !15
  %44 = getelementptr inbounds i8, ptr %42, i64 60
  %45 = getelementptr inbounds i8, ptr %0, i64 2365
  %46 = load i8, ptr %45, align 1, !tbaa !18
  %.not124 = icmp ne i8 %46, 0
  %spec.store.select = zext i1 %.not124 to i32
  store i32 %spec.store.select, ptr %44, align 4
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 24
  %49 = call zeroext i8 @Ip6IsOneOfSetAddress(ptr noundef %0, ptr noundef nonnull %48, ptr noundef null, ptr noundef null) #3
  %.not125 = icmp eq i8 %49, 0
  br i1 %.not125, label %50, label %.thread.sink.split

50:                                               ; preds = %37
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 24
  %53 = load i8, ptr %52, align 1, !tbaa !14
  %54 = icmp eq i8 %53, -1
  br i1 %54, label %55, label %57

55:                                               ; preds = %50
  %56 = call ptr @Ip6FindMldEntry(ptr noundef nonnull %0, ptr noundef nonnull %52) #3
  %.not126 = icmp eq ptr %56, null
  br i1 %.not126, label %57, label %.thread.sink.split

57:                                               ; preds = %50, %55
  %.pr = load i32, ptr %44, align 4, !tbaa !35
  %58 = icmp eq i32 %.pr, 0
  br i1 %58, label %163, label %.thread

.thread.sink.split:                               ; preds = %55, %37
  %.sink = phi i32 [ 2, %37 ], [ 3, %55 ]
  store i32 %.sink, ptr %44, align 4, !tbaa !35
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %57
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = load i16, ptr %60, align 1, !tbaa !36
  %62 = getelementptr inbounds i8, ptr %42, i64 64
  store i32 0, ptr %62, align 8, !tbaa !38
  %63 = zext i16 %61 to i32
  %64 = getelementptr inbounds i8, ptr %42, i64 72
  store i32 %63, ptr %64, align 8, !tbaa !39
  %65 = getelementptr inbounds i8, ptr %42, i64 68
  store i32 %63, ptr %65, align 4, !tbaa !40
  %66 = getelementptr inbounds i8, ptr %42, i64 92
  store i16 40, ptr %66, align 4, !tbaa !41
  %67 = getelementptr inbounds i8, ptr %42, i64 80
  store i64 0, ptr %67, align 8, !tbaa !42
  %68 = getelementptr inbounds i8, ptr %42, i64 95
  store i8 0, ptr %68, align 1, !tbaa !43
  %69 = zext i16 %61 to i64
  %70 = add i16 %61, 40
  %71 = zext i16 %70 to i32
  %72 = load ptr, ptr %1, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 132
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = icmp ugt i32 %74, %71
  br i1 %75, label %76, label %79

76:                                               ; preds = %.thread
  %77 = sub i32 %74, %71
  %78 = call i32 @NetbufTrim(ptr noundef nonnull %72, i32 noundef %77, i8 noundef zeroext 0) #3
  %.pre = load ptr, ptr %1, align 8, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre, i64 132
  %.pre135 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %76, %.thread
  %80 = phi i32 [ %.pre135, %76 ], [ %74, %.thread ]
  %81 = phi ptr [ %.pre, %76 ], [ %72, %.thread ]
  %.not127 = icmp eq i32 %80, %71
  br i1 %.not127, label %82, label %163

82:                                               ; preds = %79
  %.not128 = icmp eq i16 %61, 0
  br i1 %.not128, label %89, label %83

83:                                               ; preds = %82
  %84 = call ptr @AllocatePool(i64 noundef %69) #3
  store ptr %84, ptr %3, align 8, !tbaa !5
  %85 = icmp eq ptr %84, null
  br i1 %85, label %163, label %86

86:                                               ; preds = %83
  %87 = load ptr, ptr %1, align 8, !tbaa !5
  %88 = call i32 @NetbufCopy(ptr noundef %87, i32 noundef 40, i32 noundef %63, ptr noundef nonnull %84) #3
  %.pre136 = load ptr, ptr %1, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %86, %82
  %90 = phi ptr [ %.pre136, %86 ], [ %81, %82 ]
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i64 6
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = call zeroext i8 @Ip6IsExtsValid(ptr noundef nonnull %0, ptr noundef %90, ptr noundef nonnull %92, ptr noundef %93, i32 noundef %63, i8 noundef zeroext 1, ptr noundef nonnull %10, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #3
  %.not129 = icmp eq i8 %94, 0
  br i1 %.not129, label %163, label %95

95:                                               ; preds = %89
  %96 = load i32, ptr %6, align 4, !tbaa !44
  %97 = add i32 %96, 40
  %98 = load i8, ptr %7, align 1, !tbaa !14
  %.not130 = icmp eq i8 %98, 0
  br i1 %.not130, label %158, label %99

99:                                               ; preds = %95
  %100 = load ptr, ptr %1, align 8, !tbaa !5
  %101 = call ptr @NetbufGetByte(ptr noundef %100, i32 noundef %97, ptr noundef null) #3
  %102 = icmp eq ptr %101, null
  br i1 %102, label %163, label %103

103:                                              ; preds = %99
  %104 = getelementptr inbounds i8, ptr %101, i64 2
  %105 = load i16, ptr %104, align 2, !tbaa !45
  %106 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %105) #3
  %107 = and i16 %106, 1
  %108 = icmp eq i16 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %103
  store i8 1, ptr %68, align 1, !tbaa !43
  br label %110

110:                                              ; preds = %109, %103
  %111 = and i16 %106, -2
  %112 = zext i16 %111 to i32
  %113 = icmp eq i16 %111, 0
  br i1 %113, label %114, label %117

114:                                              ; preds = %110
  %115 = load i8, ptr %101, align 4, !tbaa !47
  %116 = getelementptr inbounds i8, ptr %42, i64 94
  store i8 %115, ptr %116, align 2, !tbaa !48
  br label %117

117:                                              ; preds = %114, %110
  %118 = trunc i32 %97 to i16
  store i16 %118, ptr %66, align 4, !tbaa !41
  store i32 %112, ptr %62, align 8, !tbaa !38
  %119 = add i32 %96, 48
  %120 = and i32 %119, 65535
  %121 = sub nsw i32 %71, %120
  store i32 %121, ptr %64, align 8, !tbaa !39
  %122 = add nsw i32 %121, %112
  store i32 %122, ptr %65, align 4, !tbaa !40
  %123 = getelementptr inbounds i8, ptr %101, i64 4
  %124 = load i32, ptr %123, align 4, !tbaa !49
  %125 = getelementptr inbounds i8, ptr %42, i64 88
  store i32 %124, ptr %125, align 8, !tbaa !50
  %126 = load i32, ptr %10, align 4, !tbaa !44
  %127 = getelementptr inbounds i8, ptr %42, i64 96
  store i32 %126, ptr %127, align 8, !tbaa !51
  %128 = load i8, ptr %68, align 1, !tbaa !43
  %129 = icmp ne i8 %128, 0
  %130 = and i32 %121, 7
  %.not131 = icmp eq i32 %130, 0
  %or.cond = select i1 %129, i1 true, i1 %.not131
  br i1 %or.cond, label %131, label %163

131:                                              ; preds = %117
  %132 = getelementptr inbounds i8, ptr %0, i64 136
  %133 = load ptr, ptr %1, align 8, !tbaa !5
  %134 = call ptr @Ip6Reassemble(ptr noundef nonnull %132, ptr noundef %133)
  store ptr %134, ptr %1, align 8, !tbaa !5
  %135 = icmp eq ptr %134, null
  br i1 %135, label %163, label %136

136:                                              ; preds = %131
  %137 = getelementptr inbounds i8, ptr %134, i64 32
  %138 = load ptr, ptr %137, align 8, !tbaa !14
  store ptr %138, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds i8, ptr %138, i64 4
  %140 = load i16, ptr %139, align 1, !tbaa !36
  %141 = zext i16 %140 to i32
  %.not132 = icmp eq i16 %140, 0
  br i1 %.not132, label %152, label %142

142:                                              ; preds = %136
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %.not133 = icmp eq ptr %143, null
  br i1 %.not133, label %145, label %144

144:                                              ; preds = %142
  call void @FreePool(ptr noundef nonnull %143) #3
  br label %145

145:                                              ; preds = %144, %142
  %146 = zext i16 %140 to i64
  %147 = call ptr @AllocatePool(i64 noundef %146) #3
  store ptr %147, ptr %3, align 8, !tbaa !5
  %148 = icmp eq ptr %147, null
  br i1 %148, label %163, label %149

149:                                              ; preds = %145
  %150 = load ptr, ptr %1, align 8, !tbaa !5
  %151 = call i32 @NetbufCopy(ptr noundef %150, i32 noundef 40, i32 noundef %141, ptr noundef nonnull %147) #3
  %.pre137 = load ptr, ptr %8, align 8, !tbaa !5
  br label %152

152:                                              ; preds = %149, %136
  %153 = phi ptr [ %.pre137, %149 ], [ %138, %136 ]
  %154 = load ptr, ptr %1, align 8, !tbaa !5
  %155 = getelementptr inbounds i8, ptr %153, i64 6
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = call zeroext i8 @Ip6IsExtsValid(ptr noundef nonnull %0, ptr noundef %154, ptr noundef nonnull %155, ptr noundef %156, i32 noundef %141, i8 noundef zeroext 1, ptr noundef null, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %6, ptr noundef nonnull %7) #3
  %.not134 = icmp eq i8 %157, 0
  br i1 %.not134, label %163, label %158

158:                                              ; preds = %152, %95
  %159 = load ptr, ptr %1, align 8, !tbaa !5
  %160 = load i32, ptr %5, align 4, !tbaa !44
  %161 = add i32 %160, 40
  %162 = call i32 @NetbufTrim(ptr noundef %159, i32 noundef %161, i8 noundef zeroext 1) #3
  br label %163

163:                                              ; preds = %117, %152, %145, %131, %99, %89, %83, %79, %57, %26, %33, %19, %22, %16, %9, %158
  %.0 = phi i64 [ 0, %158 ], [ -9223372036854775806, %9 ], [ -9223372036854775806, %16 ], [ -9223372036854775806, %22 ], [ -9223372036854775806, %19 ], [ -9223372036854775806, %33 ], [ -9223372036854775806, %26 ], [ -9223372036854775806, %57 ], [ -9223372036854775806, %79 ], [ -9223372036854775806, %83 ], [ -9223372036854775806, %89 ], [ -9223372036854775806, %99 ], [ -9223372036854775806, %131 ], [ -9223372036854775806, %145 ], [ -9223372036854775806, %152 ], [ -9223372036854775806, %117 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #3
  ret i64 %.0
}

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

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

declare ptr @Ip6FindMldEntry(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @NetbufCopy(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 132}
!10 = !{!"", !11, i64 0, !12, i64 8, !13, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !11, i64 128, !11, i64 132, !7, i64 136}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !11, i64 0}
!16 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !11, i64 32, !17, i64 36, !7, i64 38, !7, i64 39, !11, i64 40}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !7, i64 2365}
!19 = !{!"_IP6_SERVICE", !11, i64 0, !20, i64 8, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !6, i64 72, !6, i64 80, !21, i64 88, !23, i64 136, !24, i64 2168, !23, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !11, i64 2216, !11, i64 2220, !11, i64 2224, !11, i64 2228, !13, i64 2232, !13, i64 2248, !13, i64 2264, !13, i64 2280, !11, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !11, i64 2316, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !25, i64 2352, !26, i64 2372, !6, i64 3032, !6, i64 3040, !27, i64 3048, !6, i64 4176, !11, i64 4184, !11, i64 4188}
!20 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!21 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !22, i64 24}
!22 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!23 = !{!"", !7, i64 0}
!24 = !{!"", !12, i64 0, !13, i64 8}
!25 = !{!"", !11, i64 0, !11, i64 4, !17, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!26 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !23, i64 552, !23, i64 584, !23, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!27 = !{!"_IP6_CONFIG_INSTANCE", !11, i64 0, !7, i64 4, !13, i64 8, !17, i64 24, !28, i64 32, !23, i64 168, !11, i64 176, !29, i64 180, !7, i64 184, !30, i64 800, !30, i64 840, !31, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !11, i64 948, !6, i64 952, !11, i64 960, !6, i64 968, !11, i64 976, !32, i64 984, !34, i64 1040}
!28 = !{!"", !7, i64 0, !7, i64 64, !11, i64 68, !23, i64 72, !11, i64 104, !6, i64 112, !11, i64 120, !6, i64 128}
!29 = !{!"", !11, i64 0}
!30 = !{!"", !13, i64 0, !13, i64 16, !12, i64 32}
!31 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!32 = !{!"_IP6_FORM_CALLBACK_INFO", !11, i64 0, !6, i64 8, !33, i64 16, !6, i64 40, !6, i64 48}
!33 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"", !11, i64 0, !29, i64 4, !23, i64 8, !13, i64 16, !11, i64 32, !13, i64 40, !11, i64 56, !13, i64 64, !11, i64 80}
!35 = !{!16, !11, i64 4}
!36 = !{!37, !17, i64 4}
!37 = !{!"_EFI_IP6_HEADER", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !17, i64 2, !17, i64 4, !7, i64 6, !7, i64 7, !23, i64 8, !23, i64 24}
!38 = !{!16, !11, i64 8}
!39 = !{!16, !11, i64 16}
!40 = !{!16, !11, i64 12}
!41 = !{!16, !17, i64 36}
!42 = !{!16, !12, i64 24}
!43 = !{!16, !7, i64 39}
!44 = !{!11, !11, i64 0}
!45 = !{!46, !17, i64 2}
!46 = !{!"_IP6_FRAGMENT_HEADER", !7, i64 0, !7, i64 1, !17, i64 2, !11, i64 4}
!47 = !{!46, !7, i64 0}
!48 = !{!16, !7, i64 38}
!49 = !{!46, !11, i64 4}
!50 = !{!16, !11, i64 32}
!51 = !{!16, !11, i64 40}


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