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

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%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.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_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_IPSEC2_PROTOCOL = type { ptr, ptr, i8 }
%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_TXTOKEN_WRAP = type { ptr, ptr, ptr, ptr, i8, i64 }
%struct.IP6_IPSEC_WRAP = type { ptr, ptr }

@gBS = external global ptr, align 8
@mIpSec = external global ptr, align 8
@gEfiIpSec2ProtocolGuid = external global %struct.GUID, align 4

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

declare ptr @CopyMem(ptr noundef, ptr noundef, 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

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

declare ptr @Ip6NtohHead(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6IpSecFree(ptr noundef) #2

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

38:                                               ; preds = %8
  %39 = load ptr, ptr @gBS, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %39, i32 0, i32 38
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = call i64 %41(ptr noundef @gEfiIpSec2ProtocolGuid, ptr noundef null, ptr noundef @mIpSec)
  %43 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %46

45:                                               ; preds = %38
  br label %277

46:                                               ; preds = %38
  br label %47

47:                                               ; preds = %46, %8
  %48 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._EFI_IPSEC2_PROTOCOL, ptr %48, i32 0, i32 2
  %50 = load i8, ptr %49, align 8, !tbaa !19
  %51 = icmp ne i8 %50, 0
  br i1 %51, label %52, label %58

52:                                               ; preds = %47
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._IP6_SERVICE, ptr %53, i32 0, i32 42
  %55 = load i32, ptr %54, align 4, !tbaa !21
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._IP6_SERVICE, ptr %56, i32 0, i32 41
  store i32 %55, ptr %57, align 8, !tbaa !39
  br label %277

58:                                               ; preds = %47
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IP6_SERVICE, ptr %59, i32 0, i32 42
  %61 = load i32, ptr %60, align 4, !tbaa !21
  %62 = sub i32 %61, 54
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._IP6_SERVICE, ptr %63, i32 0, i32 41
  store i32 %62, ptr %64, align 8, !tbaa !39
  br label %65

65:                                               ; preds = %58
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %67, i32 0, i32 6
  %69 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds [16 x i8], ptr %69, i64 0, i64 0
  %71 = load i8, ptr %70, align 1, !tbaa !40
  %72 = zext i8 %71 to i32
  %73 = icmp eq i32 %72, 255
  br i1 %73, label %83, label %74

74:                                               ; preds = %65
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %76, i32 0, i32 5
  %78 = getelementptr inbounds %struct.EFI_IPv6_ADDRESS, ptr %77, i32 0, i32 0
  %79 = getelementptr inbounds [16 x i8], ptr %78, i64 0, i64 0
  %80 = load i8, ptr %79, align 1, !tbaa !40
  %81 = zext i8 %80 to i32
  %82 = icmp eq i32 %81, 255
  br i1 %82, label %83, label %84

83:                                               ; preds = %74, %65
  br label %277

84:                                               ; preds = %74
  %85 = load i32, ptr %19, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = mul i64 %86, 16
  %88 = call ptr @AllocateZeroPool(i64 noundef %87)
  store ptr %88, ptr %17, align 8, !tbaa !5
  %89 = load ptr, ptr %17, align 8, !tbaa !5
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %92

91:                                               ; preds = %84
  store i64 -9223372036854775799, ptr %25, align 8, !tbaa !11
  br label %277

92:                                               ; preds = %84
  %93 = load ptr, ptr %22, align 8, !tbaa !5
  %94 = load ptr, ptr %17, align 8, !tbaa !5
  %95 = call i64 @NetbufBuildExt(ptr noundef %93, ptr noundef %94, ptr noundef %19)
  store i64 %95, ptr %25, align 8, !tbaa !11
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %96, ptr %18, align 8, !tbaa !5
  %97 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %97, ptr %20, align 4, !tbaa !9
  %98 = load i64, ptr %25, align 8, !tbaa !11
  %99 = icmp slt i64 %98, 0
  br i1 %99, label %100, label %102

100:                                              ; preds = %92
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  call void @FreePool(ptr noundef %101)
  br label %277

102:                                              ; preds = %92
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = call ptr @Ip6NtohHead(ptr noundef %104)
  %106 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._EFI_IPSEC2_PROTOCOL, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !41
  %109 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._IP6_SERVICE, ptr %110, i32 0, i32 32
  %112 = load ptr, ptr %111, align 8, !tbaa !42
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  %114 = load ptr, ptr %113, align 8, !tbaa !5
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = load i32, ptr %15, align 4, !tbaa !9
  %119 = call i64 %108(ptr noundef %109, ptr noundef %112, i8 noundef zeroext 6, ptr noundef %114, ptr noundef %115, ptr noundef %116, ptr noundef %117, ptr noundef %17, ptr noundef %19, i32 noundef %118, ptr noundef %21)
  store i64 %119, ptr %25, align 8, !tbaa !11
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  %122 = call ptr @Ip6NtohHead(ptr noundef %121)
  %123 = load i64, ptr %25, align 8, !tbaa !11
  %124 = icmp slt i64 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %102
  %126 = load ptr, ptr %18, align 8, !tbaa !5
  call void @FreePool(ptr noundef %126)
  br label %277

127:                                              ; preds = %102
  %128 = load i32, ptr %20, align 4, !tbaa !9
  %129 = load i32, ptr %19, align 4, !tbaa !9
  %130 = icmp eq i32 %128, %129
  br i1 %130, label %131, label %137

131:                                              ; preds = %127
  %132 = load ptr, ptr %18, align 8, !tbaa !5
  %133 = load ptr, ptr %17, align 8, !tbaa !5
  %134 = icmp eq ptr %132, %133
  br i1 %134, label %135, label %137

135:                                              ; preds = %131
  %136 = load ptr, ptr %17, align 8, !tbaa !5
  call void @FreePool(ptr noundef %136)
  br label %277

137:                                              ; preds = %131, %127
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  call void @FreePool(ptr noundef %138)
  br label %139

139:                                              ; preds = %137
  %140 = load i32, ptr %15, align 4, !tbaa !9
  %141 = icmp eq i32 %140, 1
  br i1 %141, label %142, label %179

142:                                              ; preds = %139
  %143 = load ptr, ptr %23, align 8, !tbaa !5
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %179

145:                                              ; preds = %142
  %146 = load ptr, ptr %21, align 8, !tbaa !5
  %147 = load ptr, ptr %23, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %147, i32 0, i32 2
  store ptr %146, ptr %148, align 8, !tbaa !43
  %149 = load ptr, ptr %17, align 8, !tbaa !5
  %150 = load i32, ptr %19, align 4, !tbaa !9
  %151 = load ptr, ptr %23, align 8, !tbaa !5
  %152 = call ptr @NetbufFromExt(ptr noundef %149, i32 noundef %150, i32 noundef 120, i32 noundef 0, ptr noundef @Ip6FreeTxToken, ptr noundef %151)
  %153 = load ptr, ptr %23, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %153, i32 0, i32 3
  store ptr %152, ptr %154, align 8, !tbaa !45
  %155 = load ptr, ptr %23, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %155, i32 0, i32 3
  %157 = load ptr, ptr %156, align 8, !tbaa !45
  %158 = icmp eq ptr %157, null
  br i1 %158, label %159, label %164

159:                                              ; preds = %145
  %160 = load ptr, ptr %12, align 8, !tbaa !5
  %161 = load ptr, ptr %160, align 8, !tbaa !5
  %162 = load ptr, ptr %23, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %162, i32 0, i32 3
  store ptr %161, ptr %163, align 8, !tbaa !45
  store i64 -9223372036854775799, ptr %25, align 8, !tbaa !11
  br label %277

164:                                              ; preds = %145
  %165 = load ptr, ptr %23, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %165, i32 0, i32 3
  %167 = load ptr, ptr %166, align 8, !tbaa !45
  %168 = getelementptr inbounds %struct.NET_BUF, ptr %167, i32 0, i32 6
  %169 = getelementptr inbounds [64 x i8], ptr %168, i64 0, i64 0
  %170 = load ptr, ptr %22, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.NET_BUF, ptr %170, i32 0, i32 6
  %172 = getelementptr inbounds [64 x i8], ptr %171, i64 0, i64 0
  %173 = call ptr @CopyMem(ptr noundef %169, ptr noundef %172, i64 noundef 48)
  %174 = load ptr, ptr %22, align 8, !tbaa !5
  call void @NetIpSecNetbufFree(ptr noundef %174)
  %175 = load ptr, ptr %23, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.IP6_TXTOKEN_WRAP, ptr %175, i32 0, i32 3
  %177 = load ptr, ptr %176, align 8, !tbaa !45
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %177, ptr %178, align 8, !tbaa !5
  br label %276

179:                                              ; preds = %142, %139
  %180 = call ptr @AllocateZeroPool(i64 noundef 16)
  store ptr %180, ptr %24, align 8, !tbaa !5
  %181 = load ptr, ptr %24, align 8, !tbaa !5
  %182 = icmp eq ptr %181, null
  br i1 %182, label %183, label %189

183:                                              ; preds = %179
  store i64 -9223372036854775799, ptr %25, align 8, !tbaa !11
  %184 = load ptr, ptr @gBS, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %184, i32 0, i32 11
  %186 = load ptr, ptr %185, align 8, !tbaa !46
  %187 = load ptr, ptr %21, align 8, !tbaa !5
  %188 = call i64 %186(ptr noundef %187)
  br label %277

189:                                              ; preds = %179
  %190 = load ptr, ptr %21, align 8, !tbaa !5
  %191 = load ptr, ptr %24, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.IP6_IPSEC_WRAP, ptr %191, i32 0, i32 0
  store ptr %190, ptr %192, align 8, !tbaa !47
  %193 = load ptr, ptr %22, align 8, !tbaa !5
  %194 = load ptr, ptr %24, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.IP6_IPSEC_WRAP, ptr %194, i32 0, i32 1
  store ptr %193, ptr %195, align 8, !tbaa !49
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  %197 = load i32, ptr %19, align 4, !tbaa !9
  %198 = load ptr, ptr %24, align 8, !tbaa !5
  %199 = call ptr @NetbufFromExt(ptr noundef %196, i32 noundef %197, i32 noundef 120, i32 noundef 0, ptr noundef @Ip6IpSecFree, ptr noundef %198)
  store ptr %199, ptr %22, align 8, !tbaa !5
  %200 = load ptr, ptr %22, align 8, !tbaa !5
  %201 = icmp eq ptr %200, null
  br i1 %201, label %202, label %212

202:                                              ; preds = %189
  %203 = load ptr, ptr %24, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.IP6_IPSEC_WRAP, ptr %203, i32 0, i32 1
  %205 = load ptr, ptr %204, align 8, !tbaa !49
  store ptr %205, ptr %22, align 8, !tbaa !5
  %206 = load ptr, ptr @gBS, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %206, i32 0, i32 11
  %208 = load ptr, ptr %207, align 8, !tbaa !46
  %209 = load ptr, ptr %21, align 8, !tbaa !5
  %210 = call i64 %208(ptr noundef %209)
  %211 = load ptr, ptr %24, align 8, !tbaa !5
  call void @FreePool(ptr noundef %211)
  store i64 -9223372036854775799, ptr %25, align 8, !tbaa !11
  br label %277

212:                                              ; preds = %189
  %213 = load i32, ptr %15, align 4, !tbaa !9
  %214 = icmp eq i32 %213, 0
  br i1 %214, label %215, label %273

215:                                              ; preds = %212
  %216 = load ptr, ptr %10, align 8, !tbaa !5
  %217 = load ptr, ptr %216, align 8, !tbaa !5
  %218 = call i64 @CompareMem(ptr noundef %28, ptr noundef %217, i64 noundef 40)
  %219 = icmp ne i64 0, %218
  br i1 %219, label %220, label %273

220:                                              ; preds = %215
  %221 = load ptr, ptr %22, align 8, !tbaa !5
  %222 = load ptr, ptr %14, align 8, !tbaa !5
  %223 = load i32, ptr %222, align 4, !tbaa !9
  %224 = zext i32 %223 to i64
  %225 = add i64 40, %224
  %226 = trunc i64 %225 to i32
  %227 = call ptr @NetbufAllocSpace(ptr noundef %221, i32 noundef %226, i8 noundef zeroext 1)
  store ptr %227, ptr %26, align 8, !tbaa !5
  %228 = load ptr, ptr %26, align 8, !tbaa !5
  %229 = icmp eq ptr %228, null
  br i1 %229, label %230, label %233

230:                                              ; preds = %220
  %231 = load ptr, ptr %22, align 8, !tbaa !5
  %232 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %231, ptr %232, align 8, !tbaa !5
  store i64 -9223372036854775799, ptr %25, align 8, !tbaa !11
  br label %277

233:                                              ; preds = %220
  %234 = load ptr, ptr %26, align 8, !tbaa !5
  %235 = load ptr, ptr %10, align 8, !tbaa !5
  %236 = load ptr, ptr %235, align 8, !tbaa !5
  %237 = call ptr @CopyMem(ptr noundef %234, ptr noundef %236, i64 noundef 40)
  %238 = load ptr, ptr %26, align 8, !tbaa !5
  %239 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %238, ptr %239, align 8, !tbaa !5
  %240 = load ptr, ptr %26, align 8, !tbaa !5
  %241 = load ptr, ptr %22, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.NET_BUF, ptr %241, i32 0, i32 3
  store ptr %240, ptr %242, align 8, !tbaa !40
  %243 = load ptr, ptr %13, align 8, !tbaa !5
  %244 = load ptr, ptr %243, align 8, !tbaa !5
  %245 = icmp ne ptr %244, null
  br i1 %245, label %246, label %256

246:                                              ; preds = %233
  %247 = load ptr, ptr %26, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct._EFI_IP6_HEADER, ptr %247, i64 1
  store ptr %248, ptr %27, align 8, !tbaa !5
  %249 = load ptr, ptr %27, align 8, !tbaa !5
  %250 = load ptr, ptr %13, align 8, !tbaa !5
  %251 = load ptr, ptr %250, align 8, !tbaa !5
  %252 = load ptr, ptr %14, align 8, !tbaa !5
  %253 = load i32, ptr %252, align 4, !tbaa !9
  %254 = zext i32 %253 to i64
  %255 = call ptr @CopyMem(ptr noundef %249, ptr noundef %251, i64 noundef %254)
  br label %256

256:                                              ; preds = %246, %233
  %257 = load ptr, ptr %22, align 8, !tbaa !5
  %258 = load ptr, ptr %14, align 8, !tbaa !5
  %259 = load i32, ptr %258, align 4, !tbaa !9
  %260 = zext i32 %259 to i64
  %261 = add i64 40, %260
  %262 = trunc i64 %261 to i32
  %263 = call i32 @NetbufTrim(ptr noundef %257, i32 noundef %262, i8 noundef zeroext 1)
  %264 = load ptr, ptr %22, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.NET_BUF, ptr %264, i32 0, i32 6
  %266 = getelementptr inbounds [64 x i8], ptr %265, i64 0, i64 0
  %267 = load ptr, ptr %24, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.IP6_IPSEC_WRAP, ptr %267, i32 0, i32 1
  %269 = load ptr, ptr %268, align 8, !tbaa !49
  %270 = getelementptr inbounds %struct.NET_BUF, ptr %269, i32 0, i32 6
  %271 = getelementptr inbounds [64 x i8], ptr %270, i64 0, i64 0
  %272 = call ptr @CopyMem(ptr noundef %266, ptr noundef %271, i64 noundef 48)
  br label %273

273:                                              ; preds = %256, %215, %212
  %274 = load ptr, ptr %22, align 8, !tbaa !5
  %275 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %274, ptr %275, align 8, !tbaa !5
  br label %276

276:                                              ; preds = %273, %164
  br label %277

277:                                              ; preds = %276, %230, %202, %183, %159, %135, %125, %100, %91, %83, %52, %45
  %278 = load i64, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 40, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  ret i64 %278
}

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

declare ptr @AllocateZeroPool(i64 noundef) #1

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

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

declare void @Ip6FreeTxToken(ptr noundef) #1

declare void @NetIpSecNetbufFree(ptr noundef) #1

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 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 = !{!"long long", !7, i64 0}
!13 = !{!14, !10, i64 128}
!14 = !{!"", !10, i64 0, !12, i64 8, !15, 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 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!16 = !{!17, !6, i64 320}
!17 = !{!"", !18, 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}
!18 = !{!"", !12, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!19 = !{!20, !7, i64 16}
!20 = !{!"_EFI_IPSEC2_PROTOCOL", !6, i64 0, !6, i64 8, !7, i64 16}
!21 = !{!22, !10, i64 4188}
!22 = !{!"_IP6_SERVICE", !10, i64 0, !23, i64 8, !12, i64 24, !12, i64 32, !15, i64 40, !15, 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, !15, i64 2232, !15, i64 2248, !15, i64 2264, !15, 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, !30, i64 2372, !6, i64 3032, !6, i64 3040, !31, 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, !12, i64 8, !7, i64 16}
!26 = !{!"", !7, i64 0}
!27 = !{!"", !12, i64 0, !15, i64 8}
!28 = !{!"", !10, i64 0, !10, i64 4, !29, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!29 = !{!"short", !7, i64 0}
!30 = !{!"", !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}
!31 = !{!"_IP6_CONFIG_INSTANCE", !10, i64 0, !7, i64 4, !15, i64 8, !29, i64 24, !32, i64 32, !26, i64 168, !10, i64 176, !33, i64 180, !7, i64 184, !34, i64 800, !34, i64 840, !35, 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, !36, i64 984, !38, i64 1040}
!32 = !{!"", !7, i64 0, !7, i64 64, !10, i64 68, !26, i64 72, !10, i64 104, !6, i64 112, !10, i64 120, !6, i64 128}
!33 = !{!"", !10, i64 0}
!34 = !{!"", !15, i64 0, !15, i64 16, !12, i64 32}
!35 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!36 = !{!"_IP6_FORM_CALLBACK_INFO", !10, i64 0, !6, i64 8, !37, i64 16, !6, i64 40, !6, i64 48}
!37 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!"", !10, i64 0, !33, i64 4, !26, i64 8, !15, i64 16, !10, i64 32, !15, i64 40, !10, i64 56, !15, i64 64, !10, i64 80}
!39 = !{!22, !10, i64 4184}
!40 = !{!7, !7, i64 0}
!41 = !{!20, !6, i64 0}
!42 = !{!22, !6, i64 2328}
!43 = !{!44, !6, i64 16}
!44 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !12, i64 40}
!45 = !{!44, !6, i64 24}
!46 = !{!17, !6, i64 104}
!47 = !{!48, !6, i64 0}
!48 = !{!"", !6, i64 0, !6, i64 8}
!49 = !{!48, !6, i64 8}


; 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.GUID = type { i32, i16, i16, [8 x i8] }
%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] }

@gBS = external local_unnamed_addr global ptr, align 8
@mIpSec = external global ptr, align 8
@gEfiIpSec2ProtocolGuid = external global %struct.GUID, align 4

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

declare ptr @CopyMem(ptr noundef, ptr noundef, 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

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

declare ptr @Ip6NtohHead(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6IpSecFree(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6IpSecProcessPacket(ptr nocapture noundef %0, ptr nocapture noundef %1, ptr noundef %2, ptr nocapture noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, ptr noundef %7) local_unnamed_addr #2 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %struct._EFI_IP6_HEADER, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %12) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %11, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 128
  %15 = load i32, ptr %14, align 8, !tbaa !9
  store i32 %15, ptr %10, align 4, !tbaa !14
  %16 = call ptr @ZeroMem(ptr noundef nonnull %12, i64 noundef 40) #3
  %17 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %26

19:                                               ; preds = %8
  %20 = load ptr, ptr @gBS, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 320
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = call i64 %22(ptr noundef nonnull @gEfiIpSec2ProtocolGuid, ptr noundef null, ptr noundef nonnull @mIpSec) #3
  %24 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %145, label %26

26:                                               ; preds = %19, %8
  %27 = phi ptr [ %24, %19 ], [ %17, %8 ]
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load i8, ptr %28, align 8, !tbaa !18
  %.not = icmp eq i8 %29, 0
  %30 = getelementptr inbounds i8, ptr %0, i64 4188
  %31 = load i32, ptr %30, align 4, !tbaa !20
  br i1 %.not, label %34, label %32

32:                                               ; preds = %26
  %33 = getelementptr inbounds i8, ptr %0, i64 4184
  store i32 %31, ptr %33, align 8, !tbaa !38
  br label %145

34:                                               ; preds = %26
  %35 = add i32 %31, -54
  %36 = getelementptr inbounds i8, ptr %0, i64 4184
  store i32 %35, ptr %36, align 8, !tbaa !38
  %37 = load ptr, ptr %1, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 24
  %39 = load i8, ptr %38, align 1, !tbaa !39
  %40 = icmp eq i8 %39, -1
  br i1 %40, label %145, label %41

41:                                               ; preds = %34
  %42 = getelementptr inbounds i8, ptr %37, i64 8
  %43 = load i8, ptr %42, align 1, !tbaa !39
  %44 = icmp eq i8 %43, -1
  br i1 %44, label %145, label %45

45:                                               ; preds = %41
  %46 = zext i32 %15 to i64
  %47 = shl nuw nsw i64 %46, 4
  %48 = call ptr @AllocateZeroPool(i64 noundef %47) #3
  store ptr %48, ptr %9, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %145, label %50

50:                                               ; preds = %45
  %51 = call i64 @NetbufBuildExt(ptr noundef nonnull %13, ptr noundef nonnull %48, ptr noundef nonnull %10) #3
  %52 = load i32, ptr %10, align 4, !tbaa !14
  %53 = icmp slt i64 %51, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %50
  call void @FreePool(ptr noundef nonnull %48) #3
  br label %145

55:                                               ; preds = %50
  %56 = load ptr, ptr %1, align 8, !tbaa !5
  %57 = call ptr @Ip6NtohHead(ptr noundef %56) #3
  %58 = load ptr, ptr @mIpSec, align 8, !tbaa !5
  %59 = load ptr, ptr %58, align 8, !tbaa !40
  %60 = getelementptr inbounds i8, ptr %0, i64 2328
  %61 = load ptr, ptr %60, align 8, !tbaa !41
  %62 = load ptr, ptr %1, align 8, !tbaa !5
  %63 = call i64 %59(ptr noundef nonnull %58, ptr noundef %61, i8 noundef zeroext 6, ptr noundef %62, ptr noundef %2, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef %6, ptr noundef nonnull %11) #3
  %64 = load ptr, ptr %1, align 8, !tbaa !5
  %65 = call ptr @Ip6NtohHead(ptr noundef %64) #3
  %66 = icmp slt i64 %63, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %55
  call void @FreePool(ptr noundef nonnull %48) #3
  br label %145

68:                                               ; preds = %55
  %69 = load i32, ptr %10, align 4, !tbaa !14
  %70 = icmp eq i32 %52, %69
  br i1 %70, label %71, label %75

71:                                               ; preds = %68
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = icmp eq ptr %48, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  call void @FreePool(ptr noundef %72) #3
  br label %145

75:                                               ; preds = %71, %68
  call void @FreePool(ptr noundef nonnull %48) #3
  %76 = icmp eq i32 %6, 1
  %77 = icmp ne ptr %7, null
  %or.cond = and i1 %76, %77
  br i1 %or.cond, label %78, label %93

78:                                               ; preds = %75
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %79, ptr %80, align 8, !tbaa !42
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = load i32, ptr %10, align 4, !tbaa !14
  %83 = call ptr @NetbufFromExt(ptr noundef %81, i32 noundef %82, i32 noundef 120, i32 noundef 0, ptr noundef nonnull @Ip6FreeTxToken, ptr noundef nonnull %7) #3
  %84 = getelementptr inbounds i8, ptr %7, i64 24
  store ptr %83, ptr %84, align 8, !tbaa !44
  %85 = icmp eq ptr %83, null
  br i1 %85, label %86, label %88

86:                                               ; preds = %78
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %87, ptr %84, align 8, !tbaa !44
  br label %145

88:                                               ; preds = %78
  %89 = getelementptr inbounds i8, ptr %83, i64 56
  %90 = getelementptr inbounds i8, ptr %13, i64 56
  %91 = call ptr @CopyMem(ptr noundef nonnull %89, ptr noundef nonnull %90, i64 noundef 48) #3
  call void @NetIpSecNetbufFree(ptr noundef nonnull %13) #3
  %92 = load ptr, ptr %84, align 8, !tbaa !44
  store ptr %92, ptr %3, align 8, !tbaa !5
  br label %145

93:                                               ; preds = %75
  %94 = call ptr @AllocateZeroPool(i64 noundef 16) #3
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %102

96:                                               ; preds = %93
  %97 = load ptr, ptr @gBS, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %97, i64 104
  %99 = load ptr, ptr %98, align 8, !tbaa !45
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = call i64 %99(ptr noundef %100) #3
  br label %145

102:                                              ; preds = %93
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %103, ptr %94, align 8, !tbaa !46
  %104 = getelementptr inbounds i8, ptr %94, i64 8
  store ptr %13, ptr %104, align 8, !tbaa !48
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = load i32, ptr %10, align 4, !tbaa !14
  %107 = call ptr @NetbufFromExt(ptr noundef %105, i32 noundef %106, i32 noundef 120, i32 noundef 0, ptr noundef nonnull @Ip6IpSecFree, ptr noundef nonnull %94) #3
  %108 = icmp eq ptr %107, null
  br i1 %108, label %109, label %115

109:                                              ; preds = %102
  %110 = load ptr, ptr @gBS, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i64 104
  %112 = load ptr, ptr %111, align 8, !tbaa !45
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = call i64 %112(ptr noundef %113) #3
  call void @FreePool(ptr noundef nonnull %94) #3
  br label %145

115:                                              ; preds = %102
  %116 = icmp eq i32 %6, 0
  br i1 %116, label %117, label %144

117:                                              ; preds = %115
  %118 = load ptr, ptr %1, align 8, !tbaa !5
  %119 = call i64 @CompareMem(ptr noundef nonnull %12, ptr noundef %118, i64 noundef 40) #3
  %.not80 = icmp eq i64 %119, 0
  br i1 %.not80, label %144, label %120

120:                                              ; preds = %117
  %121 = load i32, ptr %5, align 4, !tbaa !14
  %122 = add i32 %121, 40
  %123 = call ptr @NetbufAllocSpace(ptr noundef nonnull %107, i32 noundef %122, i8 noundef zeroext 1) #3
  %124 = icmp eq ptr %123, null
  br i1 %124, label %125, label %126

125:                                              ; preds = %120
  store ptr %107, ptr %3, align 8, !tbaa !5
  br label %145

126:                                              ; preds = %120
  %127 = load ptr, ptr %1, align 8, !tbaa !5
  %128 = call ptr @CopyMem(ptr noundef nonnull %123, ptr noundef %127, i64 noundef 40) #3
  store ptr %123, ptr %1, align 8, !tbaa !5
  %129 = getelementptr inbounds i8, ptr %107, i64 32
  store ptr %123, ptr %129, align 8, !tbaa !39
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %.not81 = icmp eq ptr %130, null
  br i1 %.not81, label %136, label %131

131:                                              ; preds = %126
  %132 = getelementptr inbounds i8, ptr %123, i64 40
  %133 = load i32, ptr %5, align 4, !tbaa !14
  %134 = zext i32 %133 to i64
  %135 = call ptr @CopyMem(ptr noundef nonnull %132, ptr noundef nonnull %130, i64 noundef %134) #3
  br label %136

136:                                              ; preds = %131, %126
  %137 = load i32, ptr %5, align 4, !tbaa !14
  %138 = add i32 %137, 40
  %139 = call i32 @NetbufTrim(ptr noundef nonnull %107, i32 noundef %138, i8 noundef zeroext 1) #3
  %140 = getelementptr inbounds i8, ptr %107, i64 56
  %141 = load ptr, ptr %104, align 8, !tbaa !48
  %142 = getelementptr inbounds i8, ptr %141, i64 56
  %143 = call ptr @CopyMem(ptr noundef nonnull %140, ptr noundef nonnull %142, i64 noundef 48) #3
  br label %144

144:                                              ; preds = %136, %117, %115
  store ptr %107, ptr %3, align 8, !tbaa !5
  br label %145

145:                                              ; preds = %45, %88, %144, %34, %41, %19, %125, %109, %96, %86, %74, %67, %54, %32
  %.0 = phi i64 [ 0, %19 ], [ 0, %32 ], [ 0, %34 ], [ 0, %41 ], [ %51, %54 ], [ %63, %67 ], [ %63, %74 ], [ -9223372036854775799, %86 ], [ %63, %88 ], [ -9223372036854775799, %96 ], [ -9223372036854775799, %109 ], [ -9223372036854775799, %125 ], [ %63, %144 ], [ -9223372036854775799, %45 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  ret i64 %.0
}

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

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

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

declare void @Ip6FreeTxToken(ptr noundef) #1

declare void @NetIpSecNetbufFree(ptr noundef) local_unnamed_addr #1

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 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 128}
!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 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 320}
!16 = !{!"", !17, 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}
!17 = !{!"", !12, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!18 = !{!19, !7, i64 16}
!19 = !{!"_EFI_IPSEC2_PROTOCOL", !6, i64 0, !6, i64 8, !7, i64 16}
!20 = !{!21, !11, i64 4188}
!21 = !{!"_IP6_SERVICE", !11, i64 0, !22, i64 8, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !6, i64 72, !6, i64 80, !23, i64 88, !25, i64 136, !26, i64 2168, !25, 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, !27, i64 2352, !29, i64 2372, !6, i64 3032, !6, i64 3040, !30, i64 3048, !6, i64 4176, !11, i64 4184, !11, i64 4188}
!22 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!23 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !24, i64 24}
!24 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!25 = !{!"", !7, i64 0}
!26 = !{!"", !12, i64 0, !13, i64 8}
!27 = !{!"", !11, i64 0, !11, i64 4, !28, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!28 = !{!"short", !7, i64 0}
!29 = !{!"", !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, !25, i64 552, !25, i64 584, !25, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!"_IP6_CONFIG_INSTANCE", !11, i64 0, !7, i64 4, !13, i64 8, !28, i64 24, !31, i64 32, !25, i64 168, !11, 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, !11, i64 948, !6, i64 952, !11, i64 960, !6, i64 968, !11, i64 976, !35, i64 984, !37, i64 1040}
!31 = !{!"", !7, i64 0, !7, i64 64, !11, i64 68, !25, i64 72, !11, i64 104, !6, i64 112, !11, i64 120, !6, i64 128}
!32 = !{!"", !11, i64 0}
!33 = !{!"", !13, i64 0, !13, i64 16, !12, i64 32}
!34 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!35 = !{!"_IP6_FORM_CALLBACK_INFO", !11, 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 = !{!"", !11, i64 0, !32, i64 4, !25, i64 8, !13, i64 16, !11, i64 32, !13, i64 40, !11, i64 56, !13, i64 64, !11, i64 80}
!38 = !{!21, !11, i64 4184}
!39 = !{!7, !7, i64 0}
!40 = !{!19, !6, i64 0}
!41 = !{!21, !6, i64 2328}
!42 = !{!43, !6, i64 16}
!43 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !12, i64 40}
!44 = !{!43, !6, i64 24}
!45 = !{!16, !6, i64 104}
!46 = !{!47, !6, i64 0}
!47 = !{!"", !6, i64 0, !6, i64 8}
!48 = !{!47, !6, i64 8}


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