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

; 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._IP4_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, %struct.IP4_ASSEMBLE_TABLE, %struct.IGMP_SERVICE_DATA, ptr, ptr, ptr, ptr, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, %struct.EFI_SIMPLE_NETWORK_MODE, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.IP4_ASSEMBLE_TABLE = type { [31 x %struct._LIST_ENTRY] }
%struct.IGMP_SERVICE_DATA = type { i64, %struct._LIST_ENTRY }
%struct.EFI_MANAGED_NETWORK_CONFIG_DATA = type { i32, i32, i16, i8, i8, i8, i8, i8, i8, i8 }
%struct.EFI_SIMPLE_NETWORK_MODE = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x %struct.EFI_MAC_ADDRESS], %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i8, i8, i8, i8, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.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._IP4_PROTOCOL = type { i32, %struct._EFI_IP4_PROTOCOL, ptr, i64, ptr, %struct._LIST_ENTRY, %struct.NET_MAP, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct.EFI_LOCK, ptr, %struct._LIST_ENTRY, ptr, ptr, i32, ptr, i32, %struct.EFI_IP4_CONFIG_DATA }
%struct._EFI_IP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct.EFI_IP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, i8, i8, i8, i32, i32 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._IP4_INTERFACE = type { i32, %struct._LIST_ENTRY, i64, i32, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i32, %struct._LIST_ENTRY, i8 }

@gIp4DriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [151 x i8], align 1
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiArpProtocolGuid = external global %struct.GUID, align 4
@gEfiIp4ProtocolGuid = external global %struct.GUID, align 4

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

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

declare zeroext i8 @DebugAssertEnabled() #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip4ServiceBindingDestroyChild(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 i64, align 8
  %12 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %18, label %15

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

18:                                               ; preds = %15, %2
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

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

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = ptrtoint ptr %24 to i64
  %26 = sub i64 %25, ptrtoint (ptr getelementptr inbounds (%struct._IP4_SERVICE, ptr null, i32 0, i32 1) to i64)
  %27 = inttoptr i64 %26 to ptr
  %28 = getelementptr inbounds %struct._IP4_SERVICE, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !9
  %30 = icmp ne i32 %29, 1395937353
  br i1 %30, label %31, label %33

31:                                               ; preds = %23
  call void @DebugAssert(ptr noundef @.str, i64 noundef 887, ptr noundef @.str.2)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  br label %38

33:                                               ; preds = %23, %19
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = ptrtoint ptr %34 to i64
  %36 = sub i64 %35, ptrtoint (ptr getelementptr inbounds (%struct._IP4_SERVICE, ptr null, i32 0, i32 1) to i64)
  %37 = inttoptr i64 %36 to ptr
  br label %38

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

49:                                               ; preds = %38
  store i64 -9223372036854775805, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

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

54:                                               ; preds = %50
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = ptrtoint ptr %55 to i64
  %57 = sub i64 %56, ptrtoint (ptr getelementptr inbounds (%struct._IP4_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %58 = inttoptr i64 %57 to ptr
  %59 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !26
  %61 = icmp ne i32 %60, 1345605705
  br i1 %61, label %62, label %64

62:                                               ; preds = %54
  call void @DebugAssert(ptr noundef @.str, i64 noundef 902, ptr noundef @.str.2)
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  br label %69

64:                                               ; preds = %54, %50
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = ptrtoint ptr %65 to i64
  %67 = sub i64 %66, ptrtoint (ptr getelementptr inbounds (%struct._IP4_PROTOCOL, ptr null, i32 0, i32 1) to i64)
  %68 = inttoptr i64 %67 to ptr
  br label %69

69:                                               ; preds = %64, %62
  %70 = phi ptr [ %63, %62 ], [ %68, %64 ]
  store ptr %70, ptr %8, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %71, i32 0, i32 4
  %73 = load ptr, ptr %72, align 8, !tbaa !32
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = icmp ne ptr %73, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

77:                                               ; preds = %69
  %78 = load ptr, ptr @gBS, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !33
  %81 = call i64 %80(i64 noundef 8)
  store i64 %81, ptr %10, align 8, !tbaa !25
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %82, i32 0, i32 3
  %84 = load i64, ptr %83, align 8, !tbaa !34
  %85 = icmp eq i64 %84, 2
  br i1 %85, label %86, label %91

86:                                               ; preds = %77
  %87 = load ptr, ptr @gBS, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !35
  %90 = load i64, ptr %10, align 8, !tbaa !25
  call void %89(i64 noundef %90)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

91:                                               ; preds = %77
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %92, i32 0, i32 3
  %94 = load i64, ptr %93, align 8, !tbaa !34
  store i64 %94, ptr %11, align 8, !tbaa !25
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %95, i32 0, i32 3
  store i64 2, ptr %96, align 8, !tbaa !34
  %97 = load ptr, ptr @gBS, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %97, i32 0, i32 34
  %99 = load ptr, ptr %98, align 8, !tbaa !36
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._IP4_SERVICE, ptr %100, i32 0, i32 12
  %102 = load ptr, ptr %101, align 8, !tbaa !37
  %103 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gIp4DriverBinding, i32 0, i32 5), align 8, !tbaa !23
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = call i64 %99(ptr noundef %102, ptr noundef @gEfiManagedNetworkProtocolGuid, ptr noundef %103, ptr noundef %104)
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %106, i32 0, i32 11
  %108 = load ptr, ptr %107, align 8, !tbaa !38
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %129

110:                                              ; preds = %91
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %111, i32 0, i32 11
  %113 = load ptr, ptr %112, align 8, !tbaa !38
  %114 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %113, i32 0, i32 11
  %115 = load ptr, ptr %114, align 8, !tbaa !39
  %116 = icmp ne ptr %115, null
  br i1 %116, label %117, label %129

117:                                              ; preds = %110
  %118 = load ptr, ptr @gBS, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %118, i32 0, i32 34
  %120 = load ptr, ptr %119, align 8, !tbaa !36
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %121, i32 0, i32 11
  %123 = load ptr, ptr %122, align 8, !tbaa !38
  %124 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %123, i32 0, i32 12
  %125 = load ptr, ptr %124, align 8, !tbaa !41
  %126 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gIp4DriverBinding, i32 0, i32 5), align 8, !tbaa !23
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = call i64 %120(ptr noundef %125, ptr noundef @gEfiArpProtocolGuid, ptr noundef %126, ptr noundef %127)
  br label %129

129:                                              ; preds = %117, %110, %91
  %130 = load ptr, ptr @gBS, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %131, align 8, !tbaa !35
  %133 = load i64, ptr %10, align 8, !tbaa !25
  call void %132(i64 noundef %133)
  %134 = load ptr, ptr @gBS, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %134, i32 0, i32 16
  %136 = load ptr, ptr %135, align 8, !tbaa !42
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %138, i32 0, i32 1
  %140 = call i64 %136(ptr noundef %137, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %139)
  store i64 %140, ptr %6, align 8, !tbaa !25
  %141 = load ptr, ptr @gBS, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %141, i32 0, i32 1
  %143 = load ptr, ptr %142, align 8, !tbaa !33
  %144 = call i64 %143(i64 noundef 8)
  store i64 %144, ptr %10, align 8, !tbaa !25
  %145 = load i64, ptr %6, align 8, !tbaa !25
  %146 = icmp slt i64 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %129
  br label %172

148:                                              ; preds = %129
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = call i64 @Ip4CleanProtocol(ptr noundef %149)
  store i64 %150, ptr %6, align 8, !tbaa !25
  %151 = load i64, ptr %6, align 8, !tbaa !25
  %152 = icmp slt i64 %151, 0
  br i1 %152, label %153, label %159

153:                                              ; preds = %148
  %154 = load ptr, ptr @gBS, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %154, i32 0, i32 39
  %156 = load ptr, ptr %155, align 8, !tbaa !43
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  %158 = call i64 (ptr, ...) %156(ptr noundef %5, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %157, ptr noundef null)
  br label %172

159:                                              ; preds = %148
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %160, i32 0, i32 5
  %162 = call ptr @RemoveEntryList(ptr noundef %161)
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._IP4_SERVICE, ptr %163, i32 0, i32 3
  %165 = load i64, ptr %164, align 8, !tbaa !44
  %166 = add i64 %165, -1
  store i64 %166, ptr %164, align 8, !tbaa !44
  %167 = load ptr, ptr @gBS, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %167, i32 0, i32 2
  %169 = load ptr, ptr %168, align 8, !tbaa !35
  %170 = load i64, ptr %10, align 8, !tbaa !25
  call void %169(i64 noundef %170)
  %171 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %171)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

172:                                              ; preds = %153, %147
  %173 = load i64, ptr %11, align 8, !tbaa !25
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %174, i32 0, i32 3
  store i64 %173, ptr %175, align 8, !tbaa !34
  %176 = load ptr, ptr @gBS, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %176, i32 0, i32 2
  %178 = load ptr, ptr %177, align 8, !tbaa !35
  %179 = load i64, ptr %10, align 8, !tbaa !25
  call void %178(i64 noundef %179)
  %180 = load i64, ptr %6, align 8, !tbaa !25
  store i64 %180, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %181

181:                                              ; preds = %172, %159, %86, %76, %49, %18
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %182 = load i64, ptr %3, align 8
  ret i64 %182
}

declare void @FreePool(ptr noundef) #1

declare i64 @Ip4CleanProtocol(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 = !{!"_IP4_SERVICE", !11, i64 0, !12, i64 8, !13, i64 24, !13, i64 32, !14, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !15, i64 88, !16, i64 584, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !17, i64 640, !19, i64 660, !6, i64 1320, !6, i64 1328, !6, i64 1336, !6, i64 1344, !6, i64 1352, !11, i64 1360, !11, i64 1364}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"", !7, i64 0}
!16 = !{!"", !13, i64 0, !14, i64 8}
!17 = !{!"", !11, i64 0, !11, i64 4, !18, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !15, i64 552, !15, i64 584, !15, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!20 = !{!21, !6, i64 280}
!21 = !{!"", !22, 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}
!22 = !{!"", !13, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!23 = !{!24, !6, i64 40}
!24 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!25 = !{!13, !13, i64 0}
!26 = !{!27, !11, i64 0}
!27 = !{!"_IP4_PROTOCOL", !11, i64 0, !28, i64 8, !6, i64 72, !13, i64 80, !6, i64 88, !14, i64 96, !29, i64 112, !29, i64 152, !14, i64 192, !14, i64 208, !30, i64 224, !6, i64 248, !14, i64 256, !6, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !11, i64 304, !31, i64 308}
!28 = !{!"_EFI_IP4_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}
!29 = !{!"", !14, i64 0, !14, i64 16, !13, i64 32}
!30 = !{!"", !13, i64 0, !13, i64 8, !11, i64 16}
!31 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !15, i64 6, !15, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !11, i64 20, !11, i64 24}
!32 = !{!27, !6, i64 88}
!33 = !{!21, !6, i64 24}
!34 = !{!27, !13, i64 80}
!35 = !{!21, !6, i64 32}
!36 = !{!21, !6, i64 288}
!37 = !{!10, !6, i64 624}
!38 = !{!27, !6, i64 248}
!39 = !{!40, !6, i64 80}
!40 = !{!"_IP4_INTERFACE", !11, i64 0, !14, i64 8, !13, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !7, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !14, i64 96, !14, i64 112, !6, i64 128, !15, i64 136, !15, i64 168, !11, i64 200, !14, i64 208, !7, i64 224}
!41 = !{!40, !6, i64 88}
!42 = !{!21, !6, i64 144}
!43 = !{!21, !6, i64 328}
!44 = !{!10, !13, 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] }

@gIp4DriverBinding = external dso_local local_unnamed_addr global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@gBS = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [151 x i8], align 1
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiArpProtocolGuid = external global %struct.GUID, align 4
@gEfiIp4ProtocolGuid = external global %struct.GUID, align 4

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

; 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 @DebugAssertEnabled() local_unnamed_addr #1

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

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

7:                                                ; preds = %2
  %8 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %8, 0
  %.pre43 = ptrtoint ptr %0 to i64
  %.pre44 = add i64 %.pre43, -8
  %.pre46 = inttoptr i64 %.pre44 to ptr
  br i1 %.not, label %._crit_edge42, label %9

9:                                                ; preds = %7
  %10 = load i32, ptr %.pre46, align 8, !tbaa !9
  %.not36 = icmp eq i32 %10, 1395937353
  br i1 %.not36, label %._crit_edge42, label %11

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

._crit_edge42:                                    ; preds = %7, %9, %11
  %12 = phi ptr [ %0, %11 ], [ %.pre46, %9 ], [ %.pre46, %7 ]
  %13 = load ptr, ptr @gBS, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 280
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @gIp4DriverBinding, i64 40), align 8, !tbaa !23
  %17 = call i64 %15(ptr noundef nonnull %1, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %4, ptr noundef %16, ptr noundef nonnull %1, i32 noundef 2) #3
  %18 = icmp slt i64 %17, 0
  br i1 %18, label %97, label %19

19:                                               ; preds = %._crit_edge42
  %20 = call zeroext i8 @DebugAssertEnabled() #3
  %.not37 = icmp eq i8 %20, 0
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  %.pre48 = ptrtoint ptr %.pre to i64
  %.pre50 = add i64 %.pre48, -8
  %.pre52 = inttoptr i64 %.pre50 to ptr
  br i1 %.not37, label %._crit_edge, label %21

21:                                               ; preds = %19
  %22 = load i32, ptr %.pre52, align 8, !tbaa !25
  %.not38 = icmp eq i32 %22, 1345605705
  br i1 %.not38, label %._crit_edge, label %23

23:                                               ; preds = %21
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 902, ptr noundef nonnull @.str.2) #3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %19, %21, %23
  %25 = phi ptr [ %24, %23 ], [ %.pre52, %21 ], [ %.pre52, %19 ]
  %26 = getelementptr inbounds i8, ptr %25, i64 88
  %27 = load ptr, ptr %26, align 8, !tbaa !31
  %.not39 = icmp eq ptr %27, %12
  br i1 %.not39, label %28, label %97

28:                                               ; preds = %._crit_edge
  %29 = load ptr, ptr @gBS, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 24
  %31 = load ptr, ptr %30, align 8, !tbaa !32
  %32 = call i64 %31(i64 noundef 8) #3
  %33 = getelementptr inbounds i8, ptr %25, i64 80
  %34 = load i64, ptr %33, align 8, !tbaa !33
  %35 = icmp eq i64 %34, 2
  br i1 %35, label %36, label %40

36:                                               ; preds = %28
  %37 = load ptr, ptr @gBS, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 32
  %39 = load ptr, ptr %38, align 8, !tbaa !34
  call void %39(i64 noundef %32) #3
  br label %97

40:                                               ; preds = %28
  store i64 2, ptr %33, align 8, !tbaa !33
  %41 = load ptr, ptr @gBS, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 288
  %43 = load ptr, ptr %42, align 8, !tbaa !35
  %44 = getelementptr inbounds i8, ptr %12, i64 624
  %45 = load ptr, ptr %44, align 8, !tbaa !36
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @gIp4DriverBinding, i64 40), align 8, !tbaa !23
  %47 = call i64 %43(ptr noundef %45, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid, ptr noundef %46, ptr noundef nonnull %1) #3
  %48 = getelementptr inbounds i8, ptr %25, i64 248
  %49 = load ptr, ptr %48, align 8, !tbaa !37
  %.not40 = icmp eq ptr %49, null
  br i1 %.not40, label %61, label %50

50:                                               ; preds = %40
  %51 = getelementptr inbounds i8, ptr %49, i64 80
  %52 = load ptr, ptr %51, align 8, !tbaa !38
  %.not41 = icmp eq ptr %52, null
  br i1 %.not41, label %61, label %53

53:                                               ; preds = %50
  %54 = load ptr, ptr @gBS, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 288
  %56 = load ptr, ptr %55, align 8, !tbaa !35
  %57 = getelementptr inbounds i8, ptr %49, i64 88
  %58 = load ptr, ptr %57, align 8, !tbaa !40
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @gIp4DriverBinding, i64 40), align 8, !tbaa !23
  %60 = call i64 %56(ptr noundef %58, ptr noundef nonnull @gEfiArpProtocolGuid, ptr noundef %59, ptr noundef nonnull %1) #3
  br label %61

61:                                               ; preds = %53, %50, %40
  %62 = load ptr, ptr @gBS, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 32
  %64 = load ptr, ptr %63, align 8, !tbaa !34
  call void %64(i64 noundef %32) #3
  %65 = load ptr, ptr @gBS, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 144
  %67 = load ptr, ptr %66, align 8, !tbaa !41
  %68 = getelementptr inbounds i8, ptr %25, i64 8
  %69 = call i64 %67(ptr noundef nonnull %1, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %68) #3
  %70 = load ptr, ptr @gBS, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 24
  %72 = load ptr, ptr %71, align 8, !tbaa !32
  %73 = call i64 %72(i64 noundef 8) #3
  %74 = icmp slt i64 %69, 0
  br i1 %74, label %93, label %75

75:                                               ; preds = %61
  %76 = call i64 @Ip4CleanProtocol(ptr noundef nonnull %25) #3
  %77 = icmp slt i64 %76, 0
  br i1 %77, label %78, label %84

78:                                               ; preds = %75
  %79 = load ptr, ptr @gBS, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 328
  %81 = load ptr, ptr %80, align 8, !tbaa !42
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = call i64 (ptr, ...) %81(ptr noundef nonnull %3, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef %82, ptr noundef null) #3
  br label %93

84:                                               ; preds = %75
  %85 = getelementptr inbounds i8, ptr %25, i64 96
  %86 = call ptr @RemoveEntryList(ptr noundef nonnull %85) #3
  %87 = getelementptr inbounds i8, ptr %12, i64 32
  %88 = load i64, ptr %87, align 8, !tbaa !43
  %89 = add i64 %88, -1
  store i64 %89, ptr %87, align 8, !tbaa !43
  %90 = load ptr, ptr @gBS, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i64 32
  %92 = load ptr, ptr %91, align 8, !tbaa !34
  call void %92(i64 noundef %73) #3
  call void @FreePool(ptr noundef nonnull %25) #3
  br label %97

93:                                               ; preds = %61, %78
  %.029 = phi i64 [ %69, %61 ], [ %76, %78 ]
  store i64 %34, ptr %33, align 8, !tbaa !33
  %94 = load ptr, ptr @gBS, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i64 32
  %96 = load ptr, ptr %95, align 8, !tbaa !34
  call void %96(i64 noundef %73) #3
  br label %97

97:                                               ; preds = %._crit_edge, %._crit_edge42, %2, %93, %84, %36
  %.0 = phi i64 [ 0, %36 ], [ %.029, %93 ], [ 0, %84 ], [ -9223372036854775806, %2 ], [ -9223372036854775805, %._crit_edge42 ], [ -9223372036854775806, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i64 %.0
}

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare i64 @Ip4CleanProtocol(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, !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 = !{!"_IP4_SERVICE", !11, i64 0, !12, i64 8, !13, i64 24, !13, i64 32, !14, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !15, i64 88, !16, i64 584, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !17, i64 640, !19, i64 660, !6, i64 1320, !6, i64 1328, !6, i64 1336, !6, i64 1344, !6, i64 1352, !11, i64 1360, !11, i64 1364}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"", !7, i64 0}
!16 = !{!"", !13, i64 0, !14, i64 8}
!17 = !{!"", !11, i64 0, !11, i64 4, !18, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !15, i64 552, !15, i64 584, !15, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!20 = !{!21, !6, i64 280}
!21 = !{!"", !22, 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}
!22 = !{!"", !13, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!23 = !{!24, !6, i64 40}
!24 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!25 = !{!26, !11, i64 0}
!26 = !{!"_IP4_PROTOCOL", !11, i64 0, !27, i64 8, !6, i64 72, !13, i64 80, !6, i64 88, !14, i64 96, !28, i64 112, !28, i64 152, !14, i64 192, !14, i64 208, !29, i64 224, !6, i64 248, !14, i64 256, !6, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !11, i64 304, !30, i64 308}
!27 = !{!"_EFI_IP4_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}
!28 = !{!"", !14, i64 0, !14, i64 16, !13, i64 32}
!29 = !{!"", !13, i64 0, !13, i64 8, !11, i64 16}
!30 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !15, i64 6, !15, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !11, i64 20, !11, i64 24}
!31 = !{!26, !6, i64 88}
!32 = !{!21, !6, i64 24}
!33 = !{!26, !13, i64 80}
!34 = !{!21, !6, i64 32}
!35 = !{!21, !6, i64 288}
!36 = !{!10, !6, i64 624}
!37 = !{!26, !6, i64 248}
!38 = !{!39, !6, i64 80}
!39 = !{!"_IP4_INTERFACE", !11, i64 0, !14, i64 8, !13, i64 24, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !7, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !14, i64 96, !14, i64 112, !6, i64 128, !15, i64 136, !15, i64 168, !11, i64 200, !14, i64 208, !7, i64 224}
!40 = !{!39, !6, i64 88}
!41 = !{!21, !6, i64 144}
!42 = !{!21, !6, i64 328}
!43 = !{!10, !13, i64 32}


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