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

; 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.s_pxe_cdb = type { i16, i16, i16, i16, i64, i64, i16, i16, i16, i16 }
%struct.s_pxe_db_get_init_info = type <{ i32, i32, [4 x i32], i32, i16, i16, i16, i16, i16, i16, i16, i16, i8, i8, i8 }>

; Function Attrs: nounwind uwtable
define dso_local void @UNDI_GetInitInfo(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  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 8, ptr %5) #2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.s_pxe_cdb, ptr %6, i32 0, i32 5
  %8 = load i64, ptr %7, align 1, !tbaa !9
  %9 = inttoptr i64 %8 to ptr
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %10, i32 0, i32 0
  store i32 57540, ptr %11, align 1, !tbaa !13
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %12, i32 0, i32 1
  store i32 1500, ptr %13, align 1, !tbaa !16
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %14, i32 0, i32 2
  %16 = getelementptr inbounds [4 x i32], ptr %15, i64 0, i64 0
  store i32 10, ptr %16, align 1, !tbaa !17
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %17, i32 0, i32 2
  %19 = getelementptr inbounds [4 x i32], ptr %18, i64 0, i64 1
  store i32 100, ptr %19, align 1, !tbaa !17
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %20, i32 0, i32 2
  %22 = getelementptr inbounds [4 x i32], ptr %21, i64 0, i64 3
  store i32 0, ptr %22, align 1, !tbaa !17
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %23, i32 0, i32 2
  %25 = getelementptr inbounds [4 x i32], ptr %24, i64 0, i64 2
  store i32 0, ptr %25, align 1, !tbaa !17
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %26, i32 0, i32 3
  store i32 128, ptr %27, align 1, !tbaa !18
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %28, i32 0, i32 4
  store i16 4, ptr %29, align 1, !tbaa !19
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %30, i32 0, i32 5
  store i16 14, ptr %31, align 1, !tbaa !20
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %32, i32 0, i32 6
  store i16 6, ptr %33, align 1, !tbaa !21
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %34, i32 0, i32 7
  store i16 8, ptr %35, align 1, !tbaa !22
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %36, i32 0, i32 8
  store i16 32, ptr %37, align 1, !tbaa !23
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %38, i32 0, i32 9
  store i16 240, ptr %39, align 1, !tbaa !24
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %40, i32 0, i32 10
  store i16 32, ptr %41, align 1, !tbaa !25
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %42, i32 0, i32 11
  store i16 1556, ptr %43, align 1, !tbaa !26
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %44, i32 0, i32 12
  store i8 1, ptr %45, align 1, !tbaa !27
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %46, i32 0, i32 13
  store i8 3, ptr %47, align 1, !tbaa !28
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.s_pxe_db_get_init_info, ptr %48, i32 0, i32 14
  store i8 3, ptr %49, align 1, !tbaa !29
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.s_pxe_cdb, ptr %50, i32 0, i32 7
  %52 = load i16, ptr %51, align 1, !tbaa !30
  %53 = zext i16 %52 to i32
  %54 = or i32 %53, 3
  %55 = trunc i32 %54 to i16
  store i16 %55, ptr %51, align 1, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

; 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

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 = { 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, !12, i64 16}
!10 = !{!"s_pxe_cdb", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !12, i64 8, !12, i64 16, !11, i64 24, !11, i64 26, !11, i64 28, !11, i64 30}
!11 = !{!"short", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"s_pxe_db_get_init_info", !15, i64 0, !15, i64 4, !7, i64 8, !15, i64 24, !11, i64 28, !11, i64 30, !11, i64 32, !11, i64 34, !11, i64 36, !11, i64 38, !11, i64 40, !11, i64 42, !7, i64 44, !7, i64 45, !7, i64 46}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !15, i64 4}
!17 = !{!15, !15, i64 0}
!18 = !{!14, !15, i64 24}
!19 = !{!14, !11, i64 28}
!20 = !{!14, !11, i64 30}
!21 = !{!14, !11, i64 32}
!22 = !{!14, !11, i64 34}
!23 = !{!14, !11, i64 36}
!24 = !{!14, !11, i64 38}
!25 = !{!14, !11, i64 40}
!26 = !{!14, !11, i64 42}
!27 = !{!14, !7, i64 44}
!28 = !{!14, !7, i64 45}
!29 = !{!14, !7, i64 46}
!30 = !{!10, !11, i64 26}


; 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 nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @UNDI_GetInitInfo(ptr nocapture noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i64, ptr %3, align 1, !tbaa !5
  %5 = inttoptr i64 %4 to ptr
  store <4 x i32> <i32 57540, i32 1500, i32 10, i32 100>, ptr %5, align 1, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 0, ptr %6, align 1, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 0, ptr %7, align 1, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 128, ptr %8, align 1, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %5, i64 28
  store <8 x i16> <i16 4, i16 14, i16 6, i16 8, i16 32, i16 240, i16 32, i16 1556>, ptr %9, align 1, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %5, i64 44
  store i8 1, ptr %10, align 1, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %5, i64 45
  store i8 3, ptr %11, align 1, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %5, i64 46
  store i8 3, ptr %12, align 1, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 26
  %14 = load i16, ptr %13, align 1, !tbaa !19
  %15 = or i16 %14, 3
  store i16 %15, ptr %13, align 1, !tbaa !19
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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" }

!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 16}
!6 = !{!"s_pxe_cdb", !7, i64 0, !7, i64 2, !7, i64 4, !7, i64 6, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 26, !7, i64 28, !7, i64 30}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 24}
!14 = !{!"s_pxe_db_get_init_info", !12, i64 0, !12, i64 4, !8, i64 8, !12, i64 24, !7, i64 28, !7, i64 30, !7, i64 32, !7, i64 34, !7, i64 36, !7, i64 38, !7, i64 40, !7, i64 42, !8, i64 44, !8, i64 45, !8, i64 46}
!15 = !{!7, !7, i64 0}
!16 = !{!14, !8, i64 44}
!17 = !{!14, !8, i64 45}
!18 = !{!14, !8, i64 46}
!19 = !{!6, !7, i64 26}


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