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

; 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_MTFTP4_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_MTFTP4_OPTION = type { ptr, ptr }
%struct._PXEBC_PRIVATE_DATA = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct._EFI_PXE_BASE_CODE_PROTOCOL, %struct._EFI_LOAD_FILE_PROTOCOL, %struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL, ptr, ptr, ptr, ptr, %struct.EFI_IP4_CONFIG_DATA, ptr, ptr, ptr, i16, %struct.EFI_UDP4_CONFIG_DATA, %struct.EFI_PXE_BASE_CODE_MODE, i32, ptr, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, i8, i32, i64, i64, [312 x i8], %struct.EFI_DHCP4_PACKET, %struct.EFI_MAC_ADDRESS, i8, i8, i8, i32, i32, i32, %struct.PXEBC_CACHED_DHCP4_PACKET, %struct.PXEBC_CACHED_DHCP4_PACKET, %struct.PXEBC_CACHED_DHCP4_PACKET, [16 x %struct.PXEBC_CACHED_DHCP4_PACKET], [5 x i32], [5 x [16 x i32]], i32, [5 x i32], [16 x i32], ptr, %struct.EFI_IP4_COMPLETION_TOKEN }
%struct._EFI_PXE_BASE_CODE_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_LOAD_FILE_PROTOCOL = type { ptr }
%struct._EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL = type { i64, ptr }
%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_IPv4_ADDRESS = type { [4 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_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_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] }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%struct.EFI_DHCP4_PACKET = type <{ i32, i32, %struct.anon.0 }>
%struct.anon.0 = 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.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.PXEBC_CACHED_DHCP4_PACKET = type { %union.PXEBC_DHCP4_PACKET, i8, i8, [7 x ptr], %struct.PXEBC_VENDOR_OPTION }
%union.PXEBC_DHCP4_PACKET = type { [1480 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_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon.1 }
%union.anon.1 = type { ptr }
%struct.EFI_MTFTP4_CONFIG_DATA = type { i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16 }
%struct._EFI_MTFTP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@mMtftpOptions = external dso_local global [4 x ptr], align 16

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcCheckPacket(ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @PxeBcTftpWriteFile(ptr noundef %0, ptr noundef %1, ptr noundef %2, i8 noundef zeroext %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i8, align 1
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %struct._EFI_MTFTP4_TOKEN, align 8
  %18 = alloca [1 x %struct.EFI_MTFTP4_OPTION], align 16
  %19 = alloca i32, align 4
  %20 = alloca [128 x i8], align 16
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store i8 %3, ptr %12, align 1, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 104, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 128, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  store i64 -9223372036854775801, ptr %21, align 8, !tbaa !10
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._PXEBC_PRIVATE_DATA, ptr %23, i32 0, i32 18
  %25 = load ptr, ptr %24, align 8, !tbaa !12
  store ptr %25, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %19, align 4, !tbaa !32
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.EFI_MTFTP4_CONFIG_DATA, ptr %26, i32 0, i32 6
  store i16 69, ptr %27, align 2, !tbaa !33
  %28 = load ptr, ptr %16, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._EFI_MTFTP4_PROTOCOL, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !35
  %31 = load ptr, ptr %16, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = call i64 %30(ptr noundef %31, ptr noundef %32)
  store i64 %33, ptr %21, align 8, !tbaa !10
  %34 = load i64, ptr %21, align 8, !tbaa !10
  %35 = icmp slt i64 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %7
  %37 = load i64, ptr %21, align 8, !tbaa !10
  store i64 %37, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %88

38:                                               ; preds = %7
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %56

41:                                               ; preds = %38
  %42 = load ptr, ptr @mMtftpOptions, align 16, !tbaa !5
  %43 = getelementptr inbounds [1 x %struct.EFI_MTFTP4_OPTION], ptr %18, i64 0, i64 0
  %44 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %43, i32 0, i32 0
  store ptr %42, ptr %44, align 16, !tbaa !37
  %45 = getelementptr inbounds [128 x i8], ptr %20, i64 0, i64 0
  %46 = getelementptr inbounds [1 x %struct.EFI_MTFTP4_OPTION], ptr %18, i64 0, i64 0
  %47 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %46, i32 0, i32 1
  store ptr %45, ptr %47, align 8, !tbaa !39
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load i64, ptr %48, align 8, !tbaa !10
  %50 = getelementptr inbounds [1 x %struct.EFI_MTFTP4_OPTION], ptr %18, i64 0, i64 0
  %51 = getelementptr inbounds %struct.EFI_MTFTP4_OPTION, ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !39
  %53 = call i64 @UtoA10(i64 noundef %49, ptr noundef %52)
  %54 = load i32, ptr %19, align 4, !tbaa !32
  %55 = add i32 %54, 1
  store i32 %55, ptr %19, align 4, !tbaa !32
  br label %56

56:                                               ; preds = %41, %38
  %57 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 1
  store ptr null, ptr %57, align 8, !tbaa !40
  %58 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 2
  store ptr null, ptr %58, align 8, !tbaa !42
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 3
  store ptr %59, ptr %60, align 8, !tbaa !43
  %61 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 4
  store ptr null, ptr %61, align 8, !tbaa !44
  %62 = load i32, ptr %19, align 4, !tbaa !32
  %63 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 5
  store i32 %62, ptr %63, align 8, !tbaa !45
  %64 = getelementptr inbounds [1 x %struct.EFI_MTFTP4_OPTION], ptr %18, i64 0, i64 0
  %65 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 6
  store ptr %64, ptr %65, align 8, !tbaa !46
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !10
  %68 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 7
  store i64 %67, ptr %68, align 8, !tbaa !47
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 8
  store ptr %69, ptr %70, align 8, !tbaa !48
  %71 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 10
  store ptr @PxeBcCheckPacket, ptr %71, align 8, !tbaa !49
  %72 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 11
  store ptr null, ptr %72, align 8, !tbaa !50
  %73 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 12
  store ptr null, ptr %73, align 8, !tbaa !51
  %74 = load ptr, ptr %16, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._EFI_MTFTP4_PROTOCOL, ptr %74, i32 0, i32 5
  %76 = load ptr, ptr %75, align 8, !tbaa !52
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = call i64 %76(ptr noundef %77, ptr noundef %17)
  store i64 %78, ptr %21, align 8, !tbaa !10
  %79 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %17, i32 0, i32 7
  %80 = load i64, ptr %79, align 8, !tbaa !47
  %81 = load ptr, ptr %15, align 8, !tbaa !5
  store i64 %80, ptr %81, align 8, !tbaa !10
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._EFI_MTFTP4_PROTOCOL, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !35
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = call i64 %84(ptr noundef %85, ptr noundef null)
  %87 = load i64, ptr %21, align 8, !tbaa !10
  store i64 %87, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %88

88:                                               ; preds = %56, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 104, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  %89 = load i64, ptr %8, align 8
  ret i64 %89
}

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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !6, i64 280}
!13 = !{!"_PXEBC_PRIVATE_DATA", !14, 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, !15, i64 80, !16, i64 192, !17, i64 200, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !18, i64 248, !6, i64 280, !6, i64 288, !6, i64 296, !20, i64 304, !21, i64 308, !22, i64 344, !14, i64 10768, !6, i64 10776, !7, i64 10784, !7, i64 10800, !7, i64 10816, !7, i64 10832, !7, i64 10848, !14, i64 10852, !11, i64 10856, !11, i64 10864, !7, i64 10872, !26, i64 11184, !19, i64 11433, !7, i64 11465, !7, i64 11466, !7, i64 11467, !14, i64 11468, !14, i64 11472, !14, i64 11476, !29, i64 11480, !29, i64 13152, !29, i64 14824, !7, i64 16496, !7, i64 43248, !7, i64 43268, !14, i64 43588, !7, i64 43592, !7, i64 43612, !6, i64 43680, !31, i64 43688}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_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}
!16 = !{!"_EFI_LOAD_FILE_PROTOCOL", !6, i64 0}
!17 = !{!"_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL", !11, i64 0, !6, i64 8}
!18 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !19, i64 6, !19, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !14, i64 20, !14, i64 24}
!19 = !{!"", !7, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !14, i64 8, !14, i64 12, !7, i64 16, !19, i64 17, !19, i64 21, !20, i64 26, !19, i64 28, !20, i64 32}
!22 = !{!"", !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, !23, i64 8884, !14, i64 9016, !7, i64 9020, !14, i64 9404, !7, i64 9408, !24, i64 9792, !25, i64 10296}
!23 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !7, i64 4}
!24 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !7, i64 4, !7, i64 8}
!25 = !{!"", !7, i64 0, !7, i64 1}
!26 = !{!"", !14, i64 0, !14, i64 4, !27, i64 8}
!27 = !{!"", !28, i64 0, !14, i64 236, !7, i64 240}
!28 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !14, i64 4, !20, i64 8, !20, i64 10, !19, i64 12, !19, i64 16, !19, i64 20, !19, i64 24, !7, i64 28, !7, i64 44, !7, i64 108}
!29 = !{!"", !7, i64 0, !7, i64 1480, !7, i64 1481, !7, i64 1488, !30, i64 1544}
!30 = !{!"", !7, i64 0, !19, i64 32, !20, i64 36, !20, i64 38, !7, i64 40, !7, i64 41, !7, i64 42, !19, i64 43, !19, i64 47, !20, i64 52, !20, i64 54, !20, i64 56, !20, i64 58, !6, i64 64, !7, i64 72, !6, i64 80, !7, i64 88, !6, i64 96, !7, i64 104, !6, i64 112, !7, i64 120}
!31 = !{!"", !6, i64 0, !11, i64 8, !7, i64 16}
!32 = !{!14, !14, i64 0}
!33 = !{!34, !20, i64 20}
!34 = !{!"", !7, i64 0, !19, i64 1, !19, i64 5, !20, i64 10, !19, i64 12, !19, i64 16, !20, i64 20, !20, i64 22, !20, i64 24}
!35 = !{!36, !6, i64 8}
!36 = !{!"_EFI_MTFTP4_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}
!37 = !{!38, !6, i64 0}
!38 = !{!"", !6, i64 0, !6, i64 8}
!39 = !{!38, !6, i64 8}
!40 = !{!41, !6, i64 8}
!41 = !{!"_EFI_MTFTP4_TOKEN", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!42 = !{!41, !6, i64 16}
!43 = !{!41, !6, i64 24}
!44 = !{!41, !6, i64 32}
!45 = !{!41, !14, i64 40}
!46 = !{!41, !6, i64 48}
!47 = !{!41, !11, i64 56}
!48 = !{!41, !6, i64 64}
!49 = !{!41, !6, i64 80}
!50 = !{!41, !6, i64 88}
!51 = !{!41, !6, i64 96}
!52 = !{!36, !6, 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_MTFTP4_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_MTFTP4_OPTION = type { ptr, ptr }

@mMtftpOptions = external dso_local local_unnamed_addr global [4 x ptr], align 16

; Function Attrs: nounwind uwtable
declare dso_local i64 @PxeBcCheckPacket(ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @PxeBcTftpWriteFile(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef %2, i8 noundef zeroext %3, ptr noundef readonly %4, ptr noundef %5, ptr nocapture noundef %6) local_unnamed_addr #0 {
  %8 = alloca %struct._EFI_MTFTP4_TOKEN, align 8
  %9 = alloca [1 x %struct.EFI_MTFTP4_OPTION], align 16
  %10 = alloca [128 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %10) #4
  %11 = getelementptr inbounds i8, ptr %0, i64 280
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 20
  store i16 69, ptr %13, align 2, !tbaa !29
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !31
  %16 = tail call i64 %15(ptr noundef %12, ptr noundef %1) #4
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %41, label %18

18:                                               ; preds = %7
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %24, label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr @mMtftpOptions, align 16, !tbaa !33
  store ptr %20, ptr %9, align 16, !tbaa !34
  %21 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %10, ptr %21, align 8, !tbaa !36
  %22 = load i64, ptr %4, align 8, !tbaa !37
  %23 = call i64 @UtoA10(i64 noundef %22, ptr noundef nonnull %10) #4
  br label %24

24:                                               ; preds = %19, %18
  %.0 = phi i32 [ 1, %19 ], [ 0, %18 ]
  %25 = getelementptr inbounds i8, ptr %8, i64 8
  %26 = getelementptr inbounds i8, ptr %8, i64 24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %25, i8 0, i64 16, i1 false)
  store ptr %2, ptr %26, align 8, !tbaa !38
  %27 = getelementptr inbounds i8, ptr %8, i64 32
  store ptr null, ptr %27, align 8, !tbaa !40
  %28 = getelementptr inbounds i8, ptr %8, i64 40
  store i32 %.0, ptr %28, align 8, !tbaa !41
  %29 = getelementptr inbounds i8, ptr %8, i64 48
  store ptr %9, ptr %29, align 8, !tbaa !42
  %30 = load i64, ptr %6, align 8, !tbaa !37
  %31 = getelementptr inbounds i8, ptr %8, i64 56
  store i64 %30, ptr %31, align 8, !tbaa !43
  %32 = getelementptr inbounds i8, ptr %8, i64 64
  store ptr %5, ptr %32, align 8, !tbaa !44
  %33 = getelementptr inbounds i8, ptr %8, i64 80
  store ptr @PxeBcCheckPacket, ptr %33, align 8, !tbaa !45
  %34 = getelementptr inbounds i8, ptr %8, i64 88
  %35 = getelementptr inbounds i8, ptr %12, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %34, i8 0, i64 16, i1 false)
  %36 = load ptr, ptr %35, align 8, !tbaa !46
  %37 = call i64 %36(ptr noundef nonnull %12, ptr noundef nonnull %8) #4
  %38 = load i64, ptr %31, align 8, !tbaa !43
  store i64 %38, ptr %6, align 8, !tbaa !37
  %39 = load ptr, ptr %14, align 8, !tbaa !31
  %40 = call i64 %39(ptr noundef nonnull %12, ptr noundef null) #4
  br label %41

41:                                               ; preds = %7, %24
  %.020 = phi i64 [ %37, %24 ], [ %16, %7 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %8) #4
  ret i64 %.020
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 280}
!6 = !{!"_PXEBC_PRIVATE_DATA", !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, !11, i64 80, !13, i64 192, !14, i64 200, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !15, i64 248, !10, i64 280, !10, i64 288, !10, i64 296, !17, i64 304, !18, i64 308, !19, i64 344, !7, i64 10768, !10, i64 10776, !8, i64 10784, !8, i64 10800, !8, i64 10816, !8, i64 10832, !8, i64 10848, !7, i64 10852, !12, i64 10856, !12, i64 10864, !8, i64 10872, !23, i64 11184, !16, i64 11433, !8, i64 11465, !8, i64 11466, !8, i64 11467, !7, i64 11468, !7, i64 11472, !7, i64 11476, !26, i64 11480, !26, i64 13152, !26, i64 14824, !8, i64 16496, !8, i64 43248, !8, i64 43268, !7, i64 43588, !8, i64 43592, !8, i64 43612, !10, i64 43680, !28, i64 43688}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_EFI_PXE_BASE_CODE_PROTOCOL", !12, 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}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"_EFI_LOAD_FILE_PROTOCOL", !10, i64 0}
!14 = !{!"_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL", !12, i64 0, !10, i64 8}
!15 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !16, i64 6, !16, i64 10, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !7, i64 20, !7, i64 24}
!16 = !{!"", !8, i64 0}
!17 = !{!"short", !8, i64 0}
!18 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !7, i64 8, !7, i64 12, !8, i64 16, !16, i64 17, !16, i64 21, !17, i64 26, !16, i64 28, !17, i64 32}
!19 = !{!"", !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, !20, i64 8884, !7, i64 9016, !8, i64 9020, !7, i64 9404, !8, i64 9408, !21, i64 9792, !22, i64 10296}
!20 = !{!"", !8, i64 0, !8, i64 1, !17, i64 2, !8, i64 4}
!21 = !{!"", !8, i64 0, !8, i64 1, !17, i64 2, !8, i64 4, !8, i64 8}
!22 = !{!"", !8, i64 0, !8, i64 1}
!23 = !{!"", !7, i64 0, !7, i64 4, !24, i64 8}
!24 = !{!"", !25, i64 0, !7, i64 236, !8, i64 240}
!25 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !7, i64 4, !17, i64 8, !17, i64 10, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !8, i64 28, !8, i64 44, !8, i64 108}
!26 = !{!"", !8, i64 0, !8, i64 1480, !8, i64 1481, !8, i64 1488, !27, i64 1544}
!27 = !{!"", !8, i64 0, !16, i64 32, !17, i64 36, !17, i64 38, !8, i64 40, !8, i64 41, !8, i64 42, !16, i64 43, !16, i64 47, !17, i64 52, !17, i64 54, !17, i64 56, !17, i64 58, !10, i64 64, !8, i64 72, !10, i64 80, !8, i64 88, !10, i64 96, !8, i64 104, !10, i64 112, !8, i64 120}
!28 = !{!"", !10, i64 0, !12, i64 8, !8, i64 16}
!29 = !{!30, !17, i64 20}
!30 = !{!"", !8, i64 0, !16, i64 1, !16, i64 5, !17, i64 10, !16, i64 12, !16, i64 16, !17, i64 20, !17, i64 22, !17, i64 24}
!31 = !{!32, !10, i64 8}
!32 = !{!"_EFI_MTFTP4_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!33 = !{!10, !10, i64 0}
!34 = !{!35, !10, i64 0}
!35 = !{!"", !10, i64 0, !10, i64 8}
!36 = !{!35, !10, i64 8}
!37 = !{!12, !12, i64 0}
!38 = !{!39, !10, i64 24}
!39 = !{!"_EFI_MTFTP4_TOKEN", !12, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !10, i64 48, !12, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96}
!40 = !{!39, !10, i64 32}
!41 = !{!39, !7, i64 40}
!42 = !{!39, !10, i64 48}
!43 = !{!39, !12, i64 56}
!44 = !{!39, !10, i64 64}
!45 = !{!39, !10, i64 80}
!46 = !{!32, !10, i64 40}


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