; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/Ip6Dxe (Ip6DriverBindingStop)

; 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.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT = type { ptr, i64, 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._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct._IP6_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, %struct.IP6_LINK_RX_TOKEN, %struct.IP6_ASSEMBLE_TABLE, %struct.IP6_MLD_SERVICE_DATA, %struct.EFI_IPv6_ADDRESS, i8, i8, i8, i8, i8, i32, i32, i32, i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i8, ptr, i8, i8, i32, ptr, ptr, ptr, ptr, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, %struct.EFI_SIMPLE_NETWORK_MODE, ptr, ptr, %struct._IP6_CONFIG_INSTANCE, ptr, i32, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct.IP6_LINK_RX_TOKEN = type { i32, ptr, ptr, %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN }
%struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct.IP6_ASSEMBLE_TABLE = type { [127 x %struct._LIST_ENTRY] }
%struct.IP6_MLD_SERVICE_DATA = type { i64, %struct._LIST_ENTRY }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._LIST_ENTRY = type { ptr, ptr }
%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._IP6_CONFIG_INSTANCE = type { i32, i8, %struct._LIST_ENTRY, i16, %struct.EFI_IP6_CONFIG_INTERFACE_INFO, %struct.EFI_IP6_CONFIG_INTERFACE_ID, i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, [7 x %struct.IP6_CONFIG_DATA_ITEM], %struct.NET_MAP, %struct.NET_MAP, %struct._EFI_IP6_CONFIG_PROTOCOL, ptr, ptr, ptr, ptr, i8, i32, ptr, i32, ptr, i32, %struct._IP6_FORM_CALLBACK_INFO, %struct.IP6_CONFIG_NVDATA }
%struct.EFI_IP6_CONFIG_INTERFACE_INFO = type { [32 x i16], i8, i32, %struct.EFI_MAC_ADDRESS, i32, ptr, i32, ptr }
%struct.EFI_IP6_CONFIG_INTERFACE_ID = type { [8 x i8] }
%struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS = type { i32 }
%struct.IP6_CONFIG_DATA_ITEM = type { ptr, ptr, i64, i8, %struct.NET_MAP, %union.IP6_CONFIG_DATA, i64 }
%union.IP6_CONFIG_DATA = type { ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct._EFI_IP6_CONFIG_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._IP6_FORM_CALLBACK_INFO = type { i32, ptr, %struct._EFI_HII_CONFIG_ACCESS_PROTOCOL, ptr, ptr }
%struct._EFI_HII_CONFIG_ACCESS_PROTOCOL = type { ptr, ptr, ptr }
%struct.IP6_CONFIG_NVDATA = type { i32, %struct.EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS, %struct.EFI_IP6_CONFIG_INTERFACE_ID, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i32 }

@gBS = external global ptr, align 8
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [131 x i8], align 1
@gEfiIp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiIp6ConfigProtocolGuid = external global %struct.GUID, align 4
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiDhcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6DriverBindingStop(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, 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 ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i8, align 1
  %17 = alloca %struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #3
  store i8 0, ptr %16, align 1, !tbaa !11
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = call ptr @NetLibGetNicHandle(ptr noundef %19, ptr noundef @gEfiManagedNetworkProtocolGuid)
  store ptr %20, ptr %12, align 8, !tbaa !5
  %21 = load ptr, ptr %12, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %31

23:                                               ; preds = %4
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = call ptr @NetLibGetNicHandle(ptr noundef %24, ptr noundef @gEfiDhcp6ProtocolGuid)
  store ptr %25, ptr %12, align 8, !tbaa !5
  %26 = load ptr, ptr %12, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %23
  store i8 1, ptr %16, align 1, !tbaa !11
  br label %30

29:                                               ; preds = %23
  store i64 0, ptr %5, align 8
  store i32 1, ptr %18, align 4
  br label %157

30:                                               ; preds = %28
  br label %31

31:                                               ; preds = %30, %4
  %32 = load ptr, ptr @gBS, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %32, i32 0, i32 33
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = load ptr, ptr %6, 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 !16
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = call i64 %34(ptr noundef %35, ptr noundef @gEfiIp6ServiceBindingProtocolGuid, ptr noundef %10, ptr noundef %38, ptr noundef %39, i32 noundef 2)
  store i64 %40, ptr %13, align 8, !tbaa !9
  %41 = load i64, ptr %13, align 8, !tbaa !9
  %42 = icmp slt i64 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %31
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %18, align 4
  br label %157

44:                                               ; preds = %31
  %45 = call zeroext i8 @DebugAssertEnabled()
  %46 = zext i8 %45 to i32
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %58

48:                                               ; preds = %44
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = ptrtoint ptr %49 to i64
  %51 = sub i64 %50, ptrtoint (ptr getelementptr inbounds (%struct._IP6_SERVICE, ptr null, i32 0, i32 1) to i64)
  %52 = inttoptr i64 %51 to ptr
  %53 = getelementptr inbounds %struct._IP6_SERVICE, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !18
  %55 = icmp ne i32 %54, 1396068425
  br i1 %55, label %56, label %58

56:                                               ; preds = %48
  call void @DebugAssert(ptr noundef @.str, i64 noundef 678, ptr noundef @.str.3)
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  br label %63

58:                                               ; preds = %48, %44
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = ptrtoint ptr %59 to i64
  %61 = sub i64 %60, ptrtoint (ptr getelementptr inbounds (%struct._IP6_SERVICE, ptr null, i32 0, i32 1) to i64)
  %62 = inttoptr i64 %61 to ptr
  br label %63

63:                                               ; preds = %58, %56
  %64 = phi ptr [ %57, %56 ], [ %62, %58 ]
  store ptr %64, ptr %11, align 8, !tbaa !5
  %65 = load i8, ptr %16, align 1, !tbaa !11
  %66 = icmp ne i8 %65, 0
  br i1 %66, label %67, label %82

67:                                               ; preds = %63
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._IP6_SERVICE, ptr %68, i32 0, i32 39
  %70 = call i64 @Ip6ConfigDestroyDhcp6(ptr noundef %69)
  store i64 %70, ptr %13, align 8, !tbaa !9
  %71 = load ptr, ptr @gBS, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %71, i32 0, i32 12
  %73 = load ptr, ptr %72, align 8, !tbaa !37
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._IP6_SERVICE, ptr %74, i32 0, i32 39
  %76 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %75, i32 0, i32 18
  %77 = load ptr, ptr %76, align 8, !tbaa !38
  %78 = call i64 %73(ptr noundef %77)
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._IP6_SERVICE, ptr %79, i32 0, i32 39
  %81 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %80, i32 0, i32 18
  store ptr null, ptr %81, align 8, !tbaa !38
  br label %154

82:                                               ; preds = %63
  %83 = load i64, ptr %8, align 8, !tbaa !9
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %85, label %96

85:                                               ; preds = %82
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._IP6_SERVICE, ptr %86, i32 0, i32 4
  store ptr %87, ptr %14, align 8, !tbaa !5
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT, ptr %17, i32 0, i32 0
  store ptr %88, ptr %89, align 8, !tbaa !39
  %90 = load i64, ptr %8, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT, ptr %17, i32 0, i32 1
  store i64 %90, ptr %91, align 8, !tbaa !41
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT, ptr %17, i32 0, i32 2
  store ptr %92, ptr %93, align 8, !tbaa !42
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = call i64 @NetDestroyLinkList(ptr noundef %94, ptr noundef @Ip6DestroyChildEntryInHandleBuffer, ptr noundef %17, ptr noundef null)
  store i64 %95, ptr %13, align 8, !tbaa !9
  br label %153

96:                                               ; preds = %82
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._IP6_SERVICE, ptr %97, i32 0, i32 4
  %99 = call zeroext i8 @IsListEmpty(ptr noundef %98)
  %100 = icmp ne i8 %99, 0
  br i1 %100, label %101, label %152

101:                                              ; preds = %96
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._IP6_SERVICE, ptr %102, i32 0, i32 2
  %104 = load i64, ptr %103, align 8, !tbaa !43
  store i64 %104, ptr %15, align 8, !tbaa !9
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._IP6_SERVICE, ptr %105, i32 0, i32 2
  store i64 3, ptr %106, align 8, !tbaa !43
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = call i64 @Ip6CleanService(ptr noundef %107)
  store i64 %108, ptr %13, align 8, !tbaa !9
  %109 = load i64, ptr %13, align 8, !tbaa !9
  %110 = icmp slt i64 %109, 0
  br i1 %110, label %111, label %115

111:                                              ; preds = %101
  %112 = load i64, ptr %15, align 8, !tbaa !9
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._IP6_SERVICE, ptr %113, i32 0, i32 2
  store i64 %112, ptr %114, align 8, !tbaa !43
  br label %155

115:                                              ; preds = %101
  %116 = load ptr, ptr @gBS, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %116, i32 0, i32 40
  %118 = load ptr, ptr %117, align 8, !tbaa !44
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._IP6_SERVICE, ptr %121, i32 0, i32 39
  %123 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %122, i32 0, i32 11
  %124 = call i64 (ptr, ...) %118(ptr noundef %119, ptr noundef @gEfiIp6ServiceBindingProtocolGuid, ptr noundef %120, ptr noundef @gEfiIp6ConfigProtocolGuid, ptr noundef %123, ptr noundef null)
  store i64 %124, ptr %13, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %115
  %126 = call zeroext i8 @DebugAssertEnabled()
  %127 = icmp ne i8 %126, 0
  br i1 %127, label %128, label %148

128:                                              ; preds = %125
  %129 = load i64, ptr %13, align 8, !tbaa !9
  %130 = icmp slt i64 %129, 0
  br i1 %130, label %131, label %147

131:                                              ; preds = %128
  br label %132

132:                                              ; preds = %131
  %133 = call zeroext i8 @DebugPrintEnabled()
  %134 = icmp ne i8 %133, 0
  br i1 %134, label %135, label %144

135:                                              ; preds = %132
  br label %136

136:                                              ; preds = %135
  %137 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %138 = icmp ne i8 %137, 0
  br i1 %138, label %139, label %141

139:                                              ; preds = %136
  %140 = load i64, ptr %13, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.4, i64 noundef %140)
  br label %141

141:                                              ; preds = %139, %136
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143, %132
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  call void @DebugAssert(ptr noundef @.str, i64 noundef 716, ptr noundef @.str.5)
  br label %147

147:                                              ; preds = %146, %128
  br label %148

148:                                              ; preds = %147, %125
  br label %149

149:                                              ; preds = %148
  br label %150

150:                                              ; preds = %149
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %151)
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %152

152:                                              ; preds = %150, %96
  br label %153

153:                                              ; preds = %152, %85
  br label %154

154:                                              ; preds = %153, %67
  br label %155

155:                                              ; preds = %154, %111
  %156 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %156, ptr %5, align 8
  store i32 1, ptr %18, align 4
  br label %157

157:                                              ; preds = %155, %43, %29
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  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
  %158 = load i64, ptr %5, align 8
  ret i64 %158
}

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

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

declare void @FreePool(ptr noundef) #2

declare zeroext i8 @IsListEmpty(ptr noundef) #2

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare ptr @NetLibGetNicHandle(ptr noundef, ptr noundef) #2

declare i64 @Ip6ConfigDestroyDhcp6(ptr noundef) #2

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

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

declare void @DebugPrint(i64 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!7, !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 = !{!"", !10, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !6, i64 40}
!17 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !6, i64 32, !6, i64 40}
!18 = !{!19, !15, i64 0}
!19 = !{!"_IP6_SERVICE", !15, i64 0, !20, i64 8, !10, i64 24, !10, i64 32, !21, i64 40, !21, i64 56, !6, i64 72, !6, i64 80, !22, i64 88, !24, i64 136, !25, i64 2168, !24, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !15, i64 2216, !15, i64 2220, !15, i64 2224, !15, i64 2228, !21, i64 2232, !21, i64 2248, !21, i64 2264, !21, i64 2280, !15, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !15, i64 2316, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !26, i64 2352, !28, i64 2372, !6, i64 3032, !6, i64 3040, !29, i64 3048, !6, i64 4176, !15, i64 4184, !15, i64 4188}
!20 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!21 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!22 = !{!"", !15, i64 0, !6, i64 8, !6, i64 16, !23, i64 24}
!23 = !{!"", !6, i64 0, !10, i64 8, !7, i64 16}
!24 = !{!"", !7, i64 0}
!25 = !{!"", !10, i64 0, !21, i64 8}
!26 = !{!"", !15, i64 0, !15, i64 4, !27, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!27 = !{!"short", !7, i64 0}
!28 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !7, i64 40, !24, i64 552, !24, i64 584, !24, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!29 = !{!"_IP6_CONFIG_INSTANCE", !15, i64 0, !7, i64 4, !21, i64 8, !27, i64 24, !30, i64 32, !24, i64 168, !15, i64 176, !31, i64 180, !7, i64 184, !32, i64 800, !32, i64 840, !33, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !15, i64 948, !6, i64 952, !15, i64 960, !6, i64 968, !15, i64 976, !34, i64 984, !36, i64 1040}
!30 = !{!"", !7, i64 0, !7, i64 64, !15, i64 68, !24, i64 72, !15, i64 104, !6, i64 112, !15, i64 120, !6, i64 128}
!31 = !{!"", !15, i64 0}
!32 = !{!"", !21, i64 0, !21, i64 16, !10, i64 32}
!33 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_IP6_FORM_CALLBACK_INFO", !15, i64 0, !6, i64 8, !35, i64 16, !6, i64 40, !6, i64 48}
!35 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!36 = !{!"", !15, i64 0, !31, i64 4, !24, i64 8, !21, i64 16, !15, i64 32, !21, i64 40, !15, i64 56, !21, i64 64, !15, i64 80}
!37 = !{!13, !6, i64 112}
!38 = !{!19, !6, i64 4000}
!39 = !{!40, !6, i64 0}
!40 = !{!"", !6, i64 0, !10, i64 8, !6, i64 16}
!41 = !{!40, !10, i64 8}
!42 = !{!40, !6, i64 16}
!43 = !{!19, !10, i64 24}
!44 = !{!13, !6, i64 336}


; 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] }
%struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT = type { ptr, i64, ptr }

@gBS = external local_unnamed_addr global ptr, align 8
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [131 x i8], align 1
@gEfiIp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiIp6ConfigProtocolGuid = external global %struct.GUID, align 4
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiDhcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.4 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6DriverBindingStop(ptr nocapture noundef readonly %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca ptr, align 8
  %6 = alloca %struct.IP6_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #3
  %7 = tail call ptr @NetLibGetNicHandle(ptr noundef %1, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid) #3
  %.not43 = icmp eq ptr %7, null
  br i1 %.not43, label %8, label %10

8:                                                ; preds = %4
  %9 = tail call ptr @NetLibGetNicHandle(ptr noundef %1, ptr noundef nonnull @gEfiDhcp6ProtocolGuid) #3
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %66, label %10

10:                                               ; preds = %8, %4
  %.032 = phi ptr [ %7, %4 ], [ %9, %8 ]
  %11 = load ptr, ptr @gBS, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 280
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = call i64 %13(ptr noundef nonnull %.032, ptr noundef nonnull @gEfiIp6ServiceBindingProtocolGuid, ptr noundef nonnull %5, ptr noundef %15, ptr noundef nonnull %.032, i32 noundef 2) #3
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %66, label %18

18:                                               ; preds = %10
  %19 = call zeroext i8 @DebugAssertEnabled() #3
  %.not40 = icmp eq i8 %19, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  %.pre48 = ptrtoint ptr %.pre to i64
  %.pre49 = add i64 %.pre48, -8
  %.pre51 = inttoptr i64 %.pre49 to ptr
  br i1 %.not40, label %._crit_edge, label %20

20:                                               ; preds = %18
  %21 = load i32, ptr %.pre51, align 8, !tbaa !16
  %.not41 = icmp eq i32 %21, 1396068425
  br i1 %.not41, label %._crit_edge, label %22

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

._crit_edge:                                      ; preds = %18, %20, %22
  %24 = phi ptr [ %23, %22 ], [ %.pre, %20 ], [ %.pre, %18 ]
  %25 = phi ptr [ %23, %22 ], [ %.pre51, %20 ], [ %.pre51, %18 ]
  br i1 %.not43, label %26, label %35

26:                                               ; preds = %._crit_edge
  %27 = getelementptr inbounds i8, ptr %25, i64 3048
  %28 = call i64 @Ip6ConfigDestroyDhcp6(ptr noundef nonnull %27) #3
  %29 = load ptr, ptr @gBS, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 112
  %31 = load ptr, ptr %30, align 8, !tbaa !35
  %32 = getelementptr inbounds i8, ptr %25, i64 4000
  %33 = load ptr, ptr %32, align 8, !tbaa !36
  %34 = call i64 %31(ptr noundef %33) #3
  store ptr null, ptr %32, align 8, !tbaa !36
  br label %66

35:                                               ; preds = %._crit_edge
  %.not44 = icmp eq i64 %2, 0
  %36 = getelementptr inbounds i8, ptr %25, i64 40
  br i1 %.not44, label %41, label %37

37:                                               ; preds = %35
  store ptr %24, ptr %6, align 8, !tbaa !37
  %38 = getelementptr inbounds i8, ptr %6, i64 8
  store i64 %2, ptr %38, align 8, !tbaa !39
  %39 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr %3, ptr %39, align 8, !tbaa !40
  %40 = call i64 @NetDestroyLinkList(ptr noundef nonnull %36, ptr noundef nonnull @Ip6DestroyChildEntryInHandleBuffer, ptr noundef nonnull %6, ptr noundef null) #3
  br label %66

41:                                               ; preds = %35
  %42 = call zeroext i8 @IsListEmpty(ptr noundef nonnull %36) #3
  %.not45 = icmp eq i8 %42, 0
  br i1 %.not45, label %66, label %43

43:                                               ; preds = %41
  %44 = getelementptr inbounds i8, ptr %25, i64 24
  %45 = load i64, ptr %44, align 8, !tbaa !41
  store i64 3, ptr %44, align 8, !tbaa !41
  %46 = call i64 @Ip6CleanService(ptr noundef %25)
  %47 = icmp slt i64 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %43
  store i64 %45, ptr %44, align 8, !tbaa !41
  br label %66

49:                                               ; preds = %43
  %50 = load ptr, ptr @gBS, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %50, i64 336
  %52 = load ptr, ptr %51, align 8, !tbaa !42
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %25, i64 3928
  %55 = call i64 (ptr, ...) %52(ptr noundef nonnull %.032, ptr noundef nonnull @gEfiIp6ServiceBindingProtocolGuid, ptr noundef %53, ptr noundef nonnull @gEfiIp6ConfigProtocolGuid, ptr noundef nonnull %54, ptr noundef null) #3
  %56 = call zeroext i8 @DebugAssertEnabled() #3
  %57 = icmp ne i8 %56, 0
  %58 = icmp slt i64 %55, 0
  %or.cond = select i1 %57, i1 %58, i1 false
  br i1 %or.cond, label %59, label %65

59:                                               ; preds = %49
  %60 = call zeroext i8 @DebugPrintEnabled() #3
  %.not46 = icmp eq i8 %60, 0
  br i1 %.not46, label %64, label %61

61:                                               ; preds = %59
  %62 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not47 = icmp eq i8 %62, 0
  br i1 %.not47, label %64, label %63

63:                                               ; preds = %61
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.4, i64 noundef %55) #3
  br label %64

64:                                               ; preds = %61, %63, %59
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 716, ptr noundef nonnull @.str.5) #3
  br label %65

65:                                               ; preds = %64, %49
  call void @FreePool(ptr noundef nonnull %25) #3
  br label %66

66:                                               ; preds = %48, %37, %65, %41, %26, %10, %8
  %.031 = phi i64 [ 0, %8 ], [ -9223372036854775801, %10 ], [ %28, %26 ], [ %40, %37 ], [ %46, %48 ], [ 0, %65 ], [ %16, %41 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.031
}

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare ptr @NetLibGetNicHandle(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i64 @Ip6ConfigDestroyDhcp6(ptr noundef) local_unnamed_addr #2

declare i64 @NetDestroyLinkList(ptr noundef, ptr noundef, ptr noundef, ptr 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

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 280}
!10 = !{!"", !11, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!17, !13, i64 0}
!17 = !{!"_IP6_SERVICE", !13, i64 0, !18, i64 8, !12, i64 24, !12, i64 32, !19, i64 40, !19, i64 56, !6, i64 72, !6, i64 80, !20, i64 88, !22, i64 136, !23, i64 2168, !22, i64 2192, !7, i64 2208, !7, i64 2209, !7, i64 2210, !7, i64 2211, !7, i64 2212, !13, i64 2216, !13, i64 2220, !13, i64 2224, !13, i64 2228, !19, i64 2232, !19, i64 2248, !19, i64 2264, !19, i64 2280, !13, i64 2296, !7, i64 2300, !6, i64 2304, !7, i64 2312, !7, i64 2313, !13, i64 2316, !6, i64 2320, !6, i64 2328, !6, i64 2336, !6, i64 2344, !24, i64 2352, !26, i64 2372, !6, i64 3032, !6, i64 3040, !27, i64 3048, !6, i64 4176, !13, i64 4184, !13, i64 4188}
!18 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !21, i64 24}
!21 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!22 = !{!"", !7, i64 0}
!23 = !{!"", !12, i64 0, !19, i64 8}
!24 = !{!"", !13, i64 0, !13, i64 4, !25, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!25 = !{!"short", !7, i64 0}
!26 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !7, i64 40, !22, i64 552, !22, i64 584, !22, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!27 = !{!"_IP6_CONFIG_INSTANCE", !13, i64 0, !7, i64 4, !19, i64 8, !25, i64 24, !28, i64 32, !22, i64 168, !13, i64 176, !29, i64 180, !7, i64 184, !30, i64 800, !30, i64 840, !31, i64 880, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !7, i64 944, !13, i64 948, !6, i64 952, !13, i64 960, !6, i64 968, !13, i64 976, !32, i64 984, !34, i64 1040}
!28 = !{!"", !7, i64 0, !7, i64 64, !13, i64 68, !22, i64 72, !13, i64 104, !6, i64 112, !13, i64 120, !6, i64 128}
!29 = !{!"", !13, i64 0}
!30 = !{!"", !19, i64 0, !19, i64 16, !12, i64 32}
!31 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!32 = !{!"_IP6_FORM_CALLBACK_INFO", !13, i64 0, !6, i64 8, !33, i64 16, !6, i64 40, !6, i64 48}
!33 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"", !13, i64 0, !29, i64 4, !22, i64 8, !19, i64 16, !13, i64 32, !19, i64 40, !13, i64 56, !19, i64 64, !13, i64 80}
!35 = !{!10, !6, i64 112}
!36 = !{!17, !6, i64 4000}
!37 = !{!38, !6, i64 0}
!38 = !{!"", !6, i64 0, !12, i64 8, !6, i64 16}
!39 = !{!38, !12, i64 8}
!40 = !{!38, !6, i64 16}
!41 = !{!17, !12, i64 24}
!42 = !{!10, !6, i64 336}


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