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

; 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._IP4_INTERFACE = type { i32, %struct._LIST_ENTRY, i64, i32, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i32, %struct._LIST_ENTRY, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.IP4_LINK_TX_TOKEN = type { i32, %struct._LIST_ENTRY, ptr, 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_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._EFI_ARP_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.IP4_ARP_QUE = type { i32, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, i32, %struct.EFI_MAC_ADDRESS }
%struct._EFI_MANAGED_NETWORK_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @Ip4WrapLinkTxToken(ptr noundef, ptr noundef, ptr noundef, ptr noundef, 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 ptr @CopyMem(ptr noundef, ptr noundef, i64 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 void @Ip4FreeLinkTxToken(ptr noundef) #0

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

declare ptr @RemoveEntryList(ptr noundef) #2

declare i32 @SwapBytes32(i32 noundef) #2

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

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

20:                                               ; preds = %6
  %21 = call zeroext i8 @DebugAssertEnabled()
  %22 = icmp ne i8 %21, 0
  br i1 %22, label %23, label %30

23:                                               ; preds = %20
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %24, i32 0, i32 7
  %26 = load i8, ptr %25, align 8, !tbaa !11
  %27 = icmp ne i8 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  call void @DebugAssert(ptr noundef @.str, i64 noundef 972, ptr noundef @.str.12)
  br label %29

29:                                               ; preds = %28, %23
  br label %30

30:                                               ; preds = %29, %20
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = call ptr @Ip4WrapLinkTxToken(ptr noundef %33, ptr noundef %34, ptr noundef %35, ptr noundef %36, ptr noundef %37)
  store ptr %38, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %32
  store i64 -9223372036854775799, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %196

42:                                               ; preds = %32
  %43 = load i32, ptr %11, align 4, !tbaa !9
  %44 = icmp eq i32 %43, -1
  br i1 %44, label %45, label %51

45:                                               ; preds = %42
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %46, i32 0, i32 7
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %48, i32 0, i32 17
  %50 = call ptr @CopyMem(ptr noundef %47, ptr noundef %49, i64 noundef 32)
  br label %169

51:                                               ; preds = %42
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = and i32 %52, -268435456
  %54 = icmp eq i32 %53, -536870912
  br i1 %54, label %55, label %67

55:                                               ; preds = %51
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %60, i32 0, i32 7
  %62 = call i64 @Ip4GetMulticastMac(ptr noundef %58, i32 noundef %59, ptr noundef %61)
  store i64 %62, ptr %18, align 8, !tbaa !17
  %63 = load i64, ptr %18, align 8, !tbaa !17
  %64 = icmp slt i64 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %55
  br label %193

66:                                               ; preds = %55
  br label %169

67:                                               ; preds = %51
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %69, i32 0, i32 11
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  store ptr %71, ptr %17, align 8, !tbaa !5
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %74

73:                                               ; preds = %68
  store i64 -9223372036854775791, ptr %18, align 8, !tbaa !17
  br label %193

74:                                               ; preds = %68
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = call i32 @SwapBytes32(i32 noundef %75)
  store i32 %76, ptr %11, align 4, !tbaa !9
  %77 = load ptr, ptr %17, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._EFI_ARP_PROTOCOL, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  %81 = load ptr, ptr %14, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %81, i32 0, i32 7
  %83 = call i64 %79(ptr noundef %80, ptr noundef %11, ptr noundef null, ptr noundef %82)
  store i64 %83, ptr %18, align 8, !tbaa !17
  %84 = load i64, ptr %18, align 8, !tbaa !17
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %74
  br label %169

87:                                               ; preds = %74
  %88 = load i64, ptr %18, align 8, !tbaa !17
  %89 = icmp ne i64 %88, -9223372036854775802
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  br label %193

91:                                               ; preds = %87
  br label %92

92:                                               ; preds = %91
  store ptr null, ptr %16, align 8, !tbaa !5
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %93, i32 0, i32 13
  %95 = getelementptr inbounds %struct._LIST_ENTRY, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !21
  store ptr %96, ptr %15, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %114, %92
  %98 = load ptr, ptr %15, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %99, i32 0, i32 13
  %101 = icmp ne ptr %98, %100
  br i1 %101, label %102, label %118

102:                                              ; preds = %97
  %103 = load ptr, ptr %15, align 8, !tbaa !5
  %104 = ptrtoint ptr %103 to i64
  %105 = sub i64 %104, ptrtoint (ptr getelementptr inbounds (%struct.IP4_ARP_QUE, ptr null, i32 0, i32 1) to i64)
  %106 = inttoptr i64 %105 to ptr
  store ptr %106, ptr %16, align 8, !tbaa !5
  %107 = load ptr, ptr %16, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %107, i32 0, i32 5
  %109 = load i32, ptr %108, align 8, !tbaa !22
  %110 = load i32, ptr %11, align 4, !tbaa !9
  %111 = icmp eq i32 %109, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %102
  br label %118

113:                                              ; preds = %102
  br label %114

114:                                              ; preds = %113
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._LIST_ENTRY, ptr %115, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !24
  store ptr %117, ptr %15, align 8, !tbaa !5
  br label %97, !llvm.loop !25

118:                                              ; preds = %112, %97
  %119 = load ptr, ptr %15, align 8, !tbaa !5
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %120, i32 0, i32 13
  %122 = icmp ne ptr %119, %121
  br i1 %122, label %123, label %129

123:                                              ; preds = %118
  %124 = load ptr, ptr %16, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %124, i32 0, i32 2
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %126, i32 0, i32 1
  %128 = call ptr @InsertTailList(ptr noundef %125, ptr noundef %127)
  store i64 0, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %196

129:                                              ; preds = %118
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = load i32, ptr %11, align 4, !tbaa !9
  %132 = call ptr @Ip4CreateArpQue(ptr noundef %130, i32 noundef %131)
  store ptr %132, ptr %16, align 8, !tbaa !5
  %133 = load ptr, ptr %16, align 8, !tbaa !5
  %134 = icmp eq ptr %133, null
  br i1 %134, label %135, label %136

135:                                              ; preds = %129
  store i64 -9223372036854775799, ptr %18, align 8, !tbaa !17
  br label %193

136:                                              ; preds = %129
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._EFI_ARP_PROTOCOL, ptr %137, i32 0, i32 5
  %139 = load ptr, ptr %138, align 8, !tbaa !19
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %141, i32 0, i32 5
  %143 = load ptr, ptr %16, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %143, i32 0, i32 4
  %145 = load ptr, ptr %144, align 8, !tbaa !27
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %146, i32 0, i32 6
  %148 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %147, i32 0, i32 0
  %149 = getelementptr inbounds [32 x i8], ptr %148, i64 0, i64 0
  %150 = call i64 %139(ptr noundef %140, ptr noundef %142, ptr noundef %145, ptr noundef %149)
  store i64 %150, ptr %18, align 8, !tbaa !17
  %151 = load i64, ptr %18, align 8, !tbaa !17
  %152 = icmp slt i64 %151, 0
  br i1 %152, label %153, label %158

153:                                              ; preds = %136
  %154 = load i64, ptr %18, align 8, !tbaa !17
  %155 = icmp ne i64 %154, -9223372036854775802
  br i1 %155, label %156, label %158

156:                                              ; preds = %153
  %157 = load ptr, ptr %16, align 8, !tbaa !5
  call void @Ip4FreeArpQue(ptr noundef %157, i64 noundef -9223372036854775791)
  br label %193

158:                                              ; preds = %153, %136
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %159, i32 0, i32 2
  %161 = load ptr, ptr %14, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %161, i32 0, i32 1
  %163 = call ptr @InsertHeadList(ptr noundef %160, ptr noundef %162)
  %164 = load ptr, ptr %8, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %164, i32 0, i32 13
  %166 = load ptr, ptr %16, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.IP4_ARP_QUE, ptr %166, i32 0, i32 1
  %168 = call ptr @InsertHeadList(ptr noundef %165, ptr noundef %167)
  store i64 0, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %196

169:                                              ; preds = %86, %66, %45
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %170, i32 0, i32 14
  %172 = load ptr, ptr %14, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %172, i32 0, i32 1
  %174 = call ptr @InsertTailList(ptr noundef %171, ptr noundef %173)
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %175, i32 0, i32 10
  %177 = load ptr, ptr %176, align 8, !tbaa !16
  %178 = getelementptr inbounds %struct._EFI_MANAGED_NETWORK_PROTOCOL, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !28
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %180, i32 0, i32 10
  %182 = load ptr, ptr %181, align 8, !tbaa !16
  %183 = load ptr, ptr %14, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.IP4_LINK_TX_TOKEN, ptr %183, i32 0, i32 9
  %185 = call i64 %179(ptr noundef %182, ptr noundef %184)
  store i64 %185, ptr %18, align 8, !tbaa !17
  %186 = load i64, ptr %18, align 8, !tbaa !17
  %187 = icmp slt i64 %186, 0
  br i1 %187, label %188, label %192

188:                                              ; preds = %169
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct._IP4_INTERFACE, ptr %189, i32 0, i32 14
  %191 = call ptr @RemoveEntryList(ptr noundef %190)
  br label %193

192:                                              ; preds = %169
  store i64 0, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %196

193:                                              ; preds = %188, %156, %135, %90, %73, %65
  %194 = load ptr, ptr %14, align 8, !tbaa !5
  call void @Ip4FreeLinkTxToken(ptr noundef %194)
  %195 = load i64, ptr %18, align 8, !tbaa !17
  store i64 %195, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %196

196:                                              ; preds = %193, %192, %158, %123, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, 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
  %197 = load i64, ptr %7, align 8
  ret i64 %197
}

declare i64 @Ip4GetMulticastMac(ptr noundef, i32 noundef, ptr noundef) #2

declare ptr @InsertHeadList(ptr 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 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 48}
!12 = !{!"_IP4_INTERFACE", !10, i64 0, !13, i64 8, !14, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !7, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !13, i64 96, !13, i64 112, !6, i64 128, !15, i64 136, !15, i64 168, !10, i64 200, !13, i64 208, !7, i64 224}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"", !7, i64 0}
!16 = !{!12, !6, i64 72}
!17 = !{!14, !14, i64 0}
!18 = !{!12, !6, i64 80}
!19 = !{!20, !6, i64 40}
!20 = !{!"_EFI_ARP_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!21 = !{!12, !6, i64 96}
!22 = !{!23, !10, i64 56}
!23 = !{!"", !10, i64 0, !13, i64 8, !13, i64 24, !6, i64 40, !6, i64 48, !10, i64 56, !15, i64 60}
!24 = !{!13, !6, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!23, !6, i64 48}
!28 = !{!29, !6, i64 32}
!29 = !{!"_EFI_MANAGED_NETWORK_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}


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

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1

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

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

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

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #1

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip4SendFrame(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = alloca i32, align 4
  store i32 %3, ptr %7, align 4, !tbaa !5
  %8 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %8, 0
  br i1 %.not, label %13, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load i8, ptr %10, align 8, !tbaa !9
  %.not64 = icmp eq i8 %11, 0
  br i1 %.not64, label %12, label %13

12:                                               ; preds = %9
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 972, ptr noundef nonnull @.str.12) #2
  br label %13

13:                                               ; preds = %9, %12, %6
  %14 = tail call ptr @Ip4WrapLinkTxToken(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %4, ptr noundef %5)
  %15 = icmp eq ptr %14, null
  br i1 %15, label %89, label %16

16:                                               ; preds = %13
  %17 = icmp eq i32 %3, -1
  br i1 %17, label %18, label %22

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %14, i64 64
  %20 = getelementptr inbounds i8, ptr %0, i64 168
  %21 = tail call ptr @CopyMem(ptr noundef nonnull %19, ptr noundef nonnull %20, i64 noundef 32) #2
  br label %75

22:                                               ; preds = %16
  %23 = and i32 %3, -268435456
  %24 = icmp eq i32 %23, -536870912
  br i1 %24, label %25, label %31

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %0, i64 72
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %14, i64 64
  %29 = tail call i64 @Ip4GetMulticastMac(ptr noundef %27, i32 noundef %3, ptr noundef nonnull %28) #2
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %88, label %75

31:                                               ; preds = %22
  %32 = getelementptr inbounds i8, ptr %0, i64 80
  %33 = load ptr, ptr %32, align 8, !tbaa !16
  %34 = icmp eq ptr %33, null
  br i1 %34, label %88, label %35

35:                                               ; preds = %31
  %36 = tail call i32 @SwapBytes32(i32 noundef %3) #2
  store i32 %36, ptr %7, align 4, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %33, i64 40
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %14, i64 64
  %40 = call i64 %38(ptr noundef nonnull %33, ptr noundef nonnull %7, ptr noundef null, ptr noundef nonnull %39) #2
  switch i64 %40, label %88 [
    i64 0, label %75
    i64 -9223372036854775802, label %41
  ]

41:                                               ; preds = %35
  %42 = getelementptr inbounds i8, ptr %0, i64 96
  %43 = load i32, ptr %7, align 4
  br label %44

44:                                               ; preds = %45, %41
  %.054.in = phi ptr [ %42, %41 ], [ %.054, %45 ]
  %.054 = load ptr, ptr %.054.in, align 8, !tbaa !19
  %.not66 = icmp eq ptr %.054, %42
  br i1 %.not66, label %56, label %45

45:                                               ; preds = %44
  %46 = ptrtoint ptr %.054 to i64
  %47 = add i64 %46, -8
  %48 = inttoptr i64 %47 to ptr
  %49 = getelementptr inbounds i8, ptr %48, i64 56
  %50 = load i32, ptr %49, align 8, !tbaa !20
  %51 = icmp eq i32 %50, %43
  br i1 %51, label %52, label %44, !llvm.loop !22

52:                                               ; preds = %45
  %53 = getelementptr inbounds i8, ptr %48, i64 24
  %54 = getelementptr inbounds i8, ptr %14, i64 8
  %55 = call ptr @InsertTailList(ptr noundef nonnull %53, ptr noundef nonnull %54) #2
  br label %89

56:                                               ; preds = %44
  %57 = call ptr @Ip4CreateArpQue(ptr noundef %0, i32 noundef %43)
  %58 = icmp eq ptr %57, null
  br i1 %58, label %88, label %59

59:                                               ; preds = %56
  %60 = load ptr, ptr %37, align 8, !tbaa !17
  %61 = getelementptr inbounds i8, ptr %57, i64 56
  %62 = getelementptr inbounds i8, ptr %57, i64 48
  %63 = load ptr, ptr %62, align 8, !tbaa !24
  %64 = getelementptr inbounds i8, ptr %57, i64 60
  %65 = call i64 %60(ptr noundef nonnull %33, ptr noundef nonnull %61, ptr noundef %63, ptr noundef nonnull %64) #2
  %66 = icmp slt i64 %65, 0
  %67 = icmp ne i64 %65, -9223372036854775802
  %or.cond = and i1 %66, %67
  br i1 %or.cond, label %68, label %69

68:                                               ; preds = %59
  call void @Ip4FreeArpQue(ptr noundef nonnull %57, i64 noundef -9223372036854775791)
  br label %88

69:                                               ; preds = %59
  %70 = getelementptr inbounds i8, ptr %57, i64 24
  %71 = getelementptr inbounds i8, ptr %14, i64 8
  %72 = call ptr @InsertHeadList(ptr noundef nonnull %70, ptr noundef nonnull %71) #2
  %73 = getelementptr inbounds i8, ptr %57, i64 8
  %74 = call ptr @InsertHeadList(ptr noundef nonnull %42, ptr noundef nonnull %73) #2
  br label %89

75:                                               ; preds = %35, %25, %18
  %76 = getelementptr inbounds i8, ptr %0, i64 112
  %77 = getelementptr inbounds i8, ptr %14, i64 8
  %78 = call ptr @InsertTailList(ptr noundef nonnull %76, ptr noundef nonnull %77) #2
  %79 = getelementptr inbounds i8, ptr %0, i64 72
  %80 = load ptr, ptr %79, align 8, !tbaa !15
  %81 = getelementptr inbounds i8, ptr %80, i64 32
  %82 = load ptr, ptr %81, align 8, !tbaa !25
  %83 = getelementptr inbounds i8, ptr %14, i64 128
  %84 = call i64 %82(ptr noundef %80, ptr noundef nonnull %83) #2
  %85 = icmp slt i64 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %75
  %87 = call ptr @RemoveEntryList(ptr noundef nonnull %76) #2
  br label %88

88:                                               ; preds = %56, %35, %31, %25, %86, %68
  %.0 = phi i64 [ %84, %86 ], [ %29, %25 ], [ %65, %68 ], [ -9223372036854775791, %31 ], [ %40, %35 ], [ -9223372036854775799, %56 ]
  call void @Ip4FreeLinkTxToken(ptr noundef nonnull %14)
  br label %89

89:                                               ; preds = %75, %13, %88, %69, %52
  %.052 = phi i64 [ %.0, %88 ], [ 0, %52 ], [ 0, %69 ], [ -9223372036854775799, %13 ], [ 0, %75 ]
  ret i64 %.052
}

declare i64 @Ip4GetMulticastMac(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @InsertHeadList(ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { "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 }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 48}
!10 = !{!"_IP4_INTERFACE", !6, i64 0, !11, i64 8, !13, i64 24, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !7, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !11, i64 96, !11, i64 112, !12, i64 128, !14, i64 136, !14, i64 168, !6, i64 200, !11, i64 208, !7, i64 224}
!11 = !{!"_LIST_ENTRY", !12, i64 0, !12, i64 8}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"", !7, i64 0}
!15 = !{!10, !12, i64 72}
!16 = !{!10, !12, i64 80}
!17 = !{!18, !12, i64 40}
!18 = !{!"_EFI_ARP_PROTOCOL", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48}
!19 = !{!11, !12, i64 0}
!20 = !{!21, !6, i64 56}
!21 = !{!"", !6, i64 0, !11, i64 8, !11, i64 24, !12, i64 40, !12, i64 48, !6, i64 56, !14, i64 60}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!21, !12, i64 48}
!25 = !{!26, !12, i64 32}
!26 = !{!"_EFI_MANAGED_NETWORK_PROTOCOL", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass