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

; 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_MAC_ADDRESS = type { [32 x i8] }
%struct.MAC_ADDR_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, %struct.EFI_MAC_ADDRESS, i8 }
%struct.EFI_DEVICE_PATH_PROTOCOL = type { i8, i8, [2 x i8] }
%struct.s_data_instance = type { i16, i16, i8, i8, i16, i16, i16, i16, i16, [32 x i8], [32 x i8], [32 x i8], [64 x i32], [128 x i32], i32, i32, i16, i16, i8, i8, i8, i8, i16, i16, i16, i16, i32, i32, i16, i16, [2 x i16], i8, i8, i16, i32, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, [64 x i64], i16, i16, i16, i16, i8, i8, i8, i8, i8, [3 x i8], %struct.mc, i64, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mc = type { [3 x i16], i16, [8 x [32 x i8]] }
%struct.CONFIG_HEADER = type { i16, i16, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i16, i16, i32, i8, i8, i16, i32, i8, i8, i8, i8 }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, 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, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }

@gBS = external global ptr, align 8

; 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 @ZeroMem(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @AppendMac2DevPath(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.EFI_MAC_ADDRESS, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca %struct.MAC_ADDR_DEVICE_PATH, align 1
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i16, align 2
  %18 = alloca i16, align 2
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 37, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.s_data_instance, ptr %21, i32 0, i32 65
  store ptr @TmpDelay, ptr %22, align 8, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.s_data_instance, ptr %23, i32 0, i32 66
  store ptr null, ptr %24, align 8, !tbaa !15
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.s_data_instance, ptr %25, i32 0, i32 67
  store ptr null, ptr %26, align 8, !tbaa !16
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s_data_instance, ptr %27, i32 0, i32 69
  store ptr null, ptr %28, align 8, !tbaa !17
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.s_data_instance, ptr %29, i32 0, i32 70
  store ptr null, ptr %30, align 8, !tbaa !18
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.s_data_instance, ptr %31, i32 0, i32 71
  store ptr null, ptr %32, align 8, !tbaa !19
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.s_data_instance, ptr %33, i32 0, i32 68
  store ptr @TmpMemIo, ptr %34, align 8, !tbaa !20
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.s_data_instance, ptr %35, i32 0, i32 55
  store i8 49, ptr %36, align 4, !tbaa !21
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = ptrtoint ptr %37 to i64
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.s_data_instance, ptr %39, i32 0, i32 58
  store i64 %38, ptr %40, align 8, !tbaa !22
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.s_data_instance, ptr %41, i32 0, i32 12
  %43 = getelementptr inbounds [64 x i32], ptr %42, i64 0, i64 0
  store ptr %43, ptr %9, align 8, !tbaa !5
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.s_data_instance, ptr %44, i32 0, i32 14
  store i32 0, ptr %45, align 8, !tbaa !23
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.CONFIG_HEADER, ptr %46, i32 0, i32 4
  %48 = load i16, ptr %47, align 1, !tbaa !24
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.s_data_instance, ptr %49, i32 0, i32 6
  store i16 %48, ptr %50, align 2, !tbaa !26
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = call zeroext i8 @E100bGetEepromAddrLen(ptr noundef %51)
  store i8 %52, ptr %13, align 1, !tbaa !27
  store i32 0, ptr %11, align 4, !tbaa !28
  store i32 0, ptr %12, align 4, !tbaa !28
  br label %53

53:                                               ; preds = %77, %3
  %54 = load i32, ptr %11, align 4, !tbaa !28
  %55 = icmp slt i32 %54, 3
  br i1 %55, label %56, label %80

56:                                               ; preds = %53
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i32, ptr %11, align 4, !tbaa !28
  %59 = load i8, ptr %13, align 1, !tbaa !27
  %60 = call zeroext i16 @E100bReadEeprom(ptr noundef %57, i32 noundef %58, i8 noundef zeroext %59)
  %61 = zext i16 %60 to i32
  store i32 %61, ptr %10, align 4, !tbaa !28
  %62 = load i32, ptr %10, align 4, !tbaa !28
  %63 = trunc i32 %62 to i8
  %64 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %8, i32 0, i32 0
  %65 = load i32, ptr %12, align 4, !tbaa !28
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %12, align 4, !tbaa !28
  %67 = sext i32 %65 to i64
  %68 = getelementptr inbounds [32 x i8], ptr %64, i64 0, i64 %67
  store i8 %63, ptr %68, align 1, !tbaa !27
  %69 = load i32, ptr %10, align 4, !tbaa !28
  %70 = ashr i32 %69, 8
  %71 = trunc i32 %70 to i8
  %72 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %8, i32 0, i32 0
  %73 = load i32, ptr %12, align 4, !tbaa !28
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %12, align 4, !tbaa !28
  %75 = sext i32 %73 to i64
  %76 = getelementptr inbounds [32 x i8], ptr %72, i64 0, i64 %75
  store i8 %71, ptr %76, align 1, !tbaa !27
  br label %77

77:                                               ; preds = %56
  %78 = load i32, ptr %11, align 4, !tbaa !28
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %11, align 4, !tbaa !28
  br label %53, !llvm.loop !29

80:                                               ; preds = %53
  %81 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %8, i32 0, i32 0
  %82 = getelementptr inbounds [32 x i8], ptr %81, i64 0, i64 0
  %83 = load i32, ptr %12, align 4, !tbaa !28
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i8, ptr %82, i64 %84
  %86 = load i32, ptr %12, align 4, !tbaa !28
  %87 = sext i32 %86 to i64
  %88 = sub i64 32, %87
  %89 = call ptr @SetMem(ptr noundef %85, i64 noundef %88, i8 noundef zeroext 0)
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.s_data_instance, ptr %90, i32 0, i32 65
  store ptr null, ptr %91, align 8, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.s_data_instance, ptr %92, i32 0, i32 68
  store ptr null, ptr %93, align 8, !tbaa !20
  %94 = call ptr @ZeroMem(ptr noundef %14, i64 noundef 37)
  %95 = getelementptr inbounds %struct.MAC_ADDR_DEVICE_PATH, ptr %14, i32 0, i32 1
  %96 = call ptr @CopyMem(ptr noundef %95, ptr noundef %8, i64 noundef 32)
  %97 = getelementptr inbounds %struct.MAC_ADDR_DEVICE_PATH, ptr %14, i32 0, i32 0
  %98 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %97, i32 0, i32 0
  store i8 3, ptr %98, align 1, !tbaa !31
  %99 = getelementptr inbounds %struct.MAC_ADDR_DEVICE_PATH, ptr %14, i32 0, i32 0
  %100 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %99, i32 0, i32 1
  store i8 11, ptr %100, align 1, !tbaa !35
  %101 = getelementptr inbounds %struct.MAC_ADDR_DEVICE_PATH, ptr %14, i32 0, i32 0
  %102 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %101, i32 0, i32 2
  %103 = getelementptr inbounds [2 x i8], ptr %102, i64 0, i64 0
  store i8 37, ptr %103, align 1, !tbaa !27
  %104 = getelementptr inbounds %struct.MAC_ADDR_DEVICE_PATH, ptr %14, i32 0, i32 0
  %105 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %104, i32 0, i32 2
  %106 = getelementptr inbounds [2 x i8], ptr %105, i64 0, i64 1
  store i8 0, ptr %106, align 1, !tbaa !27
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %107, ptr %15, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %113, %80
  %109 = load ptr, ptr %15, align 8, !tbaa !5
  %110 = call zeroext i8 @IsDevicePathEnd(ptr noundef %109)
  %111 = icmp ne i8 %110, 0
  %112 = xor i1 %111, true
  br i1 %112, label %113, label %116

113:                                              ; preds = %108
  %114 = load ptr, ptr %15, align 8, !tbaa !5
  %115 = call ptr @NextDevicePathNode(ptr noundef %114)
  store ptr %115, ptr %15, align 8, !tbaa !5
  br label %108, !llvm.loop !36

116:                                              ; preds = %108
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = ptrtoint ptr %117 to i64
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = ptrtoint ptr %119 to i64
  %121 = sub i64 %118, %120
  %122 = trunc i64 %121 to i16
  store i16 %122, ptr %18, align 2, !tbaa !37
  %123 = load i16, ptr %18, align 2, !tbaa !37
  %124 = zext i16 %123 to i64
  %125 = add i64 %124, 37
  %126 = add i64 %125, 4
  %127 = trunc i64 %126 to i16
  store i16 %127, ptr %17, align 2, !tbaa !37
  %128 = load ptr, ptr @gBS, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %128, i32 0, i32 6
  %130 = load ptr, ptr %129, align 8, !tbaa !38
  %131 = load i16, ptr %17, align 2, !tbaa !37
  %132 = zext i16 %131 to i64
  %133 = call i64 %130(i32 noundef 6, i64 noundef %132, ptr noundef %16)
  store i64 %133, ptr %19, align 8, !tbaa !41
  %134 = load i64, ptr %19, align 8, !tbaa !41
  %135 = icmp ne i64 %134, 0
  br i1 %135, label %136, label %138

136:                                              ; preds = %116
  %137 = load i64, ptr %19, align 8, !tbaa !41
  store i64 %137, ptr %4, align 8
  store i32 1, ptr %20, align 4
  br label %158

138:                                              ; preds = %116
  %139 = load ptr, ptr %16, align 8, !tbaa !5
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %139, ptr %140, align 8, !tbaa !5
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = load i16, ptr %18, align 2, !tbaa !37
  %144 = zext i16 %143 to i64
  %145 = call ptr @CopyMem(ptr noundef %141, ptr noundef %142, i64 noundef %144)
  %146 = load i16, ptr %18, align 2, !tbaa !37
  %147 = zext i16 %146 to i32
  %148 = load ptr, ptr %16, align 8, !tbaa !5
  %149 = sext i32 %147 to i64
  %150 = getelementptr inbounds i8, ptr %148, i64 %149
  store ptr %150, ptr %16, align 8, !tbaa !5
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = call ptr @CopyMem(ptr noundef %151, ptr noundef %14, i64 noundef 37)
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = getelementptr inbounds i8, ptr %153, i64 37
  store ptr %154, ptr %16, align 8, !tbaa !5
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = call ptr @CopyMem(ptr noundef %155, ptr noundef %156, i64 noundef 4)
  store i64 0, ptr %4, align 8
  store i32 1, ptr %20, align 4
  br label %158

158:                                              ; preds = %138, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 37, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #3
  %159 = load i64, ptr %4, align 8
  ret i64 %159
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @TmpMemIo(i64 noundef, i8 noundef zeroext, i8 noundef zeroext, i64 noundef, i64 noundef) #2

declare zeroext i8 @E100bGetEepromAddrLen(ptr noundef) #1

declare zeroext i16 @E100bReadEeprom(ptr noundef, i32 noundef, i8 noundef zeroext) #1

declare ptr @SetMem(ptr noundef, i64 noundef, i8 noundef zeroext) #1

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

declare zeroext i8 @IsDevicePathEnd(ptr noundef) #1

declare ptr @NextDevicePathNode(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 = !{!10, !6, i64 1864}
!10 = !{!"s_data_instance", !11, i64 0, !11, i64 2, !7, i64 4, !7, i64 5, !11, i64 6, !11, i64 8, !11, i64 10, !11, i64 12, !11, i64 14, !7, i64 16, !7, i64 48, !7, i64 80, !7, i64 112, !7, i64 368, !12, i64 880, !12, i64 884, !11, i64 888, !11, i64 890, !7, i64 892, !7, i64 893, !7, i64 894, !7, i64 895, !11, i64 896, !11, i64 898, !11, i64 900, !11, i64 902, !12, i64 904, !12, i64 908, !11, i64 912, !11, i64 914, !7, i64 916, !7, i64 920, !7, i64 921, !11, i64 922, !12, i64 924, !6, i64 928, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !13, i64 976, !13, i64 984, !13, i64 992, !13, i64 1000, !13, i64 1008, !7, i64 1016, !11, i64 1528, !11, i64 1530, !11, i64 1532, !11, i64 1534, !7, i64 1536, !7, i64 1537, !7, i64 1538, !7, i64 1539, !7, i64 1540, !7, i64 1541, !14, i64 1544, !13, i64 1808, !6, i64 1816, !13, i64 1824, !6, i64 1832, !6, i64 1840, !6, i64 1848, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888, !6, i64 1896, !6, i64 1904, !6, i64 1912}
!11 = !{!"short", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"mc", !7, i64 0, !11, i64 6, !7, i64 8}
!15 = !{!10, !6, i64 1872}
!16 = !{!10, !6, i64 1880}
!17 = !{!10, !6, i64 1896}
!18 = !{!10, !6, i64 1904}
!19 = !{!10, !6, i64 1912}
!20 = !{!10, !6, i64 1888}
!21 = !{!10, !7, i64 1540}
!22 = !{!10, !13, i64 1808}
!23 = !{!10, !12, i64 880}
!24 = !{!25, !11, i64 8}
!25 = !{!"CONFIG_HEADER", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !11, i64 8, !11, i64 10, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !11, i64 44, !11, i64 46, !12, i64 48, !7, i64 52, !7, i64 53, !11, i64 54, !12, i64 56, !7, i64 60, !7, i64 61, !7, i64 62, !7, i64 63}
!26 = !{!10, !11, i64 10}
!27 = !{!7, !7, i64 0}
!28 = !{!12, !12, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!32, !7, i64 0}
!32 = !{!"", !33, i64 0, !34, i64 4, !7, i64 36}
!33 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2}
!34 = !{!"", !7, i64 0}
!35 = !{!32, !7, i64 1}
!36 = distinct !{!36, !30}
!37 = !{!11, !11, i64 0}
!38 = !{!39, !6, i64 64}
!39 = !{!"", !40, i64 0, !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, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!40 = !{!"", !13, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!41 = !{!13, !13, i64 0}


; 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_MAC_ADDRESS = type { [32 x i8] }
%struct.MAC_ADDR_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, %struct.EFI_MAC_ADDRESS, i8 }
%struct.EFI_DEVICE_PATH_PROTOCOL = type { i8, i8, [2 x i8] }

@gBS = external local_unnamed_addr global ptr, align 8

; 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 @ZeroMem(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @AppendMac2DevPath(ptr nocapture noundef writeonly %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.EFI_MAC_ADDRESS, align 1
  %5 = alloca %struct.MAC_ADDR_DEVICE_PATH, align 4
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 37, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %7 = getelementptr inbounds i8, ptr %2, i64 1864
  store ptr @TmpDelay, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 1872
  %9 = getelementptr inbounds i8, ptr %2, i64 1896
  %10 = getelementptr inbounds i8, ptr %2, i64 1888
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, i8 0, i64 24, i1 false)
  store ptr @TmpMemIo, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %2, i64 1540
  store i8 49, ptr %11, align 4, !tbaa !15
  %12 = ptrtoint ptr %2 to i64
  %13 = getelementptr inbounds i8, ptr %2, i64 1808
  store i64 %12, ptr %13, align 8, !tbaa !16
  %14 = getelementptr inbounds i8, ptr %2, i64 880
  store i32 0, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %2, i64 120
  %16 = load i16, ptr %15, align 1, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %2, i64 10
  store i16 %16, ptr %17, align 2, !tbaa !20
  %18 = tail call zeroext i8 @E100bGetEepromAddrLen(ptr noundef %2) #4
  %19 = tail call zeroext i16 @E100bReadEeprom(ptr noundef %2, i32 noundef 0, i8 noundef zeroext %18) #4
  %20 = trunc i16 %19 to i8
  store i8 %20, ptr %4, align 1, !tbaa !21
  %21 = lshr i16 %19, 8
  %22 = trunc nuw i16 %21 to i8
  %23 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 %22, ptr %23, align 1, !tbaa !21
  %24 = tail call zeroext i16 @E100bReadEeprom(ptr noundef %2, i32 noundef 1, i8 noundef zeroext %18) #4
  %25 = trunc i16 %24 to i8
  %26 = getelementptr inbounds i8, ptr %4, i64 2
  store i8 %25, ptr %26, align 1, !tbaa !21
  %27 = lshr i16 %24, 8
  %28 = trunc nuw i16 %27 to i8
  %29 = getelementptr inbounds i8, ptr %4, i64 3
  store i8 %28, ptr %29, align 1, !tbaa !21
  %30 = tail call zeroext i16 @E100bReadEeprom(ptr noundef %2, i32 noundef 2, i8 noundef zeroext %18) #4
  %31 = trunc i16 %30 to i8
  %32 = getelementptr inbounds i8, ptr %4, i64 4
  store i8 %31, ptr %32, align 1, !tbaa !21
  %33 = lshr i16 %30, 8
  %34 = trunc nuw i16 %33 to i8
  %35 = getelementptr inbounds i8, ptr %4, i64 5
  store i8 %34, ptr %35, align 1, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %4, i64 6
  %37 = call ptr @SetMem(ptr noundef nonnull %36, i64 noundef 26, i8 noundef zeroext 0) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %10, align 8, !tbaa !14
  %38 = call ptr @ZeroMem(ptr noundef nonnull %5, i64 noundef 37) #4
  %39 = getelementptr inbounds i8, ptr %5, i64 4
  %40 = call ptr @CopyMem(ptr noundef nonnull %39, ptr noundef nonnull %4, i64 noundef 32) #4
  store <4 x i8> <i8 3, i8 11, i8 37, i8 0>, ptr %5, align 4, !tbaa !21
  %41 = call zeroext i8 @IsDevicePathEnd(ptr noundef %1) #4
  %.not49 = icmp eq i8 %41, 0
  br i1 %.not49, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.04450 = phi ptr [ %42, %.lr.ph ], [ %1, %3 ]
  %42 = call ptr @NextDevicePathNode(ptr noundef %.04450) #4
  %43 = call zeroext i8 @IsDevicePathEnd(ptr noundef %42) #4
  %.not = icmp eq i8 %43, 0
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !22

._crit_edge:                                      ; preds = %.lr.ph, %3
  %.044.lcssa = phi ptr [ %1, %3 ], [ %42, %.lr.ph ]
  %44 = ptrtoint ptr %.044.lcssa to i64
  %45 = ptrtoint ptr %1 to i64
  %46 = sub i64 %44, %45
  %47 = add i64 %46, 41
  %48 = load ptr, ptr @gBS, align 8, !tbaa !24
  %49 = getelementptr inbounds i8, ptr %48, i64 64
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %51 = and i64 %47, 65535
  %52 = call i64 %50(i32 noundef 6, i64 noundef %51, ptr noundef nonnull %6) #4
  %.not46 = icmp eq i64 %52, 0
  br i1 %.not46, label %53, label %63

53:                                               ; preds = %._crit_edge
  %54 = and i64 %46, 65535
  %55 = load ptr, ptr %6, align 8, !tbaa !24
  store ptr %55, ptr %0, align 8, !tbaa !24
  %56 = call ptr @CopyMem(ptr noundef %55, ptr noundef %1, i64 noundef %54) #4
  %57 = load ptr, ptr %6, align 8, !tbaa !24
  %58 = getelementptr inbounds i8, ptr %57, i64 %54
  store ptr %58, ptr %6, align 8, !tbaa !24
  %59 = call ptr @CopyMem(ptr noundef %58, ptr noundef nonnull %5, i64 noundef 37) #4
  %60 = load ptr, ptr %6, align 8, !tbaa !24
  %61 = getelementptr inbounds i8, ptr %60, i64 37
  store ptr %61, ptr %6, align 8, !tbaa !24
  %62 = call ptr @CopyMem(ptr noundef nonnull %61, ptr noundef %.044.lcssa, i64 noundef 4) #4
  br label %63

63:                                               ; preds = %._crit_edge, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 37, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret i64 %52
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @TmpMemIo(i64 noundef, i8 noundef zeroext, i8 noundef zeroext, i64 noundef, i64 noundef) #2

declare zeroext i8 @E100bGetEepromAddrLen(ptr noundef) local_unnamed_addr #1

declare zeroext i16 @E100bReadEeprom(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

declare ptr @SetMem(ptr noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #1

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

declare zeroext i8 @IsDevicePathEnd(ptr noundef) local_unnamed_addr #1

declare ptr @NextDevicePathNode(ptr noundef) local_unnamed_addr #1

; 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 = { "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 = { 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, !11, i64 1864}
!6 = !{!"s_data_instance", !7, i64 0, !7, i64 2, !8, i64 4, !8, i64 5, !7, i64 6, !7, i64 8, !7, i64 10, !7, i64 12, !7, i64 14, !8, i64 16, !8, i64 48, !8, i64 80, !8, i64 112, !8, i64 368, !10, i64 880, !10, i64 884, !7, i64 888, !7, i64 890, !8, i64 892, !8, i64 893, !8, i64 894, !8, i64 895, !7, i64 896, !7, i64 898, !7, i64 900, !7, i64 902, !10, i64 904, !10, i64 908, !7, i64 912, !7, i64 914, !8, i64 916, !8, i64 920, !8, i64 921, !7, i64 922, !10, i64 924, !11, i64 928, !11, i64 936, !11, i64 944, !11, i64 952, !11, i64 960, !11, i64 968, !12, i64 976, !12, i64 984, !12, i64 992, !12, i64 1000, !12, i64 1008, !8, i64 1016, !7, i64 1528, !7, i64 1530, !7, i64 1532, !7, i64 1534, !8, i64 1536, !8, i64 1537, !8, i64 1538, !8, i64 1539, !8, i64 1540, !8, i64 1541, !13, i64 1544, !12, i64 1808, !11, i64 1816, !12, i64 1824, !11, i64 1832, !11, i64 1840, !11, i64 1848, !11, i64 1856, !11, i64 1864, !11, i64 1872, !11, i64 1880, !11, i64 1888, !11, i64 1896, !11, i64 1904, !11, i64 1912}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!"mc", !8, i64 0, !7, i64 6, !8, i64 8}
!14 = !{!6, !11, i64 1888}
!15 = !{!6, !8, i64 1540}
!16 = !{!6, !12, i64 1808}
!17 = !{!6, !10, i64 880}
!18 = !{!19, !7, i64 8}
!19 = !{!"CONFIG_HEADER", !7, i64 0, !7, i64 2, !7, i64 4, !7, i64 6, !7, i64 8, !7, i64 10, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 44, !7, i64 46, !10, i64 48, !8, i64 52, !8, i64 53, !7, i64 54, !10, i64 56, !8, i64 60, !8, i64 61, !8, i64 62, !8, i64 63}
!20 = !{!6, !7, i64 10}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!11, !11, i64 0}
!25 = !{!26, !11, i64 64}
!26 = !{!"", !27, i64 0, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !11, i64 272, !11, i64 280, !11, i64 288, !11, i64 296, !11, i64 304, !11, i64 312, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360, !11, i64 368}
!27 = !{!"", !12, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass