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

; 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._PXEBC_PRIVATE_DATA = type { i32, ptr, ptr, %struct._PXEBC_PRIVATE_PROTOCOL, 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_PXE_BASE_CODE_PROTOCOL, %struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL, ptr, ptr, %struct.EFI_PXE_BASE_CODE_MODE, i32, i32, i32, i64, %struct.EFI_UDP4_CONFIG_DATA, %struct.EFI_UDP6_CONFIG_DATA, %struct.EFI_IP4_CONFIG_DATA, %struct.EFI_IP6_CONFIG_DATA, ptr, ptr, %struct.EFI_IP4_COMPLETION_TOKEN, %struct.EFI_IP6_COMPLETION_TOKEN, i8, i8, i8, i8, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, i16, i32, i32, i32, ptr, i64, i64, %union.PXEBC_DHCP_PACKET_CACHE, %union.PXEBC_DHCP_PACKET_CACHE, %union.PXEBC_DHCP_PACKET_CACHE, ptr, %struct.EFI_DHCP4_PACKET, i32, i32, [16 x %union.PXEBC_DHCP_PACKET_CACHE], i32, [8 x i32], [8 x [16 x i32]] }
%struct._PXEBC_PRIVATE_PROTOCOL = type { i64 }
%struct._EFI_PXE_BASE_CODE_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL = type { i64, ptr }
%struct.EFI_PXE_BASE_CODE_MODE = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %union.EFI_PXE_BASE_CODE_PACKET, %struct.EFI_PXE_BASE_CODE_IP_FILTER, i32, [8 x %struct.EFI_PXE_BASE_CODE_ARP_ENTRY], i32, [8 x %struct.EFI_PXE_BASE_CODE_ROUTE_ENTRY], %struct.EFI_PXE_BASE_CODE_ICMP_ERROR, %struct.EFI_PXE_BASE_CODE_TFTP_ERROR }
%union.EFI_PXE_BASE_CODE_PACKET = type { %struct.EFI_PXE_BASE_CODE_DHCPV6_PACKET, [444 x i8] }
%struct.EFI_PXE_BASE_CODE_DHCPV6_PACKET = type { i32, [1024 x i8] }
%struct.EFI_PXE_BASE_CODE_IP_FILTER = type { i8, i8, i16, [8 x %union.EFI_IP_ADDRESS] }
%struct.EFI_PXE_BASE_CODE_ARP_ENTRY = type { %union.EFI_IP_ADDRESS, %struct.EFI_MAC_ADDRESS }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_PXE_BASE_CODE_ROUTE_ENTRY = type { %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS }
%struct.EFI_PXE_BASE_CODE_ICMP_ERROR = type { i8, i8, i16, %union.anon, [494 x i8] }
%union.anon = type { i32 }
%struct.EFI_PXE_BASE_CODE_TFTP_ERROR = type { i8, [127 x i8] }
%struct.EFI_UDP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.EFI_UDP6_CONFIG_DATA = type { i8, i8, i8, i8, i8, i32, i32, %struct.EFI_IPv6_ADDRESS, i16, %struct.EFI_IPv6_ADDRESS, i16 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_IP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, i8, i8, i8, i32, i32 }
%struct.EFI_IP6_CONFIG_DATA = type { i8, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32, i32 }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon.0 }
%union.anon.0 = type { ptr }
%struct.EFI_IP6_COMPLETION_TOKEN = type { ptr, i64, %union.anon.1 }
%union.anon.1 = type { ptr }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.PXEBC_DHCP_PACKET_CACHE = type { %struct.PXEBC_DHCP4_PACKET_CACHE }
%struct.PXEBC_DHCP4_PACKET_CACHE = type { %union.PXEBC_DHCP4_PACKET, i32, [7 x ptr], %struct.PXEBC_VENDOR_OPTION }
%union.PXEBC_DHCP4_PACKET = type { [1472 x i8] }
%struct.PXEBC_VENDOR_OPTION = type { [8 x i32], %struct.EFI_IPv4_ADDRESS, i16, i16, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16, i16, ptr, i8, ptr, i8, ptr, i8, ptr, i8 }
%struct.EFI_DHCP4_PACKET = type <{ i32, i32, %struct.anon.2 }>
%struct.anon.2 = type <{ %struct.EFI_DHCP4_HEADER, i32, [1 x i8] }>
%struct.EFI_DHCP4_HEADER = type { i8, i8, i8, i8, i32, i16, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, [16 x i8], [64 x i8], [128 x i8] }
%struct.PXEBC_DHCP6_PACKET_CACHE = type { %union.PXEBC_DHCP6_PACKET, i32, [4 x ptr] }
%union.PXEBC_DHCP6_PACKET = type { [1472 x i8] }
%struct.EFI_DHCP6_PACKET = type <{ i32, i32, %struct.anon.3 }>
%struct.anon.3 = type <{ %struct.EFI_DHCP6_HEADER, [1 x i8] }>
%struct.EFI_DHCP6_HEADER = type { i32 }

; 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

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcSelectBootPrompt(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcSelectBootMenu(ptr noundef, ptr noundef, i8 noundef zeroext) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @PxeBcDiscoverBootFile(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %13, i32 0, i32 31
  store ptr %14, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._EFI_PXE_BASE_CODE_PROTOCOL, ptr %15, i32 0, i32 13
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr %7, align 8, !tbaa !5
  store i16 0, ptr %9, align 2, !tbaa !12
  store i16 0, ptr %10, align 2, !tbaa !12
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._EFI_PXE_BASE_CODE_PROTOCOL, ptr %18, i32 0, i32 3
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call i64 %20(ptr noundef %21, i8 noundef zeroext 1)
  store i64 %22, ptr %8, align 8, !tbaa !15
  %23 = load i64, ptr %8, align 8, !tbaa !15
  %24 = icmp slt i64 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %2
  %26 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %26, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %136

27:                                               ; preds = %2
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = call i64 @PxeBcSelectBootPrompt(ptr noundef %28)
  store i64 %29, ptr %8, align 8, !tbaa !15
  %30 = load i64, ptr %8, align 8, !tbaa !15
  %31 = icmp eq i64 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %27
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = call i64 @PxeBcSelectBootMenu(ptr noundef %33, ptr noundef %9, i8 noundef zeroext 0)
  store i64 %34, ptr %8, align 8, !tbaa !15
  br label %42

35:                                               ; preds = %27
  %36 = load i64, ptr %8, align 8, !tbaa !15
  %37 = icmp eq i64 %36, -9223372036854775790
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = call i64 @PxeBcSelectBootMenu(ptr noundef %39, ptr noundef %9, i8 noundef zeroext 1)
  store i64 %40, ptr %8, align 8, !tbaa !15
  br label %41

41:                                               ; preds = %38, %35
  br label %42

42:                                               ; preds = %41, %32
  %43 = load i64, ptr %8, align 8, !tbaa !15
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %121, label %45

45:                                               ; preds = %42
  %46 = load i16, ptr %9, align 2, !tbaa !12
  %47 = zext i16 %46 to i32
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  store i64 -9223372036854775787, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %136

50:                                               ; preds = %45
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %51, i32 0, i32 4
  %53 = load i8, ptr %52, align 4, !tbaa !16
  %54 = zext i8 %53 to i32
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %62

56:                                               ; preds = %50
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %57, i32 0, i32 5
  %59 = load i8, ptr %58, align 1, !tbaa !22
  %60 = zext i8 %59 to i32
  %61 = icmp ne i32 %60, 0
  br label %62

62:                                               ; preds = %56, %50
  %63 = phi i1 [ false, %50 ], [ %61, %56 ]
  %64 = zext i1 %63 to i32
  %65 = trunc i32 %64 to i8
  store i8 %65, ptr %11, align 1, !tbaa !23
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._EFI_PXE_BASE_CODE_PROTOCOL, ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !24
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load i16, ptr %9, align 2, !tbaa !12
  %71 = load i8, ptr %11, align 1, !tbaa !23
  %72 = call i64 %68(ptr noundef %69, i16 noundef zeroext %70, ptr noundef %10, i8 noundef zeroext %71, ptr noundef null)
  store i64 %72, ptr %8, align 8, !tbaa !15
  %73 = load i64, ptr %8, align 8, !tbaa !15
  %74 = icmp slt i64 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %62
  %76 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %76, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %136

77:                                               ; preds = %62
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %78, i32 0, i32 12
  %80 = load i8, ptr %79, align 4, !tbaa !25
  %81 = zext i8 %80 to i32
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %120

83:                                               ; preds = %77
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %84, i32 0, i32 10
  %86 = load i8, ptr %85, align 2, !tbaa !26
  %87 = icmp ne i8 %86, 0
  br i1 %87, label %120, label %88

88:                                               ; preds = %83
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %89, i32 0, i32 3
  %91 = load i8, ptr %90, align 1, !tbaa !27
  %92 = icmp ne i8 %91, 0
  br i1 %92, label %93, label %105

93:                                               ; preds = %88
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %94, i32 0, i32 23
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %96, i32 0, i32 25
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %98, i32 0, i32 65
  %100 = getelementptr inbounds %struct.PXEBC_DHCP6_PACKET_CACHE, ptr %99, i32 0, i32 0
  %101 = getelementptr inbounds %struct.EFI_DHCP6_PACKET, ptr %100, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !23
  %103 = zext i32 %102 to i64
  %104 = call ptr @CopyMem(ptr noundef %95, ptr noundef %97, i64 noundef %103)
  br label %117

105:                                              ; preds = %88
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %106, i32 0, i32 23
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %108, i32 0, i32 25
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %110, i32 0, i32 65
  %112 = getelementptr inbounds %struct.PXEBC_DHCP4_PACKET_CACHE, ptr %111, i32 0, i32 0
  %113 = getelementptr inbounds %struct.EFI_DHCP4_PACKET, ptr %112, i32 0, i32 1
  %114 = load i32, ptr %113, align 4, !tbaa !23
  %115 = zext i32 %114 to i64
  %116 = call ptr @CopyMem(ptr noundef %107, ptr noundef %109, i64 noundef %115)
  br label %117

117:                                              ; preds = %105, %93
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %118, i32 0, i32 10
  store i8 1, ptr %119, align 2, !tbaa !26
  br label %120

120:                                              ; preds = %117, %83, %77
  br label %121

121:                                              ; preds = %120, %42
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.EFI_PXE_BASE_CODE_MODE, ptr %122, i32 0, i32 3
  %124 = load i8, ptr %123, align 1, !tbaa !27
  %125 = icmp ne i8 %124, 0
  br i1 %125, label %126, label %130

126:                                              ; preds = %121
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = call i64 @PxeBcDhcp6BootInfo(ptr noundef %127, ptr noundef %128)
  store i64 %129, ptr %8, align 8, !tbaa !15
  br label %134

130:                                              ; preds = %121
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = call i64 @PxeBcDhcp4BootInfo(ptr noundef %131, ptr noundef %132)
  store i64 %133, ptr %8, align 8, !tbaa !15
  br label %134

134:                                              ; preds = %130, %126
  %135 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %135, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %136

136:                                              ; preds = %134, %75, %49, %25
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %137 = load i64, ptr %3, align 8
  ret i64 %137
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 104}
!10 = !{!"_EFI_PXE_BASE_CODE_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}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !7, i64 4}
!17 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 20, !7, i64 36, !7, i64 52, !7, i64 1524, !7, i64 2996, !7, i64 4468, !7, i64 5940, !7, i64 7412, !18, i64 8884, !19, i64 9016, !7, i64 9020, !19, i64 9404, !7, i64 9408, !20, i64 9792, !21, i64 10296}
!18 = !{!"", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4}
!19 = !{!"int", !7, i64 0}
!20 = !{!"", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4, !7, i64 8}
!21 = !{!"", !7, i64 0, !7, i64 1}
!22 = !{!17, !7, i64 5}
!23 = !{!7, !7, i64 0}
!24 = !{!10, !6, i64 32}
!25 = !{!17, !7, i64 12}
!26 = !{!17, !7, i64 10}
!27 = !{!17, !7, i64 3}


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

; 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

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcSelectBootPrompt(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcSelectBootMenu(ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @PxeBcDiscoverBootFile(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca i16, align 2
  %4 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 248
  %6 = getelementptr inbounds i8, ptr %0, i64 352
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  store i16 0, ptr %3, align 2, !tbaa !11
  store i16 0, ptr %4, align 2, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 272
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = tail call i64 %9(ptr noundef nonnull %5, i8 noundef zeroext 1) #3
  %11 = icmp slt i64 %10, 0
  br i1 %11, label %55, label %12

12:                                               ; preds = %2
  %13 = tail call i64 @PxeBcSelectBootPrompt(ptr noundef nonnull %0)
  switch i64 %13, label %16 [
    i64 0, label %.sink.split
    i64 -9223372036854775790, label %14
  ]

14:                                               ; preds = %12
  br label %.sink.split

.sink.split:                                      ; preds = %12, %14
  %.sink = phi i8 [ 1, %14 ], [ 0, %12 ]
  %15 = call i64 @PxeBcSelectBootMenu(ptr noundef nonnull %0, ptr noundef nonnull %3, i8 noundef zeroext %.sink)
  br label %16

16:                                               ; preds = %.sink.split, %12
  %.035 = phi i64 [ %13, %12 ], [ %15, %.sink.split ]
  %17 = icmp slt i64 %.035, 0
  br i1 %17, label %48, label %18

18:                                               ; preds = %16
  %19 = load i16, ptr %3, align 2, !tbaa !11
  %20 = icmp eq i16 %19, 0
  br i1 %20, label %55, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %7, i64 4
  %23 = load i8, ptr %22, align 4, !tbaa !14
  %.not = icmp eq i8 %23, 0
  br i1 %.not, label %29, label %24

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %7, i64 5
  %26 = load i8, ptr %25, align 1, !tbaa !20
  %27 = icmp ne i8 %26, 0
  %28 = zext i1 %27 to i8
  br label %29

29:                                               ; preds = %24, %21
  %30 = phi i8 [ 0, %21 ], [ %28, %24 ]
  %31 = getelementptr inbounds i8, ptr %0, i64 280
  %32 = load ptr, ptr %31, align 8, !tbaa !21
  %33 = call i64 %32(ptr noundef nonnull %5, i16 noundef zeroext %19, ptr noundef nonnull %4, i8 noundef zeroext %30, ptr noundef null) #3
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %55, label %35

35:                                               ; preds = %29
  %36 = getelementptr inbounds i8, ptr %7, i64 12
  %37 = load i8, ptr %36, align 4, !tbaa !22
  %.not39 = icmp eq i8 %37, 0
  br i1 %.not39, label %48, label %38

38:                                               ; preds = %35
  %39 = getelementptr inbounds i8, ptr %7, i64 10
  %40 = load i8, ptr %39, align 2, !tbaa !23
  %.not40 = icmp eq i8 %40, 0
  br i1 %.not40, label %41, label %48

41:                                               ; preds = %38
  %42 = getelementptr inbounds i8, ptr %7, i64 2996
  %43 = getelementptr inbounds i8, ptr %7, i64 5940
  %44 = getelementptr inbounds i8, ptr %0, i64 14516
  %45 = load i32, ptr %44, align 4, !tbaa !24
  %46 = zext i32 %45 to i64
  %47 = call ptr @CopyMem(ptr noundef nonnull %42, ptr noundef nonnull %43, i64 noundef %46) #3
  store i8 1, ptr %39, align 2, !tbaa !23
  br label %48

48:                                               ; preds = %35, %38, %41, %16
  %49 = getelementptr inbounds i8, ptr %7, i64 3
  %50 = load i8, ptr %49, align 1, !tbaa !25
  %.not42 = icmp eq i8 %50, 0
  br i1 %.not42, label %53, label %51

51:                                               ; preds = %48
  %52 = call i64 @PxeBcDhcp6BootInfo(ptr noundef nonnull %0, ptr noundef %1)
  br label %55

53:                                               ; preds = %48
  %54 = call i64 @PxeBcDhcp4BootInfo(ptr noundef nonnull %0, ptr noundef %1)
  br label %55

55:                                               ; preds = %51, %53, %29, %18, %2
  %.0 = phi i64 [ %10, %2 ], [ -9223372036854775787, %18 ], [ %33, %29 ], [ %52, %51 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #3
  ret i64 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !10, i64 104}
!6 = !{!"_EFI_PXE_BASE_CODE_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}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !10, i64 24}
!14 = !{!15, !8, i64 4}
!15 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !8, i64 18, !8, i64 20, !8, i64 36, !8, i64 52, !8, i64 1524, !8, i64 2996, !8, i64 4468, !8, i64 5940, !8, i64 7412, !16, i64 8884, !17, i64 9016, !8, i64 9020, !17, i64 9404, !8, i64 9408, !18, i64 9792, !19, i64 10296}
!16 = !{!"", !8, i64 0, !8, i64 1, !12, i64 2, !8, i64 4}
!17 = !{!"int", !8, i64 0}
!18 = !{!"", !8, i64 0, !8, i64 1, !12, i64 2, !8, i64 4, !8, i64 8}
!19 = !{!"", !8, i64 0, !8, i64 1}
!20 = !{!15, !8, i64 5}
!21 = !{!6, !10, i64 32}
!22 = !{!15, !8, i64 12}
!23 = !{!15, !8, i64 10}
!24 = !{!8, !8, i64 0}
!25 = !{!15, !8, i64 3}


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