; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/OptionRomPkg/Bus/Usb (ReceiveFilters)

; 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_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.NIC_DEVICE = type { i64, ptr, ptr, %struct._EFI_SIMPLE_NETWORK_PROTOCOL, %struct._EFI_SIMPLE_NETWORK_PROTOCOL, %struct.EFI_SIMPLE_NETWORK_MODE, i8, ptr, i16, i8, i8, i8, i8, i64, i64, i16, ptr, ptr, [8 x i8], %struct.EFI_MAC_ADDRESS, i8, ptr, ptr, ptr, ptr, ptr, i64, ptr }
%struct._EFI_SIMPLE_NETWORK_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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] }

@.str = external hidden unnamed_addr constant [161 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local i64 @ReceiveFilterUpdate(ptr noundef) #0

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @SN_ReceiveFilters(ptr noundef %0, i32 noundef %1, i32 noundef %2, i8 noundef zeroext %3, i64 noundef %4, ptr noundef %5) #0 {
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i8, align 1
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i8 %3, ptr %11, align 1, !tbaa !11
  store i64 %4, ptr %12, align 8, !tbaa !12
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store i64 0, ptr %15, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %22 = load ptr, ptr @gBS, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %25 = call i64 %24(i64 noundef 8)
  store i64 %25, ptr %16, align 8, !tbaa !12
  %26 = call zeroext i8 @DebugAssertEnabled()
  %27 = zext i8 %26 to i32
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %39

29:                                               ; preds = %6
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = ptrtoint ptr %30 to i64
  %32 = sub i64 %31, ptrtoint (ptr getelementptr inbounds (%struct.NIC_DEVICE, ptr null, i32 0, i32 3) to i64)
  %33 = inttoptr i64 %32 to ptr
  %34 = getelementptr inbounds %struct.NIC_DEVICE, ptr %33, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !17
  %36 = icmp ne i64 %35, 943216705
  br i1 %36, label %37, label %39

37:                                               ; preds = %29
  call void @DebugAssert(ptr noundef @.str, i64 noundef 706, ptr noundef @.str.1)
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  br label %44

39:                                               ; preds = %29, %6
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = ptrtoint ptr %40 to i64
  %42 = sub i64 %41, ptrtoint (ptr getelementptr inbounds (%struct.NIC_DEVICE, ptr null, i32 0, i32 3) to i64)
  %43 = inttoptr i64 %42 to ptr
  br label %44

44:                                               ; preds = %39, %37
  %45 = phi ptr [ %38, %37 ], [ %43, %39 ]
  store ptr %45, ptr %17, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._EFI_SIMPLE_NETWORK_PROTOCOL, ptr %46, i32 0, i32 15
  %48 = load ptr, ptr %47, align 8, !tbaa !23
  store ptr %48, ptr %14, align 8, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %56

51:                                               ; preds = %44
  %52 = load ptr, ptr @gBS, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = load i64, ptr %16, align 8, !tbaa !12
  call void %54(i64 noundef %55)
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

56:                                               ; preds = %44
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !25
  switch i32 %59, label %66 [
    i32 2, label %72
    i32 0, label %60
  ]

60:                                               ; preds = %56
  store i64 -9223372036854775789, ptr %15, align 8, !tbaa !12
  %61 = load ptr, ptr @gBS, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %61, i32 0, i32 2
  %63 = load ptr, ptr %62, align 8, !tbaa !24
  %64 = load i64, ptr %16, align 8, !tbaa !12
  call void %63(i64 noundef %64)
  %65 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %65, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

66:                                               ; preds = %56
  store i64 -9223372036854775801, ptr %15, align 8, !tbaa !12
  %67 = load ptr, ptr @gBS, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !24
  %70 = load i64, ptr %16, align 8, !tbaa !12
  call void %69(i64 noundef %70)
  %71 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %71, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

72:                                               ; preds = %56
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %74, i32 0, i32 6
  %76 = load i32, ptr %75, align 4, !tbaa !26
  %77 = xor i32 %76, -1
  %78 = and i32 %73, %77
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %88, label %80

80:                                               ; preds = %72
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %83, align 4, !tbaa !26
  %85 = xor i32 %84, -1
  %86 = and i32 %81, %85
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %94

88:                                               ; preds = %80, %72
  store i64 -9223372036854775806, ptr %15, align 8, !tbaa !12
  %89 = load ptr, ptr @gBS, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !24
  %92 = load i64, ptr %16, align 8, !tbaa !12
  call void %91(i64 noundef %92)
  %93 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %93, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

94:                                               ; preds = %80
  %95 = load i8, ptr %11, align 1, !tbaa !11
  %96 = icmp ne i8 %95, 0
  br i1 %96, label %97, label %123

97:                                               ; preds = %94
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %98, i32 0, i32 6
  %100 = load i32, ptr %99, align 4, !tbaa !26
  %101 = and i32 2, %100
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = or i32 %102, %101
  store i32 %103, ptr %10, align 4, !tbaa !9
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %104, i32 0, i32 9
  store i32 0, ptr %105, align 4, !tbaa !27
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %106, i32 0, i32 7
  %108 = load i32, ptr %107, align 4, !tbaa !28
  %109 = and i32 %108, 2
  %110 = icmp eq i32 0, %109
  br i1 %110, label %111, label %122

111:                                              ; preds = %97
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = icmp eq i32 %112, 0
  br i1 %113, label %114, label %122

114:                                              ; preds = %111
  %115 = load i32, ptr %10, align 4, !tbaa !9
  %116 = icmp eq i32 %115, 2
  br i1 %116, label %117, label %122

117:                                              ; preds = %114
  %118 = load ptr, ptr @gBS, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %118, i32 0, i32 2
  %120 = load ptr, ptr %119, align 8, !tbaa !24
  %121 = load i64, ptr %16, align 8, !tbaa !12
  call void %120(i64 noundef %121)
  store i64 0, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

122:                                              ; preds = %114, %111, %97
  br label %187

123:                                              ; preds = %94
  %124 = load i64, ptr %12, align 8, !tbaa !12
  %125 = icmp ne i64 %124, 0
  br i1 %125, label %126, label %186

126:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %127, ptr %20, align 8, !tbaa !5
  %128 = load i64, ptr %12, align 8, !tbaa !12
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %129, i32 0, i32 8
  %131 = load i32, ptr %130, align 4, !tbaa !29
  %132 = zext i32 %131 to i64
  %133 = icmp ugt i64 %128, %132
  br i1 %133, label %137, label %134

134:                                              ; preds = %126
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = icmp eq ptr %135, null
  br i1 %136, label %137, label %143

137:                                              ; preds = %134, %126
  store i64 -9223372036854775806, ptr %15, align 8, !tbaa !12
  %138 = load ptr, ptr @gBS, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !24
  %141 = load i64, ptr %16, align 8, !tbaa !12
  call void %140(i64 noundef %141)
  %142 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %142, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %183

143:                                              ; preds = %134
  store i64 0, ptr %19, align 8, !tbaa !12
  br label %144

144:                                              ; preds = %168, %143
  %145 = load i64, ptr %19, align 8, !tbaa !12
  %146 = load i64, ptr %12, align 8, !tbaa !12
  %147 = icmp ult i64 %145, %146
  br i1 %147, label %148, label %171

148:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #3
  %149 = load ptr, ptr %20, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %149, i32 0, i32 0
  %151 = getelementptr inbounds [32 x i8], ptr %150, i64 0, i64 0
  %152 = load i8, ptr %151, align 1, !tbaa !11
  store i8 %152, ptr %21, align 1, !tbaa !11
  %153 = load i8, ptr %21, align 1, !tbaa !11
  %154 = zext i8 %153 to i32
  %155 = and i32 %154, 1
  %156 = icmp ne i32 %155, 1
  br i1 %156, label %157, label %162

157:                                              ; preds = %148
  %158 = load ptr, ptr @gBS, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !24
  %161 = load i64, ptr %16, align 8, !tbaa !12
  call void %160(i64 noundef %161)
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %165

162:                                              ; preds = %148
  %163 = load ptr, ptr %20, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %163, i32 1
  store ptr %164, ptr %20, align 8, !tbaa !5
  store i32 0, ptr %18, align 4
  br label %165

165:                                              ; preds = %162, %157
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #3
  %166 = load i32, ptr %18, align 4
  switch i32 %166, label %183 [
    i32 0, label %167
  ]

167:                                              ; preds = %165
  br label %168

168:                                              ; preds = %167
  %169 = load i64, ptr %19, align 8, !tbaa !12
  %170 = add i64 %169, 1
  store i64 %170, ptr %19, align 8, !tbaa !12
  br label %144, !llvm.loop !30

171:                                              ; preds = %144
  %172 = load i64, ptr %12, align 8, !tbaa !12
  %173 = trunc i64 %172 to i32
  %174 = load ptr, ptr %14, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %174, i32 0, i32 9
  store i32 %173, ptr %175, align 4, !tbaa !27
  %176 = load ptr, ptr %14, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %176, i32 0, i32 10
  %178 = getelementptr inbounds [16 x %struct.EFI_MAC_ADDRESS], ptr %177, i64 0, i64 0
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  %180 = load i64, ptr %12, align 8, !tbaa !12
  %181 = mul i64 %180, 32
  %182 = call ptr @CopyMem(ptr noundef %178, ptr noundef %179, i64 noundef %181)
  store i32 0, ptr %18, align 4
  br label %183

183:                                              ; preds = %171, %165, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  %184 = load i32, ptr %18, align 4
  switch i32 %184, label %244 [
    i32 0, label %185
  ]

185:                                              ; preds = %183
  br label %186

186:                                              ; preds = %185, %123
  br label %187

187:                                              ; preds = %186, %122
  %188 = load i32, ptr %9, align 4, !tbaa !9
  %189 = icmp eq i32 %188, 0
  br i1 %189, label %190, label %205

190:                                              ; preds = %187
  %191 = load i32, ptr %10, align 4, !tbaa !9
  %192 = icmp eq i32 %191, 0
  br i1 %192, label %193, label %205

193:                                              ; preds = %190
  %194 = load i8, ptr %11, align 1, !tbaa !11
  %195 = icmp ne i8 %194, 0
  br i1 %195, label %205, label %196

196:                                              ; preds = %193
  %197 = load i64, ptr %12, align 8, !tbaa !12
  %198 = icmp eq i64 %197, 0
  br i1 %198, label %199, label %205

199:                                              ; preds = %196
  store i64 0, ptr %15, align 8, !tbaa !12
  %200 = load ptr, ptr @gBS, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %200, i32 0, i32 2
  %202 = load ptr, ptr %201, align 8, !tbaa !24
  %203 = load i64, ptr %16, align 8, !tbaa !12
  call void %202(i64 noundef %203)
  %204 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %204, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

205:                                              ; preds = %196, %193, %190, %187
  %206 = load i32, ptr %9, align 4, !tbaa !9
  %207 = and i32 %206, 2
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %218

209:                                              ; preds = %205
  %210 = load i64, ptr %12, align 8, !tbaa !12
  %211 = icmp eq i64 %210, 0
  br i1 %211, label %212, label %218

212:                                              ; preds = %209
  store i64 -9223372036854775806, ptr %15, align 8, !tbaa !12
  %213 = load ptr, ptr @gBS, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %213, i32 0, i32 2
  %215 = load ptr, ptr %214, align 8, !tbaa !24
  %216 = load i64, ptr %16, align 8, !tbaa !12
  call void %215(i64 noundef %216)
  %217 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %217, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

218:                                              ; preds = %209, %205
  %219 = load i32, ptr %9, align 4, !tbaa !9
  %220 = load ptr, ptr %14, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %220, i32 0, i32 7
  %222 = load i32, ptr %221, align 4, !tbaa !28
  %223 = or i32 %222, %219
  store i32 %223, ptr %221, align 4, !tbaa !28
  %224 = load i32, ptr %10, align 4, !tbaa !9
  %225 = xor i32 %224, -1
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %226, i32 0, i32 7
  %228 = load i32, ptr %227, align 4, !tbaa !28
  %229 = and i32 %228, %225
  store i32 %229, ptr %227, align 4, !tbaa !28
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = call i64 @ReceiveFilterUpdate(ptr noundef %230)
  store i64 %231, ptr %15, align 8, !tbaa !12
  %232 = load i64, ptr %15, align 8, !tbaa !12
  %233 = icmp eq i64 -9223372036854775801, %232
  br i1 %233, label %237, label %234

234:                                              ; preds = %218
  %235 = load i64, ptr %15, align 8, !tbaa !12
  %236 = icmp eq i64 -9223372036854775806, %235
  br i1 %236, label %237, label %238

237:                                              ; preds = %234, %218
  store i64 0, ptr %15, align 8, !tbaa !12
  br label %238

238:                                              ; preds = %237, %234
  %239 = load ptr, ptr @gBS, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %239, i32 0, i32 2
  %241 = load ptr, ptr %240, align 8, !tbaa !24
  %242 = load i64, ptr %16, align 8, !tbaa !12
  call void %241(i64 noundef %242)
  %243 = load i64, ptr %15, align 8, !tbaa !12
  store i64 %243, ptr %7, align 8
  store i32 1, ptr %18, align 4
  br label %244

244:                                              ; preds = %238, %212, %199, %183, %117, %88, %66, %60, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %245 = load i64, ptr %7, align 8
  ret i64 %245
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"", !16, 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}
!16 = !{!"", !13, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!17 = !{!18, !13, i64 0}
!18 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !19, i64 24, !19, i64 152, !20, i64 280, !7, i64 936, !6, i64 944, !22, i64 952, !7, i64 954, !7, i64 955, !7, i64 956, !7, i64 957, !13, i64 960, !13, i64 968, !22, i64 976, !6, i64 984, !6, i64 992, !7, i64 1000, !21, i64 1008, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !13, i64 1088, !6, i64 1096}
!19 = !{!"_EFI_SIMPLE_NETWORK_PROTOCOL", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!20 = !{!"", !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, !21, i64 552, !21, i64 584, !21, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!21 = !{!"", !7, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!19, !6, i64 120}
!24 = !{!15, !6, i64 32}
!25 = !{!20, !10, i64 0}
!26 = !{!20, !10, i64 24}
!27 = !{!20, !10, i64 36}
!28 = !{!20, !10, i64 28}
!29 = !{!20, !10, i64 32}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [161 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @SN_ReceiveFilters(ptr noundef %0, i32 noundef %1, i32 noundef %2, i8 noundef zeroext %3, i64 noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = load ptr, ptr @gBS, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = tail call i64 %9(i64 noundef 8) #2
  %11 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %11, 0
  br i1 %.not, label %18, label %12

12:                                               ; preds = %6
  %13 = ptrtoint ptr %0 to i64
  %14 = add i64 %13, -24
  %15 = inttoptr i64 %14 to ptr
  %16 = load i64, ptr %15, align 8, !tbaa !14
  %.not90 = icmp eq i64 %16, 943216705
  br i1 %.not90, label %18, label %17

17:                                               ; preds = %12
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 706, ptr noundef nonnull @.str.1) #2
  br label %18

18:                                               ; preds = %17, %12, %6
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %21 = load i32, ptr %20, align 4, !tbaa !21
  switch i32 %21, label %22 [
    i32 2, label %23
    i32 0, label %.critedge
  ]

22:                                               ; preds = %18
  br label %.critedge

23:                                               ; preds = %18
  %24 = getelementptr inbounds i8, ptr %20, i64 24
  %25 = load i32, ptr %24, align 4, !tbaa !22
  %26 = xor i32 %25, -1
  %27 = or i32 %2, %1
  %28 = and i32 %27, %26
  %or.cond97 = icmp eq i32 %28, 0
  br i1 %or.cond97, label %29, label %.critedge

29:                                               ; preds = %23
  %30 = icmp eq i8 %3, 0
  br i1 %30, label %40, label %31

31:                                               ; preds = %29
  %32 = and i32 %25, 2
  %33 = or i32 %32, %2
  %34 = getelementptr inbounds i8, ptr %20, i64 36
  store i32 0, ptr %34, align 4, !tbaa !23
  %35 = getelementptr inbounds i8, ptr %20, i64 28
  %36 = load i32, ptr %35, align 4, !tbaa !24
  %37 = and i32 %36, 2
  %38 = or i32 %37, %1
  %or.cond = icmp eq i32 %38, 0
  %39 = icmp eq i32 %33, 2
  %or.cond4 = and i1 %39, %or.cond
  br i1 %or.cond4, label %.critedge, label %.thread99

40:                                               ; preds = %29
  %.not93 = icmp eq i64 %4, 0
  br i1 %.not93, label %59, label %41

41:                                               ; preds = %40
  %42 = getelementptr inbounds i8, ptr %20, i64 32
  %43 = load i32, ptr %42, align 4, !tbaa !25
  %44 = zext i32 %43 to i64
  %45 = icmp ult i64 %44, %4
  %46 = icmp eq ptr %5, null
  %or.cond6 = or i1 %46, %45
  br i1 %or.cond6, label %.critedge, label %.preheader

.preheader:                                       ; preds = %41, %49
  %.081106 = phi ptr [ %50, %49 ], [ %5, %41 ]
  %.083105 = phi i64 [ %51, %49 ], [ 0, %41 ]
  %47 = load i8, ptr %.081106, align 1, !tbaa !26
  %48 = and i8 %47, 1
  %.not94.not.not = icmp eq i8 %48, 0
  br i1 %.not94.not.not, label %.critedge, label %49

49:                                               ; preds = %.preheader
  %50 = getelementptr inbounds i8, ptr %.081106, i64 32
  %51 = add nuw i64 %.083105, 1
  %exitcond.not = icmp eq i64 %51, %4
  br i1 %exitcond.not, label %52, label %.preheader, !llvm.loop !27

52:                                               ; preds = %49
  %53 = trunc nuw i64 %4 to i32
  %54 = getelementptr inbounds i8, ptr %20, i64 36
  store i32 %53, ptr %54, align 4, !tbaa !23
  %55 = getelementptr inbounds i8, ptr %20, i64 40
  %56 = shl nuw nsw i64 %4, 5
  %57 = tail call ptr @CopyMem(ptr noundef nonnull %55, ptr noundef %5, i64 noundef %56) #2
  br label %.thread99

.thread99:                                        ; preds = %31, %52
  %.086.ph = phi i32 [ %2, %52 ], [ %33, %31 ]
  %58 = icmp eq i64 %4, 0
  br label %60

59:                                               ; preds = %40
  %or.cond8 = icmp eq i32 %27, 0
  br i1 %or.cond8, label %.critedge, label %60

60:                                               ; preds = %.thread99, %59
  %61 = phi i1 [ %58, %.thread99 ], [ true, %59 ]
  %.086104 = phi i32 [ %.086.ph, %.thread99 ], [ %2, %59 ]
  %62 = and i32 %1, 2
  %63 = icmp ne i32 %62, 0
  %or.cond14 = and i1 %63, %61
  br i1 %or.cond14, label %.critedge, label %64

64:                                               ; preds = %60
  %65 = getelementptr inbounds i8, ptr %20, i64 28
  %66 = load i32, ptr %65, align 4, !tbaa !24
  %67 = or i32 %66, %1
  %68 = xor i32 %.086104, -1
  %69 = and i32 %67, %68
  store i32 %69, ptr %65, align 4, !tbaa !24
  %70 = tail call i64 @ReceiveFilterUpdate(ptr noundef nonnull %0)
  %71 = icmp eq i64 %70, -9223372036854775801
  %72 = icmp eq i64 %70, -9223372036854775806
  %or.cond16 = or i1 %71, %72
  %spec.store.select = select i1 %or.cond16, i64 0, i64 %70
  br label %.critedge

.critedge:                                        ; preds = %.preheader, %60, %59, %41, %31, %23, %18, %64, %22
  %.3 = phi i64 [ -9223372036854775801, %22 ], [ %spec.store.select, %64 ], [ -9223372036854775789, %18 ], [ -9223372036854775806, %23 ], [ 0, %31 ], [ -9223372036854775806, %41 ], [ 0, %59 ], [ -9223372036854775806, %60 ], [ -9223372036854775806, %.preheader ]
  %73 = load ptr, ptr @gBS, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 32
  %75 = load ptr, ptr %74, align 8, !tbaa !29
  tail call void %75(i64 noundef %10) #2
  ret i64 %.3
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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, !6, i64 24}
!10 = !{!"", !11, 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}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !12, i64 0}
!15 = !{!"", !12, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !16, i64 152, !17, i64 280, !7, i64 936, !6, i64 944, !19, i64 952, !7, i64 954, !7, i64 955, !7, i64 956, !7, i64 957, !12, i64 960, !12, i64 968, !19, i64 976, !6, i64 984, !6, i64 992, !7, i64 1000, !18, i64 1008, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !12, i64 1088, !6, i64 1096}
!16 = !{!"_EFI_SIMPLE_NETWORK_PROTOCOL", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!17 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !7, i64 40, !18, i64 552, !18, i64 584, !18, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!18 = !{!"", !7, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = !{!16, !6, i64 120}
!21 = !{!17, !13, i64 0}
!22 = !{!17, !13, i64 24}
!23 = !{!17, !13, i64 36}
!24 = !{!17, !13, i64 28}
!25 = !{!17, !13, i64 32}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!10, !6, i64 32}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass