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

; 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_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%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.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 }
%union.VLAN_TCI = type { %struct.anon }
%struct.anon = type { i16 }
%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 }

@.str = external hidden unnamed_addr constant [151 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@gEfiVlanConfigProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @MnpDriverBindingStart(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %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 i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  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
  store ptr null, ptr %12, align 8, !tbaa !5
  %16 = call ptr @AllocateZeroPool(i64 noundef 264)
  store ptr %16, ptr %10, align 8, !tbaa !5
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %34

19:                                               ; preds = %3
  br label %20

20:                                               ; preds = %19
  %21 = call zeroext i8 @DebugPrintEnabled()
  %22 = icmp ne i8 %21, 0
  br i1 %22, label %23, label %31

23:                                               ; preds = %20
  br label %24

24:                                               ; preds = %23
  %25 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %26 = icmp ne i8 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.2)
  br label %28

28:                                               ; preds = %27, %24
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30, %20
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %204

34:                                               ; preds = %3
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call i64 @MnpInitializeDeviceData(ptr noundef %35, ptr noundef %38, ptr noundef %39)
  store i64 %40, ptr %8, align 8, !tbaa !12
  %41 = load i64, ptr %8, align 8, !tbaa !12
  %42 = icmp slt i64 %41, 0
  br i1 %42, label %43, label %61

43:                                               ; preds = %34
  br label %44

44:                                               ; preds = %43
  %45 = call zeroext i8 @DebugPrintEnabled()
  %46 = icmp ne i8 %45, 0
  br i1 %46, label %47, label %56

47:                                               ; preds = %44
  br label %48

48:                                               ; preds = %47
  %49 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %50 = icmp ne i8 %49, 0
  br i1 %50, label %51, label %53

51:                                               ; preds = %48
  %52 = load i64, ptr %8, align 8, !tbaa !12
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.3, i64 noundef %52)
  br label %53

53:                                               ; preds = %51, %48
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55, %44
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %59)
  %60 = load i64, ptr %8, align 8, !tbaa !12
  store i64 %60, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %204

61:                                               ; preds = %34
  %62 = load ptr, ptr @gBS, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %62, i32 0, i32 33
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %66, i32 0, i32 5
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = call i64 %64(ptr noundef %65, ptr noundef @gEfiVlanConfigProtocolGuid, ptr noundef null, ptr noundef %68, ptr noundef %69, i32 noundef 4)
  store i64 %70, ptr %8, align 8, !tbaa !12
  %71 = load i64, ptr %8, align 8, !tbaa !12
  %72 = icmp slt i64 %71, 0
  br i1 %72, label %85, label %73

73:                                               ; preds = %61
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %74, i32 0, i32 4
  store i64 0, ptr %75, align 8, !tbaa !17
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %76, i32 0, i32 3
  %78 = call ptr @ZeroMem(ptr noundef %77, i64 noundef 24)
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = call ptr @MnpCreateServiceData(ptr noundef %79, i16 noundef zeroext 0, i8 noundef zeroext 0)
  store ptr %80, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = icmp ne ptr %81, null
  %83 = zext i1 %82 to i64
  %84 = select i1 %82, i64 0, i64 -9223372036854775799
  store i64 %84, ptr %8, align 8, !tbaa !12
  br label %139

85:                                               ; preds = %61
  %86 = load ptr, ptr @gBS, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %86, i32 0, i32 39
  %88 = load ptr, ptr %87, align 8, !tbaa !22
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %89, i32 0, i32 3
  %91 = call i64 (ptr, ...) %88(ptr noundef %6, ptr noundef @gEfiVlanConfigProtocolGuid, ptr noundef %90, ptr noundef null)
  store i64 %91, ptr %8, align 8, !tbaa !12
  %92 = load i64, ptr %8, align 8, !tbaa !12
  %93 = icmp slt i64 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %85
  br label %139

95:                                               ; preds = %85
  store i64 0, ptr %13, align 8, !tbaa !12
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = call i64 @MnpGetVlanVariable(ptr noundef %96, ptr noundef %13, ptr noundef %12)
  store i64 %97, ptr %8, align 8, !tbaa !12
  %98 = load i64, ptr %8, align 8, !tbaa !12
  %99 = icmp slt i64 %98, 0
  br i1 %99, label %100, label %109

100:                                              ; preds = %95
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %101, i32 0, i32 4
  store i64 0, ptr %102, align 8, !tbaa !17
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = call ptr @MnpCreateServiceData(ptr noundef %103, i16 noundef zeroext 0, i8 noundef zeroext 0)
  store ptr %104, ptr %9, align 8, !tbaa !5
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  %107 = zext i1 %106 to i64
  %108 = select i1 %106, i64 0, i64 -9223372036854775799
  store i64 %108, ptr %8, align 8, !tbaa !12
  br label %139

109:                                              ; preds = %95
  %110 = load i64, ptr %13, align 8, !tbaa !12
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %111, i32 0, i32 4
  store i64 %110, ptr %112, align 8, !tbaa !17
  store i64 0, ptr %14, align 8, !tbaa !12
  br label %113

113:                                              ; preds = %135, %109
  %114 = load i64, ptr %14, align 8, !tbaa !12
  %115 = load i64, ptr %13, align 8, !tbaa !12
  %116 = icmp ult i64 %114, %115
  br i1 %116, label %117, label %138

117:                                              ; preds = %113
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load i64, ptr %14, align 8, !tbaa !12
  %121 = getelementptr inbounds %union.VLAN_TCI, ptr %119, i64 %120
  %122 = load i16, ptr %121, align 1
  %123 = and i16 %122, 4095
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = load i64, ptr %14, align 8, !tbaa !12
  %126 = getelementptr inbounds %union.VLAN_TCI, ptr %124, i64 %125
  %127 = load i16, ptr %126, align 1
  %128 = lshr i16 %127, 13
  %129 = trunc i16 %128 to i8
  %130 = call ptr @MnpCreateServiceData(ptr noundef %118, i16 noundef zeroext %123, i8 noundef zeroext %129)
  store ptr %130, ptr %9, align 8, !tbaa !5
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = icmp eq ptr %131, null
  br i1 %132, label %133, label %134

133:                                              ; preds = %117
  store i64 -9223372036854775799, ptr %8, align 8, !tbaa !12
  br label %139

134:                                              ; preds = %117
  br label %135

135:                                              ; preds = %134
  %136 = load i64, ptr %14, align 8, !tbaa !12
  %137 = add i64 %136, 1
  store i64 %137, ptr %14, align 8, !tbaa !12
  br label %113, !llvm.loop !23

138:                                              ; preds = %113
  br label %139

139:                                              ; preds = %138, %133, %100, %94, %73
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %144

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

144:                                              ; preds = %142, %139
  %145 = load i64, ptr %8, align 8, !tbaa !12
  %146 = icmp slt i64 %145, 0
  br i1 %146, label %147, label %202

147:                                              ; preds = %144
  br label %148

148:                                              ; preds = %176, %147
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %149, i32 0, i32 7
  %151 = call zeroext i8 @IsListEmpty(ptr noundef %150)
  %152 = icmp ne i8 %151, 0
  %153 = xor i1 %152, true
  br i1 %153, label %154, label %180

154:                                              ; preds = %148
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %155, i32 0, i32 7
  %157 = call ptr @GetFirstNode(ptr noundef %156)
  store ptr %157, ptr %11, align 8, !tbaa !5
  %158 = call zeroext i8 @DebugAssertEnabled()
  %159 = zext i8 %158 to i32
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %171

161:                                              ; preds = %154
  %162 = load ptr, ptr %11, align 8, !tbaa !5
  %163 = ptrtoint ptr %162 to i64
  %164 = sub i64 %163, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 1) to i64)
  %165 = inttoptr i64 %164 to ptr
  %166 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %165, i32 0, i32 0
  %167 = load i32, ptr %166, align 8, !tbaa !25
  %168 = icmp ne i32 %167, 1399877197
  br i1 %168, label %169, label %171

169:                                              ; preds = %161
  call void @DebugAssert(ptr noundef @.str, i64 noundef 267, ptr noundef @.str.1)
  %170 = load ptr, ptr %11, align 8, !tbaa !5
  br label %176

171:                                              ; preds = %161, %154
  %172 = load ptr, ptr %11, align 8, !tbaa !5
  %173 = ptrtoint ptr %172 to i64
  %174 = sub i64 %173, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 1) to i64)
  %175 = inttoptr i64 %174 to ptr
  br label %176

176:                                              ; preds = %171, %169
  %177 = phi ptr [ %170, %169 ], [ %175, %171 ]
  store ptr %177, ptr %9, align 8, !tbaa !5
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = call i64 @MnpDestroyServiceData(ptr noundef %178)
  br label %148, !llvm.loop !29

180:                                              ; preds = %148
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %181, i32 0, i32 3
  %183 = getelementptr inbounds %struct._EFI_VLAN_CONFIG_PROTOCOL, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !30
  %185 = icmp ne ptr %184, null
  br i1 %185, label %186, label %196

186:                                              ; preds = %180
  %187 = load ptr, ptr @gBS, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %187, i32 0, i32 40
  %189 = load ptr, ptr %188, align 8, !tbaa !31
  %190 = load ptr, ptr %10, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %190, i32 0, i32 1
  %192 = load ptr, ptr %191, align 8, !tbaa !32
  %193 = load ptr, ptr %10, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %193, i32 0, i32 3
  %195 = call i64 (ptr, ...) %189(ptr noundef %192, ptr noundef @gEfiVlanConfigProtocolGuid, ptr noundef %194, ptr noundef null)
  br label %196

196:                                              ; preds = %186, %180
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %198, i32 0, i32 5
  %200 = load ptr, ptr %199, align 8, !tbaa !9
  call void @MnpDestroyDeviceData(ptr noundef %197, ptr noundef %200)
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %201)
  br label %202

202:                                              ; preds = %196, %144
  %203 = load i64, ptr %8, align 8, !tbaa !12
  store i64 %203, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %204

204:                                              ; preds = %202, %58, %33
  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
  %205 = load i64, ptr %4, align 8
  ret i64 %205
}

; 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

declare i64 @MnpDestroyServiceData(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 @AllocateZeroPool(i64 noundef) #2

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #2

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

declare void @FreePool(ptr noundef) #2

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

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

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

declare zeroext i8 @IsListEmpty(ptr noundef) #2

declare ptr @GetFirstNode(ptr noundef) #2

declare void @MnpDestroyDeviceData(ptr noundef, ptr noundef) #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, !6, i64 40}
!10 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 280}
!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, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!17 = !{!18, !13, i64 48}
!18 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !19, i64 24, !13, i64 48, !6, i64 56, !6, i64 64, !20, i64 72, !13, i64 88, !20, i64 96, !11, i64 112, !6, i64 120, !21, i64 128, !13, i64 184, !6, i64 192, !7, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !6, i64 248, !6, i64 256}
!19 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!21 = !{!"", !11, i64 0, !13, i64 8, !20, i64 16, !20, i64 32, !11, i64 48, !11, i64 52}
!22 = !{!15, !6, i64 328}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!26, !11, i64 0}
!26 = !{!"", !11, i64 0, !20, i64 8, !6, i64 24, !6, i64 32, !27, i64 40, !6, i64 56, !20, i64 64, !13, i64 80, !11, i64 88, !28, i64 92, !7, i64 94}
!27 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!28 = !{!"short", !7, i64 0}
!29 = distinct !{!29, !24}
!30 = !{!18, !6, i64 24}
!31 = !{!15, !6, i64 336}
!32 = !{!18, !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] }
%union.VLAN_TCI = type { %struct.anon }
%struct.anon = type { i16 }

@.str = external hidden unnamed_addr constant [151 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
@.str.2 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [60 x i8], align 1
@gEfiVlanConfigProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @MnpDriverBindingStart(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readnone %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  %7 = tail call ptr @AllocateZeroPool(i64 noundef 264) #3
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %14

9:                                                ; preds = %3
  %10 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not56 = icmp eq i8 %10, 0
  br i1 %.not56, label %92, label %11

11:                                               ; preds = %9
  %12 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not57 = icmp eq i8 %12, 0
  br i1 %.not57, label %92, label %13

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

14:                                               ; preds = %3
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = tail call i64 @MnpInitializeDeviceData(ptr noundef nonnull %7, ptr noundef %16, ptr noundef %1) #3
  %18 = icmp slt i64 %17, 0
  br i1 %18, label %19, label %25

19:                                               ; preds = %14
  %20 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not54 = icmp eq i8 %20, 0
  br i1 %.not54, label %24, label %21

21:                                               ; preds = %19
  %22 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not55 = icmp eq i8 %22, 0
  br i1 %.not55, label %24, label %23

23:                                               ; preds = %21
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.3, i64 noundef %17) #3
  br label %24

24:                                               ; preds = %21, %23, %19
  tail call void @FreePool(ptr noundef nonnull %7) #3
  br label %92

25:                                               ; preds = %14
  %26 = load ptr, ptr @gBS, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 280
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %29 = load ptr, ptr %15, align 8, !tbaa !9
  %30 = tail call i64 %28(ptr noundef %1, ptr noundef nonnull @gEfiVlanConfigProtocolGuid, ptr noundef null, ptr noundef %29, ptr noundef %1, i32 noundef 4) #3
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %38, label %32

32:                                               ; preds = %25
  %33 = getelementptr inbounds i8, ptr %7, i64 48
  store i64 0, ptr %33, align 8, !tbaa !16
  %34 = getelementptr inbounds i8, ptr %7, i64 24
  %35 = tail call ptr @ZeroMem(ptr noundef nonnull %34, i64 noundef 24) #3
  %36 = tail call ptr @MnpCreateServiceData(ptr noundef nonnull %7, i16 noundef zeroext 0, i8 noundef zeroext 0) #3
  %.not = icmp eq ptr %36, null
  %37 = select i1 %.not, i64 -9223372036854775799, i64 0
  br label %.loopexit

38:                                               ; preds = %25
  %39 = load ptr, ptr @gBS, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 328
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %42 = getelementptr inbounds i8, ptr %7, i64 24
  %43 = call i64 (ptr, ...) %41(ptr noundef nonnull %4, ptr noundef nonnull @gEfiVlanConfigProtocolGuid, ptr noundef nonnull %42, ptr noundef null) #3
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %.loopexit, label %45

45:                                               ; preds = %38
  store i64 0, ptr %6, align 8, !tbaa !22
  %46 = call i64 @MnpGetVlanVariable(ptr noundef nonnull %7, ptr noundef nonnull %6, ptr noundef nonnull %5) #3
  %47 = icmp slt i64 %46, 0
  br i1 %47, label %48, label %52

48:                                               ; preds = %45
  %49 = getelementptr inbounds i8, ptr %7, i64 48
  store i64 0, ptr %49, align 8, !tbaa !16
  %50 = call ptr @MnpCreateServiceData(ptr noundef nonnull %7, i16 noundef zeroext 0, i8 noundef zeroext 0) #3
  %.not48 = icmp eq ptr %50, null
  %51 = select i1 %.not48, i64 -9223372036854775799, i64 0
  br label %.loopexit

52:                                               ; preds = %45
  %53 = load i64, ptr %6, align 8, !tbaa !22
  %54 = getelementptr inbounds i8, ptr %7, i64 48
  store i64 %53, ptr %54, align 8, !tbaa !16
  %.not63 = icmp eq i64 %53, 0
  br i1 %.not63, label %.loopexit, label %.lr.ph

55:                                               ; preds = %.lr.ph
  %56 = add nuw i64 %.058, 1
  %57 = load i64, ptr %6, align 8, !tbaa !22
  %58 = icmp ult i64 %56, %57
  br i1 %58, label %.lr.ph, label %.loopexit, !llvm.loop !23

.lr.ph:                                           ; preds = %52, %55
  %.058 = phi i64 [ %56, %55 ], [ 0, %52 ]
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %union.VLAN_TCI, ptr %59, i64 %.058
  %61 = load i16, ptr %60, align 1
  %62 = and i16 %61, 4095
  %63 = lshr i16 %61, 13
  %64 = trunc nuw nsw i16 %63 to i8
  %65 = call ptr @MnpCreateServiceData(ptr noundef nonnull %7, i16 noundef zeroext %62, i8 noundef zeroext %64) #3
  %66 = icmp eq ptr %65, null
  br i1 %66, label %.loopexit, label %55

.loopexit:                                        ; preds = %55, %.lr.ph, %52, %38, %48, %32
  %.042 = phi i64 [ %43, %38 ], [ %51, %48 ], [ %37, %32 ], [ %46, %52 ], [ %46, %55 ], [ -9223372036854775799, %.lr.ph ]
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %.not49 = icmp eq ptr %67, null
  br i1 %.not49, label %69, label %68

68:                                               ; preds = %.loopexit
  call void @FreePool(ptr noundef nonnull %67) #3
  br label %69

69:                                               ; preds = %68, %.loopexit
  %70 = icmp slt i64 %.042, 0
  br i1 %70, label %.preheader, label %92

.preheader:                                       ; preds = %69
  %71 = getelementptr inbounds i8, ptr %7, i64 72
  %72 = call zeroext i8 @IsListEmpty(ptr noundef nonnull %71) #3
  %.not5061 = icmp eq i8 %72, 0
  br i1 %.not5061, label %.lr.ph62, label %._crit_edge

.lr.ph62:                                         ; preds = %.preheader, %.lr.ph62._crit_edge
  %73 = call ptr @GetFirstNode(ptr noundef nonnull %71) #3
  %74 = call zeroext i8 @DebugAssertEnabled() #3
  %.not52 = icmp eq i8 %74, 0
  %.pre = ptrtoint ptr %73 to i64
  %.pre64 = add i64 %.pre, -8
  %.pre66 = inttoptr i64 %.pre64 to ptr
  br i1 %.not52, label %.lr.ph62._crit_edge, label %75

75:                                               ; preds = %.lr.ph62
  %76 = load i32, ptr %.pre66, align 8, !tbaa !25
  %.not53 = icmp eq i32 %76, 1399877197
  br i1 %.not53, label %.lr.ph62._crit_edge, label %77

77:                                               ; preds = %75
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 267, ptr noundef nonnull @.str.1) #3
  br label %.lr.ph62._crit_edge

.lr.ph62._crit_edge:                              ; preds = %.lr.ph62, %75, %77
  %78 = phi ptr [ %73, %77 ], [ %.pre66, %75 ], [ %.pre66, %.lr.ph62 ]
  %79 = call i64 @MnpDestroyServiceData(ptr noundef %78) #3
  %80 = call zeroext i8 @IsListEmpty(ptr noundef nonnull %71) #3
  %.not50 = icmp eq i8 %80, 0
  br i1 %.not50, label %.lr.ph62, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %.lr.ph62._crit_edge, %.preheader
  %81 = getelementptr inbounds i8, ptr %7, i64 24
  %82 = load ptr, ptr %81, align 8, !tbaa !30
  %.not51 = icmp eq ptr %82, null
  br i1 %.not51, label %90, label %83

83:                                               ; preds = %._crit_edge
  %84 = load ptr, ptr @gBS, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 336
  %86 = load ptr, ptr %85, align 8, !tbaa !31
  %87 = getelementptr inbounds i8, ptr %7, i64 8
  %88 = load ptr, ptr %87, align 8, !tbaa !32
  %89 = call i64 (ptr, ...) %86(ptr noundef %88, ptr noundef nonnull @gEfiVlanConfigProtocolGuid, ptr noundef nonnull %81, ptr noundef null) #3
  br label %90

90:                                               ; preds = %83, %._crit_edge
  %91 = load ptr, ptr %15, align 8, !tbaa !9
  call void @MnpDestroyDeviceData(ptr noundef nonnull %7, ptr noundef %91) #3
  call void @FreePool(ptr noundef nonnull %7) #3
  br label %92

92:                                               ; preds = %69, %90, %9, %13, %11, %24
  %.041 = phi i64 [ %17, %24 ], [ -9223372036854775799, %11 ], [ -9223372036854775799, %13 ], [ -9223372036854775799, %9 ], [ %.042, %90 ], [ %.042, %69 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.041
}

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

declare i64 @MnpDestroyServiceData(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 ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #2

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

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

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

declare zeroext i8 @IsListEmpty(ptr noundef) local_unnamed_addr #2

declare ptr @GetFirstNode(ptr noundef) local_unnamed_addr #2

declare void @MnpDestroyDeviceData(ptr noundef, ptr noundef) 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 40}
!10 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 280}
!13 = !{!"", !14, 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}
!14 = !{!"", !15, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!15 = !{!"long long", !7, i64 0}
!16 = !{!17, !15, i64 48}
!17 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !18, i64 24, !15, i64 48, !6, i64 56, !6, i64 64, !19, i64 72, !15, i64 88, !19, i64 96, !11, i64 112, !6, i64 120, !20, i64 128, !15, i64 184, !6, i64 192, !7, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !6, i64 248, !6, i64 256}
!18 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"", !11, i64 0, !15, i64 8, !19, i64 16, !19, i64 32, !11, i64 48, !11, i64 52}
!21 = !{!13, !6, i64 328}
!22 = !{!15, !15, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!26, !11, i64 0}
!26 = !{!"", !11, i64 0, !19, i64 8, !6, i64 24, !6, i64 32, !27, i64 40, !6, i64 56, !19, i64 64, !15, i64 80, !11, i64 88, !28, i64 92, !7, i64 94}
!27 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!28 = !{!"short", !7, i64 0}
!29 = distinct !{!29, !24}
!30 = !{!17, !6, i64 24}
!31 = !{!13, !6, i64 336}
!32 = !{!17, !6, i64 8}


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