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

; 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_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }
%struct.EFI_IPv6_ADDRESS = type { [16 x 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.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._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 }
%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] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct.IP6_CLIP_INFO = type { i32, i32, i32, i32, i32, i32, i64, i32, i16, i8, i8, i32 }

@.str = external hidden unnamed_addr constant [130 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [107 x i8], align 1

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

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

declare void @NetbufFree(ptr noundef) #1

declare void @FreePool(ptr noundef) #1

declare zeroext i8 @DebugAssertEnabled() #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Ip6IpSecProcessPacket(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Ip6PreProcessPacket(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @Ip6AcceptFrame(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i64, align 8
  %17 = alloca %struct._EFI_IP6_HEADER, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !5
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 40, ptr %17) #3
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %18, ptr %9, align 8, !tbaa !5
  br label %19

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

22:                                               ; preds = %19
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._IP6_SERVICE, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !13
  %29 = icmp eq i32 %28, 1396068425
  br i1 %29, label %31, label %30

30:                                               ; preds = %25, %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1005, ptr noundef @.str.7)
  br label %31

31:                                               ; preds = %30, %25
  br label %32

32:                                               ; preds = %31, %19
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  store ptr null, ptr %11, align 8, !tbaa !5
  store ptr null, ptr %12, align 8, !tbaa !5
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = icmp slt i64 %35, 0
  br i1 %36, label %42, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._IP6_SERVICE, ptr %38, i32 0, i32 2
  %40 = load i64, ptr %39, align 8, !tbaa !32
  %41 = icmp eq i64 %40, 3
  br i1 %41, label %42, label %43

42:                                               ; preds = %37, %34
  br label %105

43:                                               ; preds = %37
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load i32, ptr %7, align 4, !tbaa !11
  %46 = call i64 @Ip6PreProcessPacket(ptr noundef %44, ptr noundef %5, i32 noundef %45, ptr noundef %11, ptr noundef %12, ptr noundef %14, ptr noundef %13, ptr noundef %15, ptr noundef %10)
  store i64 %46, ptr %16, align 8, !tbaa !9
  %47 = load i64, ptr %16, align 8, !tbaa !9
  %48 = icmp slt i64 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %43
  br label %97

50:                                               ; preds = %43
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = call i64 @Ip6IpSecProcessPacket(ptr noundef %51, ptr noundef %10, ptr noundef %52, ptr noundef %5, ptr noundef %11, ptr noundef %14, i32 noundef 0, ptr noundef null)
  store i64 %53, ptr %16, align 8, !tbaa !9
  %54 = load i64, ptr %16, align 8, !tbaa !9
  %55 = icmp slt i64 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %50
  br label %97

57:                                               ; preds = %50
  %58 = call ptr @ZeroMem(ptr noundef %17, i64 noundef 40)
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = call i64 @CompareMem(ptr noundef %59, ptr noundef %17, i64 noundef 40)
  %61 = icmp eq i64 0, %60
  br i1 %61, label %62, label %70

62:                                               ; preds = %57
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load i32, ptr %7, align 4, !tbaa !11
  %65 = call i64 @Ip6PreProcessPacket(ptr noundef %63, ptr noundef %5, i32 noundef %64, ptr noundef %11, ptr noundef %12, ptr noundef %14, ptr noundef %13, ptr noundef %15, ptr noundef %10)
  store i64 %65, ptr %16, align 8, !tbaa !9
  %66 = load i64, ptr %16, align 8, !tbaa !9
  %67 = icmp slt i64 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %62
  br label %97

69:                                               ; preds = %62
  br label %70

70:                                               ; preds = %69, %57
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  br label %97

74:                                               ; preds = %70
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.NET_BUF, ptr %75, i32 0, i32 3
  %77 = load ptr, ptr %76, align 8, !tbaa !33
  store ptr %77, ptr %10, align 8, !tbaa !5
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.NET_BUF, ptr %78, i32 0, i32 6
  %80 = getelementptr inbounds [64 x i8], ptr %79, i64 0, i64 0
  %81 = getelementptr inbounds %struct.IP6_CLIP_INFO, ptr %80, i32 0, i32 6
  store i64 0, ptr %81, align 8, !tbaa !34
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load i8, ptr %82, align 1, !tbaa !33
  %84 = zext i8 %83 to i32
  switch i32 %84, label %90 [
    i32 58, label %85
  ]

85:                                               ; preds = %74
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = call i64 @Ip6IcmpHandle(ptr noundef %86, ptr noundef %87, ptr noundef %88)
  br label %95

90:                                               ; preds = %74
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = call i64 @Ip6Demultiplex(ptr noundef %91, ptr noundef %92, ptr noundef %93)
  br label %95

95:                                               ; preds = %90, %85
  store ptr null, ptr %5, align 8, !tbaa !5
  %96 = call i64 @DispatchDpc()
  br label %97

97:                                               ; preds = %95, %73, %68, %56, %49
  %98 = load ptr, ptr %11, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %102

100:                                              ; preds = %97
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %101)
  br label %102

102:                                              ; preds = %100, %97
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = call i64 @Ip6ReceiveFrame(ptr noundef @Ip6AcceptFrame, ptr noundef %103)
  br label %105

105:                                              ; preds = %102, %42
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = icmp ne ptr %106, null
  br i1 %107, label %108, label %110

108:                                              ; preds = %105
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %109)
  br label %110

110:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 40, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

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

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

declare i64 @DispatchDpc() #1

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


; 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_IP6_HEADER = type { i16, i16, i16, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }

@.str = external hidden unnamed_addr constant [130 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [107 x i8], align 1

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

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

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Ip6IpSecProcessPacket(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Ip6PreProcessPacket(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @Ip6AcceptFrame(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca %struct._EFI_IP6_HEADER, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %12) #3
  %13 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %13, 0
  br i1 %.not, label %19, label %14

14:                                               ; preds = %4
  %.not18 = icmp eq ptr %3, null
  br i1 %.not18, label %18, label %15

15:                                               ; preds = %14
  %16 = load i32, ptr %3, align 8, !tbaa !9
  %17 = icmp eq i32 %16, 1396068425
  br i1 %17, label %19, label %18

18:                                               ; preds = %15, %14
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1005, ptr noundef nonnull @.str.7) #3
  br label %19

19:                                               ; preds = %15, %18, %4
  store ptr null, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %8, align 8, !tbaa !5
  %20 = icmp slt i64 %1, 0
  br i1 %20, label %61, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %3, i64 24
  %23 = load i64, ptr %22, align 8, !tbaa !30
  %24 = icmp eq i64 %23, 3
  br i1 %24, label %61, label %25

25:                                               ; preds = %21
  %26 = call i64 @Ip6PreProcessPacket(ptr noundef nonnull %3, ptr noundef nonnull %5, i32 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %10, ptr noundef nonnull %9, ptr noundef nonnull %11, ptr noundef nonnull %6)
  %27 = icmp slt i64 %26, 0
  br i1 %27, label %56, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = call i64 @Ip6IpSecProcessPacket(ptr noundef nonnull %3, ptr noundef nonnull %6, ptr noundef %29, ptr noundef nonnull %5, ptr noundef nonnull %7, ptr noundef nonnull %10, i32 noundef 0, ptr noundef null)
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %56, label %32

32:                                               ; preds = %28
  %33 = call ptr @ZeroMem(ptr noundef nonnull %12, i64 noundef 40) #3
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call i64 @CompareMem(ptr noundef %34, ptr noundef nonnull %12, i64 noundef 40) #3
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %37, label %42

37:                                               ; preds = %32
  %38 = call i64 @Ip6PreProcessPacket(ptr noundef nonnull %3, ptr noundef nonnull %5, i32 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %10, ptr noundef nonnull %9, ptr noundef nonnull %11, ptr noundef nonnull %6)
  %39 = icmp slt i64 %38, 0
  %40 = load ptr, ptr %5, align 8
  %41 = icmp eq ptr %40, null
  %or.cond = select i1 %39, i1 true, i1 %41
  br i1 %or.cond, label %56, label %43

42:                                               ; preds = %32
  %.old = load ptr, ptr %5, align 8, !tbaa !5
  %.old1 = icmp eq ptr %.old, null
  br i1 %.old1, label %56, label %43

43:                                               ; preds = %37, %42
  %44 = phi ptr [ %40, %37 ], [ %.old, %42 ]
  %45 = getelementptr inbounds i8, ptr %44, i64 32
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  store ptr %46, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %44, i64 80
  store i64 0, ptr %47, align 8, !tbaa !32
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = load i8, ptr %48, align 1, !tbaa !31
  %cond = icmp eq i8 %49, 58
  br i1 %cond, label %50, label %52

50:                                               ; preds = %43
  %51 = call i64 @Ip6IcmpHandle(ptr noundef nonnull %3, ptr noundef %46, ptr noundef nonnull %44) #3
  br label %54

52:                                               ; preds = %43
  %53 = call i64 @Ip6Demultiplex(ptr noundef nonnull %3, ptr noundef %46, ptr noundef nonnull %44)
  br label %54

54:                                               ; preds = %52, %50
  store ptr null, ptr %5, align 8, !tbaa !5
  %55 = call i64 @DispatchDpc() #3
  br label %56

56:                                               ; preds = %42, %37, %28, %25, %54
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %.not19 = icmp eq ptr %57, null
  br i1 %.not19, label %59, label %58

58:                                               ; preds = %56
  call void @FreePool(ptr noundef nonnull %57) #3
  br label %59

59:                                               ; preds = %58, %56
  %60 = call i64 @Ip6ReceiveFrame(ptr noundef nonnull @Ip6AcceptFrame, ptr noundef nonnull %3) #3
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %19, %21, %59
  %62 = phi ptr [ %0, %19 ], [ %0, %21 ], [ %.pre, %59 ]
  %.not20 = icmp eq ptr %62, null
  br i1 %.not20, label %64, label %63

63:                                               ; preds = %61
  call void @NetbufFree(ptr noundef nonnull %62) #3
  br label %64

64:                                               ; preds = %63, %61
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  ret void
}

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

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

declare i64 @DispatchDpc() local_unnamed_addr #1

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


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