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

; 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_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }
%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 }
%struct._LIST_ENTRY = type { 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_INSTANCE_DATA = type { i32, ptr, ptr, %struct._LIST_ENTRY, %struct._EFI_MANAGED_NETWORK_PROTOCOL, i8, i8, %struct._LIST_ENTRY, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, i8 }
%struct._EFI_MANAGED_NETWORK_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct.EFI_MANAGED_NETWORK_CONFIG_DATA = type { i32, i32, i16, i8, i8, i8, i8, i8, i8, i8 }
%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.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }

@gMnpDriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.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
@gEfiManagedNetworkServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str.7 = external hidden unnamed_addr constant [85 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() #1

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

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

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

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

declare void @FreePool(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @MnpServiceBindingDestroyChild(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  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
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %17, label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %14, %2
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %145

18:                                               ; preds = %14
  %19 = call zeroext i8 @DebugAssertEnabled()
  %20 = zext i8 %19 to i32
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %32

22:                                               ; preds = %18
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = ptrtoint ptr %23 to i64
  %25 = sub i64 %24, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 4) to i64)
  %26 = inttoptr i64 %25 to ptr
  %27 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp ne i32 %28, 1399877197
  br i1 %29, label %30, label %32

30:                                               ; preds = %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 572, ptr noundef @.str.1)
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  br label %37

32:                                               ; preds = %22, %18
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = ptrtoint ptr %33 to i64
  %35 = sub i64 %34, ptrtoint (ptr getelementptr inbounds (%struct.MNP_SERVICE_DATA, ptr null, i32 0, i32 4) to i64)
  %36 = inttoptr i64 %35 to ptr
  br label %37

37:                                               ; preds = %32, %30
  %38 = phi ptr [ %31, %30 ], [ %36, %32 ]
  store ptr %38, ptr %7, align 8, !tbaa !5
  %39 = load ptr, ptr @gBS, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %39, i32 0, i32 33
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMnpDriverBinding, i32 0, i32 5), align 8, !tbaa !19
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call i64 %41(ptr noundef %42, ptr noundef @gEfiManagedNetworkProtocolGuid, ptr noundef %8, ptr noundef %43, ptr noundef %44, i32 noundef 2)
  store i64 %45, ptr %6, align 8, !tbaa !21
  %46 = load i64, ptr %6, align 8, !tbaa !21
  %47 = icmp slt i64 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %37
  store i64 -9223372036854775805, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %145

49:                                               ; preds = %37
  %50 = call zeroext i8 @DebugAssertEnabled()
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %63

53:                                               ; preds = %49
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = ptrtoint ptr %54 to i64
  %56 = sub i64 %55, ptrtoint (ptr getelementptr inbounds (%struct.MNP_INSTANCE_DATA, ptr null, i32 0, i32 4) to i64)
  %57 = inttoptr i64 %56 to ptr
  %58 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !22
  %60 = icmp ne i32 %59, 1232105037
  br i1 %60, label %61, label %63

61:                                               ; preds = %53
  call void @DebugAssert(ptr noundef @.str, i64 noundef 589, ptr noundef @.str.1)
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  br label %68

63:                                               ; preds = %53, %49
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = ptrtoint ptr %64 to i64
  %66 = sub i64 %65, ptrtoint (ptr getelementptr inbounds (%struct.MNP_INSTANCE_DATA, ptr null, i32 0, i32 4) to i64)
  %67 = inttoptr i64 %66 to ptr
  br label %68

68:                                               ; preds = %63, %61
  %69 = phi ptr [ %62, %61 ], [ %67, %63 ]
  store ptr %69, ptr %9, align 8, !tbaa !5
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %70, i32 0, i32 6
  %72 = load i8, ptr %71, align 1, !tbaa !27
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %68
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %145

75:                                               ; preds = %68
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %76, i32 0, i32 6
  store i8 1, ptr %77, align 1, !tbaa !27
  %78 = load ptr, ptr @gBS, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %78, i32 0, i32 34
  %80 = load ptr, ptr %79, align 8, !tbaa !28
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %81, i32 0, i32 3
  %83 = load ptr, ptr %82, align 8, !tbaa !29
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %84, i32 0, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !30
  %87 = getelementptr inbounds %struct.MNP_DEVICE_DATA, ptr %86, i32 0, i32 2
  %88 = load ptr, ptr %87, align 8, !tbaa !31
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = call i64 %80(ptr noundef %83, ptr noundef @gEfiManagedNetworkServiceBindingProtocolGuid, ptr noundef %88, ptr noundef %89)
  %91 = load ptr, ptr @gBS, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %91, i32 0, i32 40
  %93 = load ptr, ptr %92, align 8, !tbaa !35
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %95, i32 0, i32 4
  %97 = call i64 (ptr, ...) %93(ptr noundef %94, ptr noundef @gEfiManagedNetworkProtocolGuid, ptr noundef %96, ptr noundef null)
  store i64 %97, ptr %6, align 8, !tbaa !21
  %98 = load i64, ptr %6, align 8, !tbaa !21
  %99 = icmp slt i64 %98, 0
  br i1 %99, label %100, label %119

100:                                              ; preds = %75
  br label %101

101:                                              ; preds = %100
  %102 = call zeroext i8 @DebugPrintEnabled()
  %103 = icmp ne i8 %102, 0
  br i1 %103, label %104, label %113

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %104
  %106 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %107 = icmp ne i8 %106, 0
  br i1 %107, label %108, label %110

108:                                              ; preds = %105
  %109 = load i64, ptr %6, align 8, !tbaa !21
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.7, i64 noundef %109)
  br label %110

110:                                              ; preds = %108, %105
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112, %101
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %116, i32 0, i32 6
  store i8 0, ptr %117, align 1, !tbaa !27
  %118 = load i64, ptr %6, align 8, !tbaa !21
  store i64 %118, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %145

119:                                              ; preds = %75
  %120 = load ptr, ptr @gBS, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !36
  %123 = call i64 %122(i64 noundef 8)
  store i64 %123, ptr %10, align 8, !tbaa !21
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._EFI_MANAGED_NETWORK_PROTOCOL, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !37
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = call i64 %126(ptr noundef %127, ptr noundef null)
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  call void @MnpFlushRcvdDataQueue(ptr noundef %129)
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %130, i32 0, i32 8
  call void @NetMapClean(ptr noundef %131)
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.MNP_INSTANCE_DATA, ptr %132, i32 0, i32 3
  %134 = call ptr @RemoveEntryList(ptr noundef %133)
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.MNP_SERVICE_DATA, ptr %135, i32 0, i32 7
  %137 = load i64, ptr %136, align 8, !tbaa !38
  %138 = add i64 %137, -1
  store i64 %138, ptr %136, align 8, !tbaa !38
  %139 = load ptr, ptr @gBS, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %139, i32 0, i32 2
  %141 = load ptr, ptr %140, align 8, !tbaa !39
  %142 = load i64, ptr %10, align 8, !tbaa !21
  call void %141(i64 noundef %142)
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FreePool(ptr noundef %143)
  %144 = load i64, ptr %6, align 8, !tbaa !21
  store i64 %144, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %145

145:                                              ; preds = %119, %115, %74, %48, %17
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %146 = load i64, ptr %3, align 8
  ret i64 %146
}

declare void @MnpFlushRcvdDataQueue(ptr noundef) #1

declare void @NetMapClean(ptr noundef) #1

declare ptr @RemoveEntryList(ptr noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 8, !6, i64 24, !6, i64 32, !13, i64 40, !6, i64 56, !12, i64 64, !14, i64 80, !11, i64 88, !15, i64 92, !7, i64 94}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !6, i64 280}
!17 = !{!"", !18, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!18 = !{!"", !14, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!19 = !{!20, !6, i64 40}
!20 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!21 = !{!14, !14, i64 0}
!22 = !{!23, !11, i64 0}
!23 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !24, i64 40, !7, i64 104, !7, i64 105, !12, i64 112, !25, i64 128, !12, i64 168, !12, i64 184, !14, i64 200, !26, i64 208, !7, i64 228}
!24 = !{!"_EFI_MANAGED_NETWORK_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!25 = !{!"", !12, i64 0, !12, i64 16, !14, i64 32}
!26 = !{!"", !11, i64 0, !11, i64 4, !15, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!27 = !{!23, !7, i64 105}
!28 = !{!17, !6, i64 288}
!29 = !{!10, !6, i64 32}
!30 = !{!10, !6, i64 24}
!31 = !{!32, !6, i64 16}
!32 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !33, i64 24, !14, i64 48, !6, i64 56, !6, i64 64, !12, i64 72, !14, i64 88, !12, i64 96, !11, i64 112, !6, i64 120, !34, i64 128, !14, 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}
!33 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"", !11, i64 0, !14, i64 8, !12, i64 16, !12, i64 32, !11, i64 48, !11, i64 52}
!35 = !{!17, !6, i64 336}
!36 = !{!17, !6, i64 24}
!37 = !{!24, !6, i64 8}
!38 = !{!10, !14, i64 80}
!39 = !{!17, !6, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }

@gMnpDriverBinding = external dso_local local_unnamed_addr global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.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
@gEfiManagedNetworkServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str.7 = external hidden unnamed_addr constant [85 x i8], align 1

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @MnpServiceBindingDestroyChild(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %68, label %6

6:                                                ; preds = %2
  %7 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %7, 0
  %.pre37 = ptrtoint ptr %0 to i64
  %.pre38 = add i64 %.pre37, -40
  %.pre40 = inttoptr i64 %.pre38 to ptr
  br i1 %.not, label %._crit_edge36, label %8

8:                                                ; preds = %6
  %9 = load i32, ptr %.pre40, align 8, !tbaa !5
  %.not30 = icmp eq i32 %9, 1399877197
  br i1 %.not30, label %._crit_edge36, label %10

10:                                               ; preds = %8
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 572, ptr noundef nonnull @.str.1) #3
  br label %._crit_edge36

._crit_edge36:                                    ; preds = %6, %8, %10
  %11 = phi ptr [ %0, %10 ], [ %.pre40, %8 ], [ %.pre40, %6 ]
  %12 = load ptr, ptr @gBS, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %12, i64 280
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = load ptr, ptr getelementptr inbounds (i8, ptr @gMnpDriverBinding, i64 40), align 8, !tbaa !19
  %16 = call i64 %14(ptr noundef nonnull %1, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid, ptr noundef nonnull %3, ptr noundef %15, ptr noundef nonnull %1, i32 noundef 2) #3
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %68, label %18

18:                                               ; preds = %._crit_edge36
  %19 = call zeroext i8 @DebugAssertEnabled() #3
  %.not31 = icmp eq i8 %19, 0
  %.pre = load ptr, ptr %3, align 8, !tbaa !15
  %.pre42 = ptrtoint ptr %.pre to i64
  %.pre44 = add i64 %.pre42, -40
  %.pre46 = inttoptr i64 %.pre44 to ptr
  br i1 %.not31, label %._crit_edge, label %20

20:                                               ; preds = %18
  %21 = load i32, ptr %.pre46, align 8, !tbaa !21
  %.not32 = icmp eq i32 %21, 1232105037
  br i1 %.not32, label %._crit_edge, label %22

22:                                               ; preds = %20
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 589, ptr noundef nonnull @.str.1) #3
  %23 = load ptr, ptr %3, align 8, !tbaa !15
  br label %._crit_edge

._crit_edge:                                      ; preds = %18, %20, %22
  %24 = phi ptr [ %23, %22 ], [ %.pre46, %20 ], [ %.pre46, %18 ]
  %25 = getelementptr inbounds i8, ptr %24, i64 105
  %26 = load i8, ptr %25, align 1, !tbaa !26
  %.not33 = icmp eq i8 %26, 0
  br i1 %.not33, label %27, label %68

27:                                               ; preds = %._crit_edge
  store i8 1, ptr %25, align 1, !tbaa !26
  %28 = load ptr, ptr @gBS, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %28, i64 288
  %30 = load ptr, ptr %29, align 8, !tbaa !27
  %31 = getelementptr inbounds i8, ptr %11, i64 32
  %32 = load ptr, ptr %31, align 8, !tbaa !28
  %33 = getelementptr inbounds i8, ptr %11, i64 24
  %34 = load ptr, ptr %33, align 8, !tbaa !29
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %36 = load ptr, ptr %35, align 8, !tbaa !30
  %37 = call i64 %30(ptr noundef %32, ptr noundef nonnull @gEfiManagedNetworkServiceBindingProtocolGuid, ptr noundef %36, ptr noundef nonnull %1) #3
  %38 = load ptr, ptr @gBS, align 8, !tbaa !15
  %39 = getelementptr inbounds i8, ptr %38, i64 336
  %40 = load ptr, ptr %39, align 8, !tbaa !34
  %41 = getelementptr inbounds i8, ptr %24, i64 40
  %42 = call i64 (ptr, ...) %40(ptr noundef nonnull %1, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid, ptr noundef nonnull %41, ptr noundef null) #3
  %43 = icmp slt i64 %42, 0
  br i1 %43, label %44, label %50

44:                                               ; preds = %27
  %45 = call zeroext i8 @DebugPrintEnabled() #3
  %.not34 = icmp eq i8 %45, 0
  br i1 %.not34, label %49, label %46

46:                                               ; preds = %44
  %47 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not35 = icmp eq i8 %47, 0
  br i1 %.not35, label %49, label %48

48:                                               ; preds = %46
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.7, i64 noundef %42) #3
  br label %49

49:                                               ; preds = %46, %48, %44
  store i8 0, ptr %25, align 1, !tbaa !26
  br label %68

50:                                               ; preds = %27
  %51 = load ptr, ptr @gBS, align 8, !tbaa !15
  %52 = getelementptr inbounds i8, ptr %51, i64 24
  %53 = load ptr, ptr %52, align 8, !tbaa !35
  %54 = call i64 %53(i64 noundef 8) #3
  %55 = load ptr, ptr %3, align 8, !tbaa !15
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !36
  %58 = call i64 %57(ptr noundef %55, ptr noundef null) #3
  call void @MnpFlushRcvdDataQueue(ptr noundef nonnull %24) #3
  %59 = getelementptr inbounds i8, ptr %24, i64 128
  call void @NetMapClean(ptr noundef nonnull %59) #3
  %60 = getelementptr inbounds i8, ptr %24, i64 24
  %61 = call ptr @RemoveEntryList(ptr noundef nonnull %60) #3
  %62 = getelementptr inbounds i8, ptr %11, i64 80
  %63 = load i64, ptr %62, align 8, !tbaa !37
  %64 = add i64 %63, -1
  store i64 %64, ptr %62, align 8, !tbaa !37
  %65 = load ptr, ptr @gBS, align 8, !tbaa !15
  %66 = getelementptr inbounds i8, ptr %65, i64 32
  %67 = load ptr, ptr %66, align 8, !tbaa !38
  call void %67(i64 noundef %54) #3
  call void @FreePool(ptr noundef nonnull %24) #3
  br label %68

68:                                               ; preds = %._crit_edge, %._crit_edge36, %2, %50, %49
  %.0 = phi i64 [ %42, %49 ], [ %42, %50 ], [ -9223372036854775806, %2 ], [ -9223372036854775805, %._crit_edge36 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i64 %.0
}

declare void @MnpFlushRcvdDataQueue(ptr noundef) local_unnamed_addr #1

declare void @NetMapClean(ptr noundef) local_unnamed_addr #1

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 24, !11, i64 32, !12, i64 40, !11, i64 56, !10, i64 64, !13, i64 80, !7, i64 88, !14, i64 92, !8, i64 94}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !11, i64 0, !11, i64 8}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 280}
!17 = !{!"", !18, i64 0, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !11, i64 272, !11, i64 280, !11, i64 288, !11, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360, !11, i64 368}
!18 = !{!"", !13, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!19 = !{!20, !11, i64 40}
!20 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !11, i64 32, !11, i64 40}
!21 = !{!22, !7, i64 0}
!22 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16, !10, i64 24, !23, i64 40, !8, i64 104, !8, i64 105, !10, i64 112, !24, i64 128, !10, i64 168, !10, i64 184, !13, i64 200, !25, i64 208, !8, i64 228}
!23 = !{!"_EFI_MANAGED_NETWORK_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56}
!24 = !{!"", !10, i64 0, !10, i64 16, !13, i64 32}
!25 = !{!"", !7, i64 0, !7, i64 4, !14, i64 8, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !8, i64 16}
!26 = !{!22, !8, i64 105}
!27 = !{!17, !11, i64 288}
!28 = !{!6, !11, i64 32}
!29 = !{!6, !11, i64 24}
!30 = !{!31, !11, i64 16}
!31 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16, !32, i64 24, !13, i64 48, !11, i64 56, !11, i64 64, !10, i64 72, !13, i64 88, !10, i64 96, !7, i64 112, !11, i64 120, !33, i64 128, !13, i64 184, !11, i64 192, !8, i64 200, !11, i64 208, !11, i64 216, !7, i64 224, !7, i64 228, !7, i64 232, !7, i64 236, !7, i64 240, !7, i64 244, !11, i64 248, !11, i64 256}
!32 = !{!"_EFI_VLAN_CONFIG_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16}
!33 = !{!"", !7, i64 0, !13, i64 8, !10, i64 16, !10, i64 32, !7, i64 48, !7, i64 52}
!34 = !{!17, !11, i64 336}
!35 = !{!17, !11, i64 24}
!36 = !{!23, !11, i64 8}
!37 = !{!6, !13, i64 80}
!38 = !{!17, !11, i64 32}


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