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

; 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.MNP_DEVICE_DATA = type { i32, ptr, ptr, %struct._EFI_VLAN_CONFIG_PROTOCOL, i64, ptr, ptr, %struct._LIST_ENTRY, i64, %struct._LIST_ENTRY, i32, ptr, %struct.NET_BUF_QUEUE, i64, ptr, i8, ptr, ptr, i32, i32, i32, i32, i32, i32, ptr, ptr }
%struct._EFI_VLAN_CONFIG_PROTOCOL = type { ptr, ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct.MNP_SERVICE_DATA = type { i32, %struct._LIST_ENTRY, ptr, ptr, %struct._EFI_SERVICE_BINDING_PROTOCOL, ptr, %struct._LIST_ENTRY, i64, i32, i16, i8 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%union.VLAN_TCI = type { %struct.anon }
%struct.anon = type { i16 }

@.str = external hidden unnamed_addr constant [149 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1

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

20:                                               ; preds = %3
  %21 = load i16, ptr %6, align 2, !tbaa !9
  %22 = zext i16 %21 to i32
  %23 = icmp sgt i32 %22, 4094
  br i1 %23, label %28, label %24

24:                                               ; preds = %20
  %25 = load i8, ptr %7, align 1, !tbaa !11
  %26 = zext i8 %25 to i32
  %27 = icmp sgt i32 %26, 7
  br i1 %27, label %28, label %29

28:                                               ; preds = %24, %20, %3
  store i64 -9223372036854775806, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

29:                                               ; preds = %24
  store i8 0, ptr %15, align 1, !tbaa !11
  %30 = call zeroext i8 @DebugAssertEnabled()
  %31 = zext i8 %30 to i32
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %43

33:                                               ; preds = %29
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = ptrtoint ptr %34 to i64
  %36 = sub i64 %35, ptrtoint (ptr getelementptr inbounds (%struct.MNP_DEVICE_DATA, ptr null, i32 0, i32 3) to i64)
  %37 = inttoptr i64 %36 to ptr
  %38 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !12
  %40 = icmp ne i32 %39, 1148218957
  br i1 %40, label %41, label %43

41:                                               ; preds = %33
  call void @DebugAssert(ptr noundef @.str, i64 noundef 384, ptr noundef @.str.2)
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  br label %48

43:                                               ; preds = %33, %29
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = ptrtoint ptr %44 to i64
  %46 = sub i64 %45, ptrtoint (ptr getelementptr inbounds (%struct.MNP_DEVICE_DATA, ptr null, i32 0, i32 3) to i64)
  %47 = inttoptr i64 %46 to ptr
  br label %48

48:                                               ; preds = %43, %41
  %49 = phi ptr [ %42, %41 ], [ %47, %43 ]
  store ptr %49, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %50, i32 0, i32 4
  %52 = load i64, ptr %51, align 8, !tbaa !19
  %53 = icmp eq i64 %52, 0
  br i1 %53, label %54, label %105

54:                                               ; preds = %48
  store i8 1, ptr %15, align 1, !tbaa !11
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %55, i32 0, i32 7
  %57 = call ptr @GetFirstNode(ptr noundef %56)
  store ptr %57, ptr %16, align 8, !tbaa !5
  %58 = call zeroext i8 @DebugAssertEnabled()
  %59 = zext i8 %58 to i32
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %71

61:                                               ; preds = %54
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = ptrtoint ptr %62 to i64
  %64 = sub i64 %63, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 1) to i64)
  %65 = inttoptr i64 %64 to ptr
  %66 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !20
  %68 = icmp ne i32 %67, 1399877197
  br i1 %68, label %69, label %71

69:                                               ; preds = %61
  call void @DebugAssert(ptr noundef @.str, i64 noundef 391, ptr noundef @.str.2)
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  br label %76

71:                                               ; preds = %61, %54
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = ptrtoint ptr %72 to i64
  %74 = sub i64 %73, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 1) to i64)
  %75 = inttoptr i64 %74 to ptr
  br label %76

76:                                               ; preds = %71, %69
  %77 = phi ptr [ %70, %69 ], [ %75, %71 ]
  store ptr %77, ptr %10, align 8, !tbaa !5
  %78 = load i16, ptr %6, align 2, !tbaa !9
  %79 = zext i16 %78 to i32
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %104

81:                                               ; preds = %76
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = call i64 @MnpDestroyServiceChild(ptr noundef %82)
  store i64 %83, ptr %8, align 8, !tbaa !23
  %84 = load i64, ptr %8, align 8, !tbaa !23
  %85 = icmp slt i64 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %81
  %87 = load i64, ptr %8, align 8, !tbaa !23
  store i64 %87, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

88:                                               ; preds = %81
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = call i64 @MnpDestroyServiceData(ptr noundef %89)
  store i64 %90, ptr %8, align 8, !tbaa !23
  %91 = load i64, ptr %8, align 8, !tbaa !23
  %92 = icmp slt i64 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %88
  %94 = load i64, ptr %8, align 8, !tbaa !23
  store i64 %94, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

95:                                               ; preds = %88
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = load i16, ptr %6, align 2, !tbaa !9
  %98 = load i8, ptr %7, align 1, !tbaa !11
  %99 = call ptr @MnpCreateServiceData(ptr noundef %96, i16 noundef zeroext %97, i8 noundef zeroext %98)
  store ptr %99, ptr %10, align 8, !tbaa !5
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %103

102:                                              ; preds = %95
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

103:                                              ; preds = %95
  br label %104

104:                                              ; preds = %103, %76
  br label %121

105:                                              ; preds = %48
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = load i16, ptr %6, align 2, !tbaa !9
  %108 = call ptr @MnpFindServiceData(ptr noundef %106, i16 noundef zeroext %107)
  store ptr %108, ptr %10, align 8, !tbaa !5
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %120

111:                                              ; preds = %105
  store i8 1, ptr %15, align 1, !tbaa !11
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = load i16, ptr %6, align 2, !tbaa !9
  %114 = load i8, ptr %7, align 1, !tbaa !11
  %115 = call ptr @MnpCreateServiceData(ptr noundef %112, i16 noundef zeroext %113, i8 noundef zeroext %114)
  store ptr %115, ptr %10, align 8, !tbaa !5
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = icmp eq ptr %116, null
  br i1 %117, label %118, label %119

118:                                              ; preds = %111
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

119:                                              ; preds = %111
  br label %120

120:                                              ; preds = %119, %105
  br label %121

121:                                              ; preds = %120, %104
  %122 = load i16, ptr %6, align 2, !tbaa !9
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %123, i32 0, i32 9
  store i16 %122, ptr %124, align 4, !tbaa !24
  %125 = load i8, ptr %7, align 1, !tbaa !11
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %126, i32 0, i32 10
  store i8 %125, ptr %127, align 2, !tbaa !25
  %128 = load i8, ptr %15, align 1, !tbaa !11
  %129 = icmp ne i8 %128, 0
  br i1 %129, label %130, label %135

130:                                              ; preds = %121
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %131, i32 0, i32 4
  %133 = load i64, ptr %132, align 8, !tbaa !19
  %134 = add i64 %133, 1
  store i64 %134, ptr %132, align 8, !tbaa !19
  br label %135

135:                                              ; preds = %130, %121
  store ptr null, ptr %11, align 8, !tbaa !5
  store ptr null, ptr %12, align 8, !tbaa !5
  store i64 0, ptr %13, align 8, !tbaa !23
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = call i64 @MnpGetVlanVariable(ptr noundef %136, ptr noundef %13, ptr noundef %11)
  %138 = load i8, ptr %15, align 1, !tbaa !11
  %139 = icmp ne i8 %138, 0
  br i1 %139, label %140, label %160

140:                                              ; preds = %135
  %141 = load i64, ptr %13, align 8, !tbaa !23
  %142 = add i64 %141, 1
  %143 = mul i64 %142, 2
  %144 = call ptr @AllocateZeroPool(i64 noundef %143)
  store ptr %144, ptr %12, align 8, !tbaa !5
  %145 = load ptr, ptr %12, align 8, !tbaa !5
  %146 = icmp eq ptr %145, null
  br i1 %146, label %147, label %148

147:                                              ; preds = %140
  store i64 -9223372036854775799, ptr %8, align 8, !tbaa !23
  br label %218

148:                                              ; preds = %140
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %157

151:                                              ; preds = %148
  %152 = load ptr, ptr %12, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = load i64, ptr %13, align 8, !tbaa !23
  %155 = mul i64 %154, 2
  %156 = call ptr @CopyMem(ptr noundef %152, ptr noundef %153, i64 noundef %155)
  br label %157

157:                                              ; preds = %151, %148
  %158 = load i64, ptr %13, align 8, !tbaa !23
  %159 = add i64 %158, 1
  store i64 %159, ptr %13, align 8, !tbaa !23
  store i64 %158, ptr %14, align 8, !tbaa !23
  br label %194

160:                                              ; preds = %135
  store i64 0, ptr %14, align 8, !tbaa !23
  br label %161

161:                                              ; preds = %177, %160
  %162 = load i64, ptr %14, align 8, !tbaa !23
  %163 = load i64, ptr %13, align 8, !tbaa !23
  %164 = icmp ult i64 %162, %163
  br i1 %164, label %165, label %180

165:                                              ; preds = %161
  %166 = load ptr, ptr %11, align 8, !tbaa !5
  %167 = load i64, ptr %14, align 8, !tbaa !23
  %168 = getelementptr inbounds %union.VLAN_TCI, ptr %166, i64 %167
  %169 = load i16, ptr %168, align 1
  %170 = and i16 %169, 4095
  %171 = zext i16 %170 to i32
  %172 = load i16, ptr %6, align 2, !tbaa !9
  %173 = zext i16 %172 to i32
  %174 = icmp eq i32 %171, %173
  br i1 %174, label %175, label %176

175:                                              ; preds = %165
  br label %180

176:                                              ; preds = %165
  br label %177

177:                                              ; preds = %176
  %178 = load i64, ptr %14, align 8, !tbaa !23
  %179 = add i64 %178, 1
  store i64 %179, ptr %14, align 8, !tbaa !23
  br label %161, !llvm.loop !26

180:                                              ; preds = %175, %161
  br label %181

181:                                              ; preds = %180
  %182 = call zeroext i8 @DebugAssertEnabled()
  %183 = icmp ne i8 %182, 0
  br i1 %183, label %184, label %190

184:                                              ; preds = %181
  %185 = load i64, ptr %14, align 8, !tbaa !23
  %186 = load i64, ptr %13, align 8, !tbaa !23
  %187 = icmp ult i64 %185, %186
  br i1 %187, label %189, label %188

188:                                              ; preds = %184
  call void @DebugAssert(ptr noundef @.str, i64 noundef 470, ptr noundef @.str.3)
  br label %189

189:                                              ; preds = %188, %184
  br label %190

190:                                              ; preds = %189, %181
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  %193 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %193, ptr %12, align 8, !tbaa !5
  store ptr null, ptr %11, align 8, !tbaa !5
  br label %194

194:                                              ; preds = %192, %157
  %195 = load i16, ptr %6, align 2, !tbaa !9
  %196 = load ptr, ptr %12, align 8, !tbaa !5
  %197 = load i64, ptr %14, align 8, !tbaa !23
  %198 = getelementptr inbounds %union.VLAN_TCI, ptr %196, i64 %197
  %199 = load i16, ptr %198, align 1
  %200 = and i16 %195, 4095
  %201 = and i16 %199, -4096
  %202 = or i16 %201, %200
  store i16 %202, ptr %198, align 1
  %203 = load i8, ptr %7, align 1, !tbaa !11
  %204 = zext i8 %203 to i16
  %205 = load ptr, ptr %12, align 8, !tbaa !5
  %206 = load i64, ptr %14, align 8, !tbaa !23
  %207 = getelementptr inbounds %union.VLAN_TCI, ptr %205, i64 %206
  %208 = load i16, ptr %207, align 1
  %209 = and i16 %204, 7
  %210 = shl i16 %209, 13
  %211 = and i16 %208, 8191
  %212 = or i16 %211, %210
  store i16 %212, ptr %207, align 1
  %213 = load ptr, ptr %9, align 8, !tbaa !5
  %214 = load i64, ptr %13, align 8, !tbaa !23
  %215 = load ptr, ptr %12, align 8, !tbaa !5
  %216 = call i64 @MnpSetVlanVariable(ptr noundef %213, i64 noundef %214, ptr noundef %215)
  store i64 %216, ptr %8, align 8, !tbaa !23
  %217 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %217)
  br label %218

218:                                              ; preds = %194, %147
  %219 = load ptr, ptr %11, align 8, !tbaa !5
  %220 = icmp ne ptr %219, null
  br i1 %220, label %221, label %223

221:                                              ; preds = %218
  %222 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %222)
  br label %223

223:                                              ; preds = %221, %218
  %224 = load i64, ptr %8, align 8, !tbaa !23
  store i64 %224, ptr %4, align 8
  store i32 1, ptr %17, align 4
  br label %225

225:                                              ; preds = %223, %118, %102, %93, %86, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %226 = load i64, ptr %4, align 8
  ret i64 %226
}

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

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

declare void @FreePool(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 zeroext i8 @DebugAssertEnabled() #2

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

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

declare ptr @AllocateZeroPool(i64 noundef) #2

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

declare ptr @GetFirstNode(ptr noundef) #2

declare i64 @MnpDestroyServiceChild(ptr noundef) #2

declare i64 @MnpDestroyServiceData(ptr noundef) #2

declare ptr @MnpCreateServiceData(ptr noundef, i16 noundef zeroext, i8 noundef zeroext) #2

declare ptr @MnpFindServiceData(ptr noundef, i16 noundef zeroext) #2

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 = !{!"short", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"", !14, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !16, i64 48, !6, i64 56, !6, i64 64, !17, i64 72, !16, i64 88, !17, i64 96, !14, i64 112, !6, i64 120, !18, i64 128, !16, i64 184, !6, i64 192, !7, i64 200, !6, i64 208, !6, i64 216, !14, i64 224, !14, i64 228, !14, i64 232, !14, i64 236, !14, i64 240, !14, i64 244, !6, i64 248, !6, i64 256}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!18 = !{!"", !14, i64 0, !16, i64 8, !17, i64 16, !17, i64 32, !14, i64 48, !14, i64 52}
!19 = !{!13, !16, i64 48}
!20 = !{!21, !14, i64 0}
!21 = !{!"", !14, i64 0, !17, i64 8, !6, i64 24, !6, i64 32, !22, i64 40, !6, i64 56, !17, i64 64, !16, i64 80, !14, i64 88, !10, i64 92, !7, i64 94}
!22 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!23 = !{!16, !16, i64 0}
!24 = !{!21, !10, i64 92}
!25 = !{!21, !7, i64 94}
!26 = distinct !{!26, !27}
!27 = !{!"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"

%union.VLAN_TCI = type { %struct.anon }
%struct.anon = type { i16 }

@.str = external hidden unnamed_addr constant [149 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @VlanConfigSet(ptr noundef %0, i16 noundef zeroext %1, i8 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = icmp eq ptr %0, null
  %7 = icmp ugt i16 %1, 4094
  %or.cond = or i1 %6, %7
  %8 = icmp ugt i8 %2, 7
  %or.cond5 = or i1 %or.cond, %8
  br i1 %or.cond5, label %91, label %9

9:                                                ; preds = %3
  %10 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %10, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre92 = add i64 %.pre, -24
  %.pre94 = inttoptr i64 %.pre92 to ptr
  br i1 %.not, label %._crit_edge91, label %11

11:                                               ; preds = %9
  %12 = load i32, ptr %.pre94, align 8, !tbaa !5
  %.not74 = icmp eq i32 %12, 1148218957
  br i1 %.not74, label %._crit_edge91, label %13

13:                                               ; preds = %11
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 384, ptr noundef nonnull @.str.2) #3
  br label %._crit_edge91

._crit_edge91:                                    ; preds = %9, %11, %13
  %14 = phi ptr [ %0, %13 ], [ %.pre94, %11 ], [ %.pre94, %9 ]
  %15 = getelementptr inbounds i8, ptr %14, i64 48
  %16 = load i64, ptr %15, align 8, !tbaa !15
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %35

18:                                               ; preds = %._crit_edge91
  %19 = getelementptr inbounds i8, ptr %14, i64 72
  %20 = tail call ptr @GetFirstNode(ptr noundef nonnull %19) #3
  %21 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not75 = icmp eq i8 %21, 0
  %.pre96 = ptrtoint ptr %20 to i64
  %.pre98 = add i64 %.pre96, -8
  %.pre100 = inttoptr i64 %.pre98 to ptr
  br i1 %.not75, label %._crit_edge90, label %22

22:                                               ; preds = %18
  %23 = load i32, ptr %.pre100, align 8, !tbaa !16
  %.not76 = icmp eq i32 %23, 1399877197
  br i1 %.not76, label %._crit_edge90, label %24

24:                                               ; preds = %22
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 391, ptr noundef nonnull @.str.2) #3
  br label %._crit_edge90

._crit_edge90:                                    ; preds = %18, %22, %24
  %25 = phi ptr [ %20, %24 ], [ %.pre100, %22 ], [ %.pre100, %18 ]
  %.not77 = icmp eq i16 %1, 0
  br i1 %.not77, label %.critedge85, label %26

26:                                               ; preds = %._crit_edge90
  %27 = tail call i64 @MnpDestroyServiceChild(ptr noundef %25) #3
  %28 = icmp slt i64 %27, 0
  br i1 %28, label %91, label %29

29:                                               ; preds = %26
  %30 = tail call i64 @MnpDestroyServiceData(ptr noundef %25) #3
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %91, label %32

32:                                               ; preds = %29
  %33 = tail call ptr @MnpCreateServiceData(ptr noundef nonnull %14, i16 noundef zeroext %1, i8 noundef zeroext %2) #3
  %34 = icmp eq ptr %33, null
  br i1 %34, label %91, label %.critedge85

35:                                               ; preds = %._crit_edge91
  %36 = tail call ptr @MnpFindServiceData(ptr noundef nonnull %14, i16 noundef zeroext %1) #3
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %.critedge

38:                                               ; preds = %35
  %39 = tail call ptr @MnpCreateServiceData(ptr noundef nonnull %14, i16 noundef zeroext %1, i8 noundef zeroext %2) #3
  %40 = icmp eq ptr %39, null
  br i1 %40, label %91, label %.critedge85

.critedge:                                        ; preds = %35
  %41 = getelementptr inbounds i8, ptr %36, i64 92
  store i16 %1, ptr %41, align 4, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %36, i64 94
  store i8 %2, ptr %42, align 2, !tbaa !21
  store ptr null, ptr %4, align 8, !tbaa !22
  store i64 0, ptr %5, align 8, !tbaa !23
  %43 = call i64 @MnpGetVlanVariable(ptr noundef nonnull %14, ptr noundef nonnull %5, ptr noundef nonnull %4)
  %44 = load i64, ptr %5, align 8, !tbaa !23
  %.not89 = icmp eq i64 %44, 0
  br i1 %.not89, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.critedge
  %45 = load ptr, ptr %4, align 8, !tbaa !22
  br label %65

.critedge85:                                      ; preds = %38, %._crit_edge90, %32
  %.062.ph = phi ptr [ %39, %38 ], [ %25, %._crit_edge90 ], [ %33, %32 ]
  %46 = getelementptr inbounds i8, ptr %.062.ph, i64 92
  store i16 %1, ptr %46, align 4, !tbaa !20
  %47 = getelementptr inbounds i8, ptr %.062.ph, i64 94
  store i8 %2, ptr %47, align 2, !tbaa !21
  %48 = load i64, ptr %15, align 8, !tbaa !15
  %49 = add i64 %48, 1
  store i64 %49, ptr %15, align 8, !tbaa !15
  store ptr null, ptr %4, align 8, !tbaa !22
  store i64 0, ptr %5, align 8, !tbaa !23
  %50 = call i64 @MnpGetVlanVariable(ptr noundef nonnull %14, ptr noundef nonnull %5, ptr noundef nonnull %4)
  %51 = load i64, ptr %5, align 8, !tbaa !23
  %52 = shl i64 %51, 1
  %53 = add i64 %52, 2
  %54 = call ptr @AllocateZeroPool(i64 noundef %53) #3
  %55 = icmp eq ptr %54, null
  br i1 %55, label %88, label %56

56:                                               ; preds = %.critedge85
  %57 = load ptr, ptr %4, align 8, !tbaa !22
  %.not80 = icmp eq ptr %57, null
  br i1 %.not80, label %62, label %58

58:                                               ; preds = %56
  %59 = load i64, ptr %5, align 8, !tbaa !23
  %60 = shl i64 %59, 1
  %61 = call ptr @CopyMem(ptr noundef nonnull %54, ptr noundef nonnull %57, i64 noundef %60) #3
  br label %62

62:                                               ; preds = %58, %56
  %63 = load i64, ptr %5, align 8, !tbaa !23
  %64 = add i64 %63, 1
  store i64 %64, ptr %5, align 8, !tbaa !23
  br label %78

65:                                               ; preds = %.lr.ph, %70
  %.06086 = phi i64 [ 0, %.lr.ph ], [ %71, %70 ]
  %66 = getelementptr inbounds %union.VLAN_TCI, ptr %45, i64 %.06086
  %67 = load i16, ptr %66, align 1
  %68 = and i16 %67, 4095
  %69 = icmp eq i16 %68, %1
  br i1 %69, label %._crit_edge, label %70

70:                                               ; preds = %65
  %71 = add nuw i64 %.06086, 1
  %exitcond.not = icmp eq i64 %71, %44
  br i1 %exitcond.not, label %._crit_edge, label %65, !llvm.loop !24

._crit_edge:                                      ; preds = %65, %70, %.critedge
  %.060.lcssa = phi i64 [ 0, %.critedge ], [ %44, %70 ], [ %.06086, %65 ]
  %72 = call zeroext i8 @DebugAssertEnabled() #3
  %.not79 = icmp eq i8 %72, 0
  %73 = load i64, ptr %5, align 8
  %74 = icmp ult i64 %.060.lcssa, %73
  %or.cond83 = select i1 %.not79, i1 true, i1 %74
  br i1 %or.cond83, label %76, label %75

75:                                               ; preds = %._crit_edge
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 470, ptr noundef nonnull @.str.3) #3
  br label %76

76:                                               ; preds = %75, %._crit_edge
  %77 = load ptr, ptr %4, align 8, !tbaa !22
  store ptr null, ptr %4, align 8, !tbaa !22
  br label %78

78:                                               ; preds = %76, %62
  %.061 = phi ptr [ %54, %62 ], [ %77, %76 ]
  %.1 = phi i64 [ %63, %62 ], [ %.060.lcssa, %76 ]
  %79 = getelementptr inbounds %union.VLAN_TCI, ptr %.061, i64 %.1
  %80 = load i16, ptr %79, align 1
  %81 = and i16 %80, 4096
  %82 = zext nneg i8 %2 to i16
  %83 = shl nuw i16 %82, 13
  %84 = or disjoint i16 %81, %83
  %85 = or disjoint i16 %84, %1
  store i16 %85, ptr %79, align 1
  %86 = load i64, ptr %5, align 8, !tbaa !23
  %87 = call i64 @MnpSetVlanVariable(ptr noundef %14, i64 noundef %86, ptr noundef %.061)
  call void @FreePool(ptr noundef %.061) #3
  br label %88

88:                                               ; preds = %.critedge85, %78
  %.063 = phi i64 [ %87, %78 ], [ -9223372036854775799, %.critedge85 ]
  %89 = load ptr, ptr %4, align 8, !tbaa !22
  %.not81 = icmp eq ptr %89, null
  br i1 %.not81, label %91, label %90

90:                                               ; preds = %88
  call void @FreePool(ptr noundef nonnull %89) #3
  br label %91

91:                                               ; preds = %88, %90, %38, %32, %29, %26, %3
  %.0 = phi i64 [ -9223372036854775806, %3 ], [ %27, %26 ], [ %30, %29 ], [ -9223372036854775799, %32 ], [ -9223372036854775799, %38 ], [ %.063, %90 ], [ %.063, %88 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i64 %.0
}

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

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

declare ptr @GetFirstNode(ptr noundef) local_unnamed_addr #2

declare i64 @MnpDestroyServiceChild(ptr noundef) local_unnamed_addr #2

declare i64 @MnpDestroyServiceData(ptr noundef) local_unnamed_addr #2

declare ptr @MnpCreateServiceData(ptr noundef, i16 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2

declare ptr @MnpFindServiceData(ptr noundef, i16 noundef zeroext) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 48, !10, i64 56, !10, i64 64, !13, i64 72, !12, i64 88, !13, i64 96, !7, i64 112, !10, i64 120, !14, i64 128, !12, i64 184, !10, i64 192, !8, i64 200, !10, i64 208, !10, i64 216, !7, i64 224, !7, i64 228, !7, i64 232, !7, i64 236, !7, i64 240, !7, i64 244, !10, i64 248, !10, i64 256}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!14 = !{!"", !7, i64 0, !12, i64 8, !13, i64 16, !13, i64 32, !7, i64 48, !7, i64 52}
!15 = !{!6, !12, i64 48}
!16 = !{!17, !7, i64 0}
!17 = !{!"", !7, i64 0, !13, i64 8, !10, i64 24, !10, i64 32, !18, i64 40, !10, i64 56, !13, i64 64, !12, i64 80, !7, i64 88, !19, i64 92, !8, i64 94}
!18 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !10, i64 0, !10, i64 8}
!19 = !{!"short", !8, i64 0}
!20 = !{!17, !19, i64 92}
!21 = !{!17, !8, i64 94}
!22 = !{!10, !10, i64 0}
!23 = !{!12, !12, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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