; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/IntelFrameworkModulePkg (Undi16SimpleNetworkStationAddress)

; 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.PXENV_UNDI_SET_STATION_ADDR_T = type { i16, [16 x i8] }
%struct.PXENV_UNDI_CLOSE_T = type { i16 }
%struct.PXENV_UNDI_OPEN_T = type { i16, i16, i16, %struct.PXENV_UNDI_MCAST_ADDR_T }
%struct.PXENV_UNDI_MCAST_ADDR_T = type { i16, [8 x [16 x i8]] }
%struct.EFI_SIMPLE_NETWORK_DEV = type { i64, ptr, %struct._EFI_SIMPLE_NETWORK_PROTOCOL, %struct.EFI_SIMPLE_NETWORK_MODE, %struct._EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, ptr, ptr, ptr, i8, ptr, ptr, i16, i16, %struct.EFI_SIMPLE_NETWORK_DEV_FIFO, ptr, ptr, %struct.PXENV_UNDI_GET_INFORMATION_T, %struct.PXENV_UNDI_GET_NIC_TYPE_T, %struct.PXENV_UNDI_GET_NDIS_INFO_T, i8, %struct.PXENV_UNDI_ISR_T, ptr, ptr, ptr, ptr, i8, i64, i64, i64, i64, ptr, ptr, ptr, ptr }
%struct._EFI_SIMPLE_NETWORK_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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._EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL = type { i64, i64, i64, i32, [4 x i8], i8, i8, i8, i8, i16 }
%struct.EFI_SIMPLE_NETWORK_DEV_FIFO = type { i32, i32, [64 x ptr] }
%struct.PXENV_UNDI_GET_INFORMATION_T = type { i16, i16, i16, i16, i16, i16, [16 x i8], [16 x i8], i16, i16, i16 }
%struct.PXENV_UNDI_GET_NIC_TYPE_T = type <{ i16, i8, %union.PCI_PNP_INFO_T }>
%union.PCI_PNP_INFO_T = type { %struct.PCI_INFO_T }
%struct.PCI_INFO_T = type { i16, i16, i8, i8, i8, i8, i16, i16, i16 }
%struct.PXENV_UNDI_GET_NDIS_INFO_T = type <{ i16, [16 x i8], i32, i32, [4 x i32] }>
%struct.PXENV_UNDI_ISR_T = type { i16, i16, i16, i16, i16, i16, i16, i8, i8 }

@.str.29 = external hidden unnamed_addr constant [160 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [21 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 ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #1

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

16:                                               ; preds = %3
  store i64 -9223372036854775806, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

17:                                               ; preds = %3
  store i64 0, ptr %8, align 8, !tbaa !10
  %18 = call zeroext i8 @DebugAssertEnabled()
  %19 = zext i8 %18 to i32
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %31

21:                                               ; preds = %17
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = ptrtoint ptr %22 to i64
  %24 = sub i64 %23, ptrtoint (ptr getelementptr inbounds (%struct.EFI_SIMPLE_NETWORK_DEV, ptr null, i32 0, i32 2) to i64)
  %25 = inttoptr i64 %24 to ptr
  %26 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %25, i32 0, i32 0
  %27 = load i64, ptr %26, align 8, !tbaa !12
  %28 = icmp ne i64 %27, 909209203
  br i1 %28, label %29, label %31

29:                                               ; preds = %21
  call void @DebugAssert(ptr noundef @.str.29, i64 noundef 2531, ptr noundef @.str.30)
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  br label %36

31:                                               ; preds = %21, %17
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = ptrtoint ptr %32 to i64
  %34 = sub i64 %33, ptrtoint (ptr getelementptr inbounds (%struct.EFI_SIMPLE_NETWORK_DEV, ptr null, i32 0, i32 2) to i64)
  %35 = inttoptr i64 %34 to ptr
  br label %36

36:                                               ; preds = %31, %29
  %37 = phi ptr [ %30, %29 ], [ %35, %31 ]
  store ptr %37, ptr %9, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %36
  store i64 -9223372036854775801, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

41:                                               ; preds = %36
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %42, i32 0, i32 3
  %44 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !25
  switch i32 %45, label %48 [
    i32 2, label %49
    i32 0, label %46
    i32 1, label %47
  ]

46:                                               ; preds = %41
  store i64 -9223372036854775789, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

47:                                               ; preds = %41
  br label %48

48:                                               ; preds = %47, %41
  store i64 -9223372036854775801, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

49:                                               ; preds = %41
  %50 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 0
  store i16 -21555, ptr %50, align 1, !tbaa !26
  %51 = load i8, ptr %6, align 1, !tbaa !9
  %52 = icmp ne i8 %51, 0
  br i1 %52, label %53, label %86

53:                                               ; preds = %49
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %54, i32 0, i32 3
  %56 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %55, i32 0, i32 15
  %57 = load i8, ptr %56, align 1, !tbaa !28
  %58 = icmp ne i8 %57, 0
  br i1 %58, label %60, label %59

59:                                               ; preds = %53
  store i64 0, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

60:                                               ; preds = %53
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %61, i32 0, i32 3
  %63 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %62, i32 0, i32 11
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %64, i32 0, i32 3
  %66 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %65, i32 0, i32 13
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %67, i32 0, i32 3
  %69 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !29
  %71 = zext i32 %70 to i64
  %72 = call i64 @CompareMem(ptr noundef %63, ptr noundef %66, i64 noundef %71)
  %73 = icmp eq i64 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %60
  store i64 0, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

75:                                               ; preds = %60
  %76 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 1
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %77, i32 0, i32 3
  %79 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %78, i32 0, i32 13
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %80, i32 0, i32 3
  %82 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !29
  %84 = zext i32 %83 to i64
  %85 = call ptr @CopyMem(ptr noundef %76, ptr noundef %79, i64 noundef %84)
  br label %115

86:                                               ; preds = %49
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %87, i32 0, i32 3
  %89 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %88, i32 0, i32 15
  %90 = load i8, ptr %89, align 1, !tbaa !28
  %91 = icmp ne i8 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %86
  store i64 -9223372036854775806, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

93:                                               ; preds = %86
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %94, i32 0, i32 3
  %96 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %95, i32 0, i32 11
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %98, i32 0, i32 3
  %100 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %99, i32 0, i32 1
  %101 = load i32, ptr %100, align 4, !tbaa !29
  %102 = zext i32 %101 to i64
  %103 = call i64 @CompareMem(ptr noundef %96, ptr noundef %97, i64 noundef %102)
  %104 = icmp eq i64 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %93
  store i64 0, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

106:                                              ; preds = %93
  %107 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 1
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %109, i32 0, i32 3
  %111 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 4, !tbaa !29
  %113 = zext i32 %112 to i64
  %114 = call ptr @CopyMem(ptr noundef %107, ptr noundef %108, i64 noundef %113)
  br label %115

115:                                              ; preds = %106, %75
  %116 = getelementptr inbounds %struct.PXENV_UNDI_CLOSE_T, ptr %11, i32 0, i32 0
  store i16 -21555, ptr %116, align 1, !tbaa !30
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = call i64 @PxeUndiClose(ptr noundef %117, ptr noundef %11)
  %119 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 0
  store i16 0, ptr %119, align 1, !tbaa !26
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = call i64 @PxeUndiSetStationAddr(ptr noundef %120, ptr noundef %10)
  store i64 %121, ptr %8, align 8, !tbaa !10
  %122 = getelementptr inbounds %struct.PXENV_UNDI_OPEN_T, ptr %12, i32 0, i32 0
  store i16 0, ptr %122, align 1, !tbaa !32
  %123 = getelementptr inbounds %struct.PXENV_UNDI_OPEN_T, ptr %12, i32 0, i32 1
  store i16 0, ptr %123, align 1, !tbaa !34
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %124, i32 0, i32 3
  %126 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %125, i32 0, i32 7
  %127 = load i32, ptr %126, align 4, !tbaa !35
  %128 = zext i32 %127 to i64
  %129 = call zeroext i16 @Undi16GetPacketFilterSetting(i64 noundef %128)
  %130 = getelementptr inbounds %struct.PXENV_UNDI_OPEN_T, ptr %12, i32 0, i32 2
  store i16 %129, ptr %130, align 1, !tbaa !36
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %131, i32 0, i32 3
  %133 = getelementptr inbounds %struct.PXENV_UNDI_OPEN_T, ptr %12, i32 0, i32 3
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %134, i32 0, i32 3
  %136 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !29
  %138 = zext i32 %137 to i64
  call void @Undi16GetMCastFilters(ptr noundef %132, ptr noundef %133, i64 noundef %138)
  %139 = load ptr, ptr %9, align 8, !tbaa !5
  %140 = call i64 @PxeUndiOpen(ptr noundef %139, ptr noundef %12)
  %141 = load i64, ptr %8, align 8, !tbaa !10
  %142 = icmp slt i64 %141, 0
  br i1 %142, label %143, label %145

143:                                              ; preds = %115
  %144 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %144, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

145:                                              ; preds = %115
  %146 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 0
  %147 = load i16, ptr %146, align 1, !tbaa !26
  %148 = zext i16 %147 to i32
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %151

150:                                              ; preds = %145
  store i64 -9223372036854775801, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

151:                                              ; preds = %145
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %152, i32 0, i32 3
  %154 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %153, i32 0, i32 11
  %155 = getelementptr inbounds %struct.PXENV_UNDI_SET_STATION_ADDR_T, ptr %10, i32 0, i32 1
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_DEV, ptr %156, i32 0, i32 3
  %158 = getelementptr inbounds %struct.EFI_SIMPLE_NETWORK_MODE, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !29
  %160 = zext i32 %159 to i64
  %161 = call ptr @CopyMem(ptr noundef %154, ptr noundef %155, i64 noundef %160)
  %162 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %162, ptr %4, align 8
  store i32 1, ptr %13, align 4
  br label %163

163:                                              ; preds = %151, %150, %143, %105, %92, %74, %59, %48, %46, %40, %16
  call void @llvm.lifetime.end.p0(i64 136, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 18, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %164 = load i64, ptr %4, align 8
  ret i64 %164
}

declare zeroext i8 @DebugAssertEnabled() #1

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i16 @Undi16GetPacketFilterSetting(i64 noundef) #2

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

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

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

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

declare i64 @PxeUndiSetStationAddr(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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"", !11, i64 0, !6, i64 8, !14, i64 16, !15, i64 144, !18, i64 800, !6, i64 840, !6, i64 848, !6, i64 856, !7, i64 864, !6, i64 872, !6, i64 880, !19, i64 888, !19, i64 890, !20, i64 896, !6, i64 1416, !6, i64 1424, !21, i64 1432, !22, i64 1482, !23, i64 1499, !7, i64 1541, !24, i64 1542, !6, i64 1560, !6, i64 1568, !6, i64 1576, !6, i64 1584, !7, i64 1592, !11, i64 1600, !11, i64 1608, !11, i64 1616, !11, i64 1624, !6, i64 1632, !6, i64 1640, !6, i64 1648, !6, i64 1656}
!14 = !{!"_EFI_SIMPLE_NETWORK_PROTOCOL", !11, i64 0, !6, i64 8, !6, i64 16, !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}
!15 = !{!"", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !16, i64 28, !16, i64 32, !16, 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}
!16 = !{!"int", !7, i64 0}
!17 = !{!"", !7, i64 0}
!18 = !{!"_EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !16, i64 24, !7, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !19, i64 36}
!19 = !{!"short", !7, i64 0}
!20 = !{!"", !16, i64 0, !16, i64 4, !7, i64 8}
!21 = !{!"", !19, i64 0, !19, i64 2, !19, i64 4, !19, i64 6, !19, i64 8, !19, i64 10, !7, i64 12, !7, i64 28, !19, i64 44, !19, i64 46, !19, i64 48}
!22 = !{!"", !19, i64 0, !7, i64 2, !7, i64 3}
!23 = !{!"", !19, i64 0, !7, i64 2, !16, i64 18, !16, i64 22, !7, i64 26}
!24 = !{!"", !19, i64 0, !19, i64 2, !19, i64 4, !19, i64 6, !19, i64 8, !19, i64 10, !19, i64 12, !7, i64 14, !7, i64 15}
!25 = !{!13, !16, i64 144}
!26 = !{!27, !19, i64 0}
!27 = !{!"", !19, i64 0, !7, i64 2}
!28 = !{!13, !7, i64 793}
!29 = !{!13, !16, i64 148}
!30 = !{!31, !19, i64 0}
!31 = !{!"", !19, i64 0}
!32 = !{!33, !19, i64 0}
!33 = !{!"", !19, i64 0, !19, i64 2, !19, i64 4, !27, i64 6}
!34 = !{!33, !19, i64 2}
!35 = !{!13, !16, i64 172}
!36 = !{!33, !19, i64 4}


; 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.PXENV_UNDI_SET_STATION_ADDR_T = type { i16, [16 x i8] }
%struct.PXENV_UNDI_CLOSE_T = type { i16 }
%struct.PXENV_UNDI_OPEN_T = type { i16, i16, i16, %struct.PXENV_UNDI_MCAST_ADDR_T }
%struct.PXENV_UNDI_MCAST_ADDR_T = type { i16, [8 x [16 x i8]] }

@.str.29 = external hidden unnamed_addr constant [160 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [21 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 ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Undi16SimpleNetworkStationAddress(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.PXENV_UNDI_SET_STATION_ADDR_T, align 2
  %5 = alloca %struct.PXENV_UNDI_CLOSE_T, align 2
  %6 = alloca %struct.PXENV_UNDI_OPEN_T, align 2
  call void @llvm.lifetime.start.p0(i64 18, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 136, ptr nonnull %6) #3
  %7 = icmp eq ptr %0, null
  br i1 %7, label %71, label %8

8:                                                ; preds = %3
  %9 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %9, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre38 = add i64 %.pre, -16
  %.pre40 = inttoptr i64 %.pre38 to ptr
  br i1 %.not, label %._crit_edge, label %10

10:                                               ; preds = %8
  %11 = load i64, ptr %.pre40, align 8, !tbaa !5
  %.not33 = icmp eq i64 %11, 909209203
  br i1 %.not33, label %._crit_edge, label %.thread

.thread:                                          ; preds = %10
  tail call void @DebugAssert(ptr noundef nonnull @.str.29, i64 noundef 2531, ptr noundef nonnull @.str.30) #3
  br label %13

._crit_edge:                                      ; preds = %8, %10
  %12 = icmp eq i64 %.pre38, 0
  br i1 %12, label %71, label %13

13:                                               ; preds = %.thread, %._crit_edge
  %14 = phi ptr [ %0, %.thread ], [ %.pre40, %._crit_edge ]
  %15 = getelementptr inbounds i8, ptr %14, i64 144
  %16 = load i32, ptr %15, align 8, !tbaa !22
  switch i32 %16, label %17 [
    i32 2, label %18
    i32 0, label %71
  ]

17:                                               ; preds = %13
  br label %71

18:                                               ; preds = %13
  store i16 -21555, ptr %4, align 2, !tbaa !23
  %.not34 = icmp eq i8 %1, 0
  %19 = getelementptr inbounds i8, ptr %14, i64 793
  %20 = load i8, ptr %19, align 1, !tbaa !25
  %.not35 = icmp eq i8 %20, 0
  br i1 %.not34, label %35, label %21

21:                                               ; preds = %18
  br i1 %.not35, label %71, label %22

22:                                               ; preds = %21
  %23 = getelementptr inbounds i8, ptr %14, i64 696
  %24 = getelementptr inbounds i8, ptr %14, i64 760
  %25 = getelementptr inbounds i8, ptr %14, i64 148
  %26 = load i32, ptr %25, align 4, !tbaa !26
  %27 = zext i32 %26 to i64
  %28 = tail call i64 @CompareMem(ptr noundef nonnull %23, ptr noundef nonnull %24, i64 noundef %27) #3
  %29 = icmp eq i64 %28, 0
  br i1 %29, label %71, label %30

30:                                               ; preds = %22
  %31 = getelementptr inbounds i8, ptr %4, i64 2
  %32 = load i32, ptr %25, align 4, !tbaa !26
  %33 = zext i32 %32 to i64
  %34 = call ptr @CopyMem(ptr noundef nonnull %31, ptr noundef nonnull %24, i64 noundef %33) #3
  br label %48

35:                                               ; preds = %18
  br i1 %.not35, label %71, label %36

36:                                               ; preds = %35
  %37 = getelementptr inbounds i8, ptr %14, i64 696
  %38 = getelementptr inbounds i8, ptr %14, i64 148
  %39 = load i32, ptr %38, align 4, !tbaa !26
  %40 = zext i32 %39 to i64
  %41 = tail call i64 @CompareMem(ptr noundef nonnull %37, ptr noundef %2, i64 noundef %40) #3
  %42 = icmp eq i64 %41, 0
  br i1 %42, label %71, label %43

43:                                               ; preds = %36
  %44 = getelementptr inbounds i8, ptr %4, i64 2
  %45 = load i32, ptr %38, align 4, !tbaa !26
  %46 = zext i32 %45 to i64
  %47 = call ptr @CopyMem(ptr noundef nonnull %44, ptr noundef %2, i64 noundef %46) #3
  br label %48

48:                                               ; preds = %43, %30
  store i16 -21555, ptr %5, align 2, !tbaa !27
  %49 = call i64 @PxeUndiClose(ptr noundef nonnull %14, ptr noundef nonnull %5) #3
  store i16 0, ptr %4, align 2, !tbaa !23
  %50 = call i64 @PxeUndiSetStationAddr(ptr noundef nonnull %14, ptr noundef nonnull %4) #3
  store i16 0, ptr %6, align 2, !tbaa !29
  %51 = getelementptr inbounds i8, ptr %6, i64 2
  store i16 0, ptr %51, align 2, !tbaa !31
  %52 = getelementptr inbounds i8, ptr %14, i64 172
  %53 = load i32, ptr %52, align 4, !tbaa !32
  %54 = zext i32 %53 to i64
  %55 = call zeroext i16 @Undi16GetPacketFilterSetting(i64 noundef %54)
  %56 = getelementptr inbounds i8, ptr %6, i64 4
  store i16 %55, ptr %56, align 2, !tbaa !33
  %57 = getelementptr inbounds i8, ptr %6, i64 6
  %58 = getelementptr inbounds i8, ptr %14, i64 148
  %59 = load i32, ptr %58, align 4, !tbaa !26
  %60 = zext i32 %59 to i64
  call void @Undi16GetMCastFilters(ptr noundef nonnull %15, ptr noundef nonnull %57, i64 noundef %60)
  %61 = call i64 @PxeUndiOpen(ptr noundef nonnull %14, ptr noundef nonnull %6) #3
  %62 = icmp slt i64 %50, 0
  br i1 %62, label %71, label %63

63:                                               ; preds = %48
  %64 = load i16, ptr %4, align 2, !tbaa !23
  %.not37 = icmp eq i16 %64, 0
  br i1 %.not37, label %65, label %71

65:                                               ; preds = %63
  %66 = getelementptr inbounds i8, ptr %14, i64 696
  %67 = getelementptr inbounds i8, ptr %4, i64 2
  %68 = load i32, ptr %58, align 4, !tbaa !26
  %69 = zext i32 %68 to i64
  %70 = call ptr @CopyMem(ptr noundef nonnull %66, ptr noundef nonnull %67, i64 noundef %69) #3
  br label %71

71:                                               ; preds = %63, %48, %36, %35, %22, %21, %13, %._crit_edge, %3, %65, %17
  %.0 = phi i64 [ -9223372036854775801, %17 ], [ %50, %65 ], [ -9223372036854775806, %3 ], [ -9223372036854775801, %._crit_edge ], [ -9223372036854775789, %13 ], [ 0, %21 ], [ 0, %22 ], [ -9223372036854775806, %35 ], [ 0, %36 ], [ %50, %48 ], [ -9223372036854775801, %63 ]
  call void @llvm.lifetime.end.p0(i64 136, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 18, ptr nonnull %4) #3
  ret i64 %.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 zeroext i16 @Undi16GetPacketFilterSetting(i64 noundef) local_unnamed_addr #2

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

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

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

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

declare i64 @PxeUndiSetStationAddr(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 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 144, !15, i64 800, !10, i64 840, !10, i64 848, !10, i64 856, !8, i64 864, !10, i64 872, !10, i64 880, !16, i64 888, !16, i64 890, !17, i64 896, !10, i64 1416, !10, i64 1424, !18, i64 1432, !19, i64 1482, !20, i64 1499, !8, i64 1541, !21, i64 1542, !10, i64 1560, !10, i64 1568, !10, i64 1576, !10, i64 1584, !8, i64 1592, !7, i64 1600, !7, i64 1608, !7, i64 1616, !7, i64 1624, !10, i64 1632, !10, i64 1640, !10, i64 1648, !10, i64 1656}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_EFI_SIMPLE_NETWORK_PROTOCOL", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!12 = !{!"", !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, !8, i64 40, !14, i64 552, !14, i64 584, !14, i64 616, !8, i64 648, !8, i64 649, !8, i64 650, !8, i64 651, !8, i64 652}
!13 = !{!"int", !8, i64 0}
!14 = !{!"", !8, i64 0}
!15 = !{!"_EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !8, i64 28, !8, i64 32, !8, i64 33, !8, i64 34, !8, i64 35, !16, i64 36}
!16 = !{!"short", !8, i64 0}
!17 = !{!"", !13, i64 0, !13, i64 4, !8, i64 8}
!18 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8, !16, i64 10, !8, i64 12, !8, i64 28, !16, i64 44, !16, i64 46, !16, i64 48}
!19 = !{!"", !16, i64 0, !8, i64 2, !8, i64 3}
!20 = !{!"", !16, i64 0, !8, i64 2, !13, i64 18, !13, i64 22, !8, i64 26}
!21 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8, !16, i64 10, !16, i64 12, !8, i64 14, !8, i64 15}
!22 = !{!6, !13, i64 144}
!23 = !{!24, !16, i64 0}
!24 = !{!"", !16, i64 0, !8, i64 2}
!25 = !{!6, !8, i64 793}
!26 = !{!6, !13, i64 148}
!27 = !{!28, !16, i64 0}
!28 = !{!"", !16, i64 0}
!29 = !{!30, !16, i64 0}
!30 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !24, i64 6}
!31 = !{!30, !16, i64 2}
!32 = !{!6, !13, i64 172}
!33 = !{!30, !16, i64 4}


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