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

; 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.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%struct._LIST_ENTRY = type { ptr, ptr }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct.IP6_LINK_TX_TOKEN = type { i32, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN, %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA = type { ptr, ptr, i16, i32, i16, i16, [1 x %struct.EFI_MANAGED_NETWORK_FRAGMENT_DATA] }
%struct.EFI_MANAGED_NETWORK_FRAGMENT_DATA = type { i32, ptr }
%struct._IP6_INTERFACE = type { i32, %struct._LIST_ENTRY, i64, %struct._LIST_ENTRY, i32, i8, ptr, ptr, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i8 }
%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.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.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._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 }
%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 }

@gBS = external global ptr, align 8

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

declare ptr @AllocatePool(i64 noundef) #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #1

declare void @FreePool(ptr noundef) #1

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

declare ptr @InitializeListHead(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @Ip6CreateLinkTxToken(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  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 4, ptr %16) #3
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.NET_BUF, ptr %18, i32 0, i32 8
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = sub i32 %20, 1
  %22 = zext i32 %21 to i64
  %23 = mul i64 %22, 16
  %24 = add i64 192, %23
  %25 = call ptr @AllocatePool(i64 noundef %24)
  store ptr %25, ptr %14, align 8, !tbaa !5
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %109

29:                                               ; preds = %5
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %30, i32 0, i32 0
  store i32 1412845641, ptr %31, align 8, !tbaa !14
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %32, i32 0, i32 1
  %34 = call ptr @InitializeListHead(ptr noundef %33)
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %36, i32 0, i32 2
  store ptr %35, ptr %37, align 8, !tbaa !20
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %39, i32 0, i32 3
  store ptr %38, ptr %40, align 8, !tbaa !21
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %42, i32 0, i32 4
  store ptr %41, ptr %43, align 8, !tbaa !22
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %45, i32 0, i32 5
  store ptr %44, ptr %46, align 8, !tbaa !23
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %47, i32 0, i32 6
  %49 = call ptr @ZeroMem(ptr noundef %48, i64 noundef 32)
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %50, i32 0, i32 7
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._IP6_INTERFACE, ptr %52, i32 0, i32 6
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds %struct._IP6_SERVICE, ptr %54, i32 0, i32 36
  %56 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %55, i32 0, i32 11
  %57 = call ptr @CopyMem(ptr noundef %51, ptr noundef %56, i64 noundef 32)
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %58, i32 0, i32 8
  store ptr %59, ptr %12, align 8, !tbaa !5
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN, ptr %60, i32 0, i32 1
  store i64 -9223372036854775802, ptr %61, align 8, !tbaa !26
  %62 = load ptr, ptr @gBS, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %62, i32 0, i32 8
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN, ptr %66, i32 0, i32 0
  %68 = call i64 %64(i32 noundef 512, i64 noundef 16, ptr noundef @Ip6OnFrameSent, ptr noundef %65, ptr noundef %67)
  store i64 %68, ptr %15, align 8, !tbaa !30
  %69 = load i64, ptr %15, align 8, !tbaa !30
  %70 = icmp slt i64 %69, 0
  br i1 %70, label %71, label %73

71:                                               ; preds = %29
  %72 = load ptr, ptr %14, align 8, !tbaa !5
  call void @FreePool(ptr noundef %72)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %109

73:                                               ; preds = %29
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %74, i32 0, i32 9
  store ptr %75, ptr %13, align 8, !tbaa !5
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_COMPLETION_TOKEN, ptr %77, i32 0, i32 2
  store ptr %76, ptr %78, align 8, !tbaa !31
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %79, i32 0, i32 6
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %81, i32 0, i32 0
  store ptr %80, ptr %82, align 8, !tbaa !32
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.IP6_LINK_TX_TOKEN, ptr %83, i32 0, i32 7
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %85, i32 0, i32 1
  store ptr %84, ptr %86, align 8, !tbaa !33
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %87, i32 0, i32 2
  store i16 -31011, ptr %88, align 8, !tbaa !34
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.NET_BUF, ptr %89, i32 0, i32 9
  %91 = load i32, ptr %90, align 4, !tbaa !35
  %92 = load ptr, ptr %13, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %92, i32 0, i32 3
  store i32 %91, ptr %93, align 4, !tbaa !36
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %94, i32 0, i32 4
  store i16 0, ptr %95, align 8, !tbaa !37
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.NET_BUF, ptr %96, i32 0, i32 8
  %98 = load i32, ptr %97, align 8, !tbaa !9
  store i32 %98, ptr %16, align 4, !tbaa !38
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %100, i32 0, i32 6
  %102 = getelementptr inbounds [1 x %struct.EFI_MANAGED_NETWORK_FRAGMENT_DATA], ptr %101, i64 0, i64 0
  %103 = call i64 @NetbufBuildExt(ptr noundef %99, ptr noundef %102, ptr noundef %16)
  %104 = load i32, ptr %16, align 4, !tbaa !38
  %105 = trunc i32 %104 to i16
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.EFI_MANAGED_NETWORK_TRANSMIT_DATA, ptr %106, i32 0, i32 5
  store i16 %105, ptr %107, align 2, !tbaa !39
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %108, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %109

109:                                              ; preds = %73, %71, %28
  call void @llvm.lifetime.end.p0(i64 4, 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
  %110 = load ptr, ptr %6, align 8
  ret ptr %110
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6OnFrameSent(ptr noundef, ptr noundef) #2

declare i64 @NetbufBuildExt(ptr noundef, ptr noundef, 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 128}
!10 = !{!"", !11, i64 0, !12, i64 8, !13, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !11, i64 128, !11, i64 132, !7, i64 136}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!15, !11, i64 0}
!15 = !{!"", !11, i64 0, !13, i64 8, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !16, i64 56, !16, i64 88, !17, i64 120, !18, i64 144}
!16 = !{!"", !7, i64 0}
!17 = !{!"", !6, i64 0, !12, i64 8, !7, i64 16}
!18 = !{!"", !6, i64 0, !6, i64 8, !19, i64 16, !11, i64 20, !19, i64 24, !19, i64 26, !7, i64 32}
!19 = !{!"short", !7, i64 0}
!20 = !{!15, !6, i64 24}
!21 = !{!15, !6, i64 32}
!22 = !{!15, !6, i64 40}
!23 = !{!15, !6, i64 48}
!24 = !{!25, !6, i64 56}
!25 = !{!"_IP6_INTERFACE", !11, i64 0, !13, i64 8, !12, i64 24, !13, i64 32, !11, i64 48, !7, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !13, i64 80, !13, i64 96, !11, i64 112, !13, i64 120, !13, i64 136, !13, i64 152, !7, i64 168}
!26 = !{!17, !12, i64 8}
!27 = !{!28, !6, i64 80}
!28 = !{!"", !29, 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}
!29 = !{!"", !12, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!30 = !{!12, !12, i64 0}
!31 = !{!7, !7, i64 0}
!32 = !{!18, !6, i64 0}
!33 = !{!18, !6, i64 8}
!34 = !{!18, !19, i64 16}
!35 = !{!10, !11, i64 132}
!36 = !{!18, !11, i64 20}
!37 = !{!18, !19, i64 24}
!38 = !{!11, !11, i64 0}
!39 = !{!18, !19, i64 26}


; 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"

@gBS = external local_unnamed_addr global ptr, align 8

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

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

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @Ip6CreateLinkTxToken(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %2, i64 128
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = add i32 %8, -1
  %10 = zext i32 %9 to i64
  %11 = shl nuw nsw i64 %10, 4
  %12 = add nuw nsw i64 %11, 192
  %13 = tail call ptr @AllocatePool(i64 noundef %12) #3
  %14 = icmp eq ptr %13, null
  br i1 %14, label %52, label %15

15:                                               ; preds = %5
  store i32 1412845641, ptr %13, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %13, i64 8
  %17 = tail call ptr @InitializeListHead(ptr noundef nonnull %16) #3
  %18 = getelementptr inbounds i8, ptr %13, i64 24
  store ptr %1, ptr %18, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %13, i64 32
  store ptr %3, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %13, i64 40
  store ptr %2, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %13, i64 48
  store ptr %4, ptr %21, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %13, i64 56
  %23 = tail call ptr @ZeroMem(ptr noundef nonnull %22, i64 noundef 32) #3
  %24 = getelementptr inbounds i8, ptr %13, i64 88
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  %26 = load ptr, ptr %25, align 8, !tbaa !23
  %27 = getelementptr inbounds i8, ptr %26, i64 2924
  %28 = tail call ptr @CopyMem(ptr noundef nonnull %24, ptr noundef nonnull %27, i64 noundef 32) #3
  %29 = getelementptr inbounds i8, ptr %13, i64 120
  %30 = getelementptr inbounds i8, ptr %13, i64 128
  store i64 -9223372036854775802, ptr %30, align 8, !tbaa !25
  %31 = load ptr, ptr @gBS, align 8, !tbaa !26
  %32 = getelementptr inbounds i8, ptr %31, i64 80
  %33 = load ptr, ptr %32, align 8, !tbaa !27
  %34 = tail call i64 %33(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @Ip6OnFrameSent, ptr noundef nonnull %13, ptr noundef nonnull %29) #3
  %35 = icmp slt i64 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %15
  tail call void @FreePool(ptr noundef nonnull %13) #3
  br label %52

37:                                               ; preds = %15
  %38 = getelementptr inbounds i8, ptr %13, i64 144
  %39 = getelementptr inbounds i8, ptr %13, i64 136
  store ptr %38, ptr %39, align 8, !tbaa !30
  store ptr %22, ptr %38, align 8, !tbaa !31
  %40 = getelementptr inbounds i8, ptr %13, i64 152
  store ptr %24, ptr %40, align 8, !tbaa !32
  %41 = getelementptr inbounds i8, ptr %13, i64 160
  store i16 -31011, ptr %41, align 8, !tbaa !33
  %42 = getelementptr inbounds i8, ptr %2, i64 132
  %43 = load i32, ptr %42, align 4, !tbaa !34
  %44 = getelementptr inbounds i8, ptr %13, i64 164
  store i32 %43, ptr %44, align 4, !tbaa !35
  %45 = getelementptr inbounds i8, ptr %13, i64 168
  store i16 0, ptr %45, align 8, !tbaa !36
  %46 = load i32, ptr %7, align 8, !tbaa !5
  store i32 %46, ptr %6, align 4, !tbaa !37
  %47 = getelementptr inbounds i8, ptr %13, i64 176
  %48 = call i64 @NetbufBuildExt(ptr noundef nonnull %2, ptr noundef nonnull %47, ptr noundef nonnull %6) #3
  %49 = load i32, ptr %6, align 4, !tbaa !37
  %50 = trunc i32 %49 to i16
  %51 = getelementptr inbounds i8, ptr %13, i64 170
  store i16 %50, ptr %51, align 2, !tbaa !38
  br label %52

52:                                               ; preds = %5, %37, %36
  %.0 = phi ptr [ null, %36 ], [ %13, %37 ], [ null, %5 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  ret ptr %.0
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @Ip6OnFrameSent(ptr noundef, ptr noundef) #2

declare i64 @NetbufBuildExt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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


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