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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_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
@.str = external hidden unnamed_addr constant [131 x i8], align 1
@gEfiIp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiIp6ConfigProtocolGuid = external global %struct.GUID, align 4
@mIp6Id = external global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip6DriverBindingStart(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %11 = load ptr, ptr @gBS, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %11, i32 0, i32 33
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %15, i32 0, i32 5
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call i64 %13(ptr noundef %14, ptr noundef @gEfiIp6ServiceBindingProtocolGuid, ptr noundef null, ptr noundef %17, ptr noundef %18, i32 noundef 4)
  store i64 %19, ptr %9, align 8, !tbaa !16
  %20 = load i64, ptr %9, align 8, !tbaa !16
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  store i64 -9223372036854775788, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %99

23:                                               ; preds = %3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %25, i32 0, i32 5
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = call i64 @Ip6CreateService(ptr noundef %24, ptr noundef %27, ptr noundef %8)
  store i64 %28, ptr %9, align 8, !tbaa !16
  %29 = load i64, ptr %9, align 8, !tbaa !16
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %23
  %32 = load i64, ptr %9, align 8, !tbaa !16
  store i64 %32, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %99

33:                                               ; preds = %23
  br label %34

34:                                               ; preds = %33
  %35 = call zeroext i8 @DebugAssertEnabled()
  %36 = icmp ne i8 %35, 0
  br i1 %36, label %37, label %42

37:                                               ; preds = %34
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  call void @DebugAssert(ptr noundef @.str, i64 noundef 524, ptr noundef @.str.2)
  br label %41

41:                                               ; preds = %40, %37
  br label %42

42:                                               ; preds = %41, %34
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr @gBS, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %45, i32 0, i32 39
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._IP6_SERVICE, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._IP6_SERVICE, ptr %50, i32 0, i32 39
  %52 = getelementptr inbounds %struct._IP6_CONFIG_INSTANCE, ptr %51, i32 0, i32 11
  %53 = call i64 (ptr, ...) %47(ptr noundef %6, ptr noundef @gEfiIp6ServiceBindingProtocolGuid, ptr noundef %49, ptr noundef @gEfiIp6ConfigProtocolGuid, ptr noundef %52, ptr noundef null)
  store i64 %53, ptr %9, align 8, !tbaa !16
  %54 = load i64, ptr %9, align 8, !tbaa !16
  %55 = icmp slt i64 %54, 0
  br i1 %55, label %93, label %56

56:                                               ; preds = %44
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = call i64 @Ip6ReceiveFrame(ptr noundef @Ip6AcceptFrame, ptr noundef %57)
  store i64 %58, ptr %9, align 8, !tbaa !16
  %59 = load i64, ptr %9, align 8, !tbaa !16
  %60 = icmp slt i64 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  br label %94

62:                                               ; preds = %56
  %63 = load ptr, ptr @gBS, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %63, i32 0, i32 9
  %65 = load ptr, ptr %64, align 8, !tbaa !18
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._IP6_SERVICE, ptr %66, i32 0, i32 38
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = call i64 %65(ptr noundef %68, i32 noundef 1, i64 noundef 1000000)
  store i64 %69, ptr %9, align 8, !tbaa !16
  %70 = load i64, ptr %9, align 8, !tbaa !16
  %71 = icmp slt i64 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %62
  br label %94

73:                                               ; preds = %62
  %74 = load ptr, ptr @gBS, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %74, i32 0, i32 9
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._IP6_SERVICE, ptr %77, i32 0, i32 37
  %79 = load ptr, ptr %78, align 8, !tbaa !38
  %80 = call i64 %76(ptr noundef %79, i32 noundef 1, i64 noundef 10000000)
  store i64 %80, ptr %9, align 8, !tbaa !16
  %81 = load i64, ptr %9, align 8, !tbaa !16
  %82 = icmp slt i64 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %73
  br label %94

84:                                               ; preds = %73
  %85 = call i32 @NetRandomInitSeed()
  %86 = zext i32 %85 to i64
  %87 = mul i64 %86, 1103515245
  %88 = add i64 %87, 12345
  %89 = trunc i64 %88 to i32
  %90 = zext i32 %89 to i64
  %91 = urem i64 %90, 4294967295
  %92 = trunc i64 %91 to i32
  store i32 %92, ptr @mIp6Id, align 4, !tbaa !39
  store i64 0, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %99

93:                                               ; preds = %44
  br label %94

94:                                               ; preds = %93, %83, %72, %61
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = call i64 @Ip6CleanService(ptr noundef %95)
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %97)
  %98 = load i64, ptr %9, align 8, !tbaa !16
  store i64 %98, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %99

99:                                               ; preds = %94, %84, %31, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %100 = load i64, ptr %4, align 8
  ret i64 %100
}

; 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

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

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare void @Ip6AcceptFrame(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #2

declare i32 @NetRandomInitSeed() #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 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 = !{!12, !12, i64 0}
!17 = !{!10, !6, i64 328}
!18 = !{!10, !6, i64 88}
!19 = !{!20, !6, i64 3040}
!20 = !{!"_IP6_SERVICE", !13, i64 0, !21, i64 8, !12, i64 24, !12, i64 32, !22, i64 40, !22, i64 56, !6, i64 72, !6, i64 80, !23, i64 88, !25, i64 136, !26, i64 2168, !25, 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, !22, i64 2232, !22, i64 2248, !22, i64 2264, !22, 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, !27, i64 2352, !29, i64 2372, !6, i64 3032, !6, i64 3040, !30, i64 3048, !6, i64 4176, !13, i64 4184, !13, i64 4188}
!21 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!22 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!23 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !24, i64 24}
!24 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!25 = !{!"", !7, i64 0}
!26 = !{!"", !12, i64 0, !22, i64 8}
!27 = !{!"", !13, i64 0, !13, i64 4, !28, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!28 = !{!"short", !7, i64 0}
!29 = !{!"", !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, !25, i64 552, !25, i64 584, !25, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!"_IP6_CONFIG_INSTANCE", !13, i64 0, !7, i64 4, !22, i64 8, !28, i64 24, !31, i64 32, !25, i64 168, !13, i64 176, !32, i64 180, !7, i64 184, !33, i64 800, !33, i64 840, !34, 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, !35, i64 984, !37, i64 1040}
!31 = !{!"", !7, i64 0, !7, i64 64, !13, i64 68, !25, i64 72, !13, i64 104, !6, i64 112, !13, i64 120, !6, i64 128}
!32 = !{!"", !13, i64 0}
!33 = !{!"", !22, i64 0, !22, i64 16, !12, i64 32}
!34 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!35 = !{!"_IP6_FORM_CALLBACK_INFO", !13, i64 0, !6, i64 8, !36, i64 16, !6, i64 40, !6, i64 48}
!36 = !{!"_EFI_HII_CONFIG_ACCESS_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!37 = !{!"", !13, i64 0, !32, i64 4, !25, i64 8, !22, i64 16, !13, i64 32, !22, i64 40, !13, i64 56, !22, i64 64, !13, i64 80}
!38 = !{!20, !6, i64 3032}
!39 = !{!13, !13, i64 0}


; 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] }

@gBS = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [131 x i8], align 1
@gEfiIp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiIp6ConfigProtocolGuid = external global %struct.GUID, align 4
@mIp6Id = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Ip6DriverBindingStart(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readnone %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = load ptr, ptr @gBS, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 280
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = tail call i64 %8(ptr noundef %1, ptr noundef nonnull @gEfiIp6ServiceBindingProtocolGuid, ptr noundef null, ptr noundef %10, ptr noundef %1, i32 noundef 4) #3
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %64, label %13

13:                                               ; preds = %3
  %14 = load ptr, ptr %9, align 8, !tbaa !14
  %15 = call i64 @Ip6CreateService(ptr noundef %1, ptr noundef %14, ptr noundef nonnull %5)
  %16 = icmp slt i64 %15, 0
  br i1 %16, label %64, label %17

17:                                               ; preds = %13
  %18 = call zeroext i8 @DebugAssertEnabled() #3
  %19 = icmp eq i8 %18, 0
  %20 = load ptr, ptr %5, align 8
  %21 = icmp ne ptr %20, null
  %or.cond = select i1 %19, i1 true, i1 %21
  br i1 %or.cond, label %23, label %22

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

23:                                               ; preds = %22, %17
  %24 = phi ptr [ %.pre, %22 ], [ %20, %17 ]
  %25 = load ptr, ptr @gBS, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 328
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %24, i64 8
  %29 = getelementptr inbounds i8, ptr %24, i64 3928
  %30 = call i64 (ptr, ...) %27(ptr noundef nonnull %4, ptr noundef nonnull @gEfiIp6ServiceBindingProtocolGuid, ptr noundef nonnull %28, ptr noundef nonnull @gEfiIp6ConfigProtocolGuid, ptr noundef nonnull %29, ptr noundef null) #3
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %60, label %32

32:                                               ; preds = %23
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call i64 @Ip6ReceiveFrame(ptr noundef nonnull @Ip6AcceptFrame, ptr noundef %33) #3
  %35 = icmp slt i64 %34, 0
  br i1 %35, label %60, label %36

36:                                               ; preds = %32
  %37 = load ptr, ptr @gBS, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i64 88
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 3040
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = call i64 %39(ptr noundef %42, i32 noundef 1, i64 noundef 1000000) #3
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %60, label %45

45:                                               ; preds = %36
  %46 = load ptr, ptr @gBS, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 88
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 3032
  %51 = load ptr, ptr %50, align 8, !tbaa !37
  %52 = call i64 %48(ptr noundef %51, i32 noundef 1, i64 noundef 10000000) #3
  %53 = icmp slt i64 %52, 0
  br i1 %53, label %60, label %54

54:                                               ; preds = %45
  %55 = call i32 @NetRandomInitSeed() #3
  %.fr = freeze i32 %55
  %56 = mul i32 %.fr, 1103515245
  %57 = add i32 %56, 12345
  %.not = icmp eq i32 %57, -1
  %58 = add nsw i32 %56, 12346
  %59 = select i1 %.not, i32 %58, i32 %57
  store i32 %59, ptr @mIp6Id, align 4, !tbaa !38
  br label %64

60:                                               ; preds = %23, %45, %36, %32
  %.0 = phi i64 [ %30, %23 ], [ %34, %32 ], [ %43, %36 ], [ %52, %45 ]
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i64 @Ip6CleanService(ptr noundef %61)
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  call void @FreePool(ptr noundef %63) #3
  br label %64

64:                                               ; preds = %13, %3, %60, %54
  %.011 = phi i64 [ %.0, %60 ], [ 0, %54 ], [ -9223372036854775788, %3 ], [ %15, %13 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.011
}

; 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

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare void @Ip6AcceptFrame(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #2

declare i32 @NetRandomInitSeed() 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 = !{!10, !6, i64 328}
!17 = !{!10, !6, i64 88}
!18 = !{!19, !6, i64 3040}
!19 = !{!"_IP6_SERVICE", !13, i64 0, !20, i64 8, !12, i64 24, !12, 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, !13, i64 2216, !13, i64 2220, !13, i64 2224, !13, i64 2228, !21, i64 2232, !21, i64 2248, !21, i64 2264, !21, 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, !26, i64 2352, !28, i64 2372, !6, i64 3032, !6, i64 3040, !29, i64 3048, !6, i64 4176, !13, i64 4184, !13, i64 4188}
!20 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!21 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!22 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !23, i64 24}
!23 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!24 = !{!"", !7, i64 0}
!25 = !{!"", !12, i64 0, !21, i64 8}
!26 = !{!"", !13, i64 0, !13, 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 = !{!"", !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, !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", !13, i64 0, !7, i64 4, !21, i64 8, !27, i64 24, !30, i64 32, !24, i64 168, !13, 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, !13, i64 948, !6, i64 952, !13, i64 960, !6, i64 968, !13, i64 976, !34, i64 984, !36, i64 1040}
!30 = !{!"", !7, i64 0, !7, i64 64, !13, i64 68, !24, i64 72, !13, i64 104, !6, i64 112, !13, i64 120, !6, i64 128}
!31 = !{!"", !13, i64 0}
!32 = !{!"", !21, i64 0, !21, i64 16, !12, i64 32}
!33 = !{!"_EFI_IP6_CONFIG_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!34 = !{!"_IP6_FORM_CALLBACK_INFO", !13, 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 = !{!"", !13, i64 0, !31, i64 4, !24, i64 8, !21, i64 16, !13, i64 32, !21, i64 40, !13, i64 56, !21, i64 64, !13, i64 80}
!37 = !{!19, !6, i64 3032}
!38 = !{!13, !13, i64 0}


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