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

; 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_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._UDP_IO = type { i32, %struct._LIST_ENTRY, i64, i8, ptr, ptr, ptr, %struct.EFI_SIMPLE_NETWORK_MODE, %struct._LIST_ENTRY, ptr, %union.anon, %union.anon.0 }
%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._LIST_ENTRY = type { ptr, ptr }
%union.anon = type { ptr }
%union.anon.0 = type { %struct.EFI_UDP6_CONFIG_DATA }
%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_UDP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; 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
define dso_local i64 @DhcpConfigUdpIo(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.EFI_UDP4_CONFIG_DATA, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 36, ptr %5) #3
  %6 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 0
  store i8 1, ptr %6, align 4, !tbaa !9
  %7 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 1
  store i8 0, ptr %7, align 1, !tbaa !14
  %8 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 2
  store i8 0, ptr %8, align 2, !tbaa !15
  %9 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 3
  store i8 1, ptr %9, align 1, !tbaa !16
  %10 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 4
  store i8 0, ptr %10, align 4, !tbaa !17
  %11 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 5
  store i8 64, ptr %11, align 1, !tbaa !18
  %12 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 6
  store i8 0, ptr %12, align 2, !tbaa !19
  %13 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 7
  store i32 0, ptr %13, align 4, !tbaa !20
  %14 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 8
  store i32 0, ptr %14, align 4, !tbaa !21
  %15 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 9
  store i8 0, ptr %15, align 4, !tbaa !22
  %16 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 12
  store i16 68, ptr %16, align 2, !tbaa !23
  %17 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 14
  store i16 67, ptr %17, align 4, !tbaa !24
  %18 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 10
  %19 = call ptr @ZeroMem(ptr noundef %18, i64 noundef 4)
  %20 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 11
  %21 = call ptr @ZeroMem(ptr noundef %20, i64 noundef 4)
  %22 = getelementptr inbounds %struct.EFI_UDP4_CONFIG_DATA, ptr %5, i32 0, i32 13
  %23 = call ptr @ZeroMem(ptr noundef %22, i64 noundef 4)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._UDP_IO, ptr %24, i32 0, i32 10
  %26 = load ptr, ptr %25, align 8, !tbaa !25
  %27 = getelementptr inbounds %struct._EFI_UDP4_PROTOCOL, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !26
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._UDP_IO, ptr %29, i32 0, i32 10
  %31 = load ptr, ptr %30, align 8, !tbaa !25
  %32 = call i64 %28(ptr noundef %31, ptr noundef %5)
  call void @llvm.lifetime.end.p0(i64 36, ptr %5) #3
  ret i64 %32
}

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

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, !7, i64 0}
!10 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !11, i64 8, !11, i64 12, !7, i64 16, !12, i64 17, !12, i64 21, !13, i64 26, !12, i64 28, !13, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !7, i64 1}
!15 = !{!10, !7, i64 2}
!16 = !{!10, !7, i64 3}
!17 = !{!10, !7, i64 4}
!18 = !{!10, !7, i64 5}
!19 = !{!10, !7, i64 6}
!20 = !{!10, !11, i64 8}
!21 = !{!10, !11, i64 12}
!22 = !{!10, !7, i64 16}
!23 = !{!10, !13, i64 26}
!24 = !{!10, !13, i64 32}
!25 = !{!7, !7, i64 0}
!26 = !{!27, !6, i64 8}
!27 = !{!"_EFI_UDP4_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"

%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] }

; 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
define dso_local i64 @DhcpConfigUdpIo(ptr nocapture noundef readonly %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = alloca %struct.EFI_UDP4_CONFIG_DATA, align 4
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %3) #4
  store <4 x i8> <i8 1, i8 0, i8 0, i8 1>, ptr %3, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 4
  store i8 0, ptr %4, align 4, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %3, i64 5
  store i8 64, ptr %5, align 1, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %3, i64 6
  store i8 0, ptr %6, align 2, !tbaa !14
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  %8 = getelementptr inbounds i8, ptr %3, i64 26
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(9) %7, i8 0, i64 9, i1 false)
  store i16 68, ptr %8, align 2, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %3, i64 32
  store i16 67, ptr %9, align 4, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %3, i64 17
  %11 = call ptr @ZeroMem(ptr noundef nonnull %10, i64 noundef 4) #4
  %12 = getelementptr inbounds i8, ptr %3, i64 21
  %13 = call ptr @ZeroMem(ptr noundef nonnull %12, i64 noundef 4) #4
  %14 = getelementptr inbounds i8, ptr %3, i64 28
  %15 = call ptr @ZeroMem(ptr noundef nonnull %14, i64 noundef 4) #4
  %16 = getelementptr inbounds i8, ptr %0, i64 744
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = call i64 %19(ptr noundef %17, ptr noundef nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %3) #4
  ret i64 %20
}

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

; 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 = { 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 = { 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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !6, i64 4}
!9 = !{!"", !6, i64 0, !6, i64 1, !6, i64 2, !6, i64 3, !6, i64 4, !6, i64 5, !6, i64 6, !10, i64 8, !10, i64 12, !6, i64 16, !11, i64 17, !11, i64 21, !12, i64 26, !11, i64 28, !12, i64 32}
!10 = !{!"int", !6, i64 0}
!11 = !{!"", !6, i64 0}
!12 = !{!"short", !6, i64 0}
!13 = !{!9, !6, i64 5}
!14 = !{!9, !6, i64 6}
!15 = !{!9, !12, i64 26}
!16 = !{!9, !12, i64 32}
!17 = !{!18, !19, i64 8}
!18 = !{!"_EFI_UDP4_PROTOCOL", !19, i64 0, !19, i64 8, !19, i64 16, !19, i64 24, !19, i64 32, !19, i64 40, !19, i64 48, !19, i64 56}
!19 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass