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

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%union.EFI_IA32_REGISTER_SET = type { %struct.EFI_DWORD_REGS }
%struct.EFI_DWORD_REGS = type { i32, i32, i32, i32, i32, i32, %struct.EFI_EFLAGS_REG, i16, i16, i16, i16, i16, i16, i32, i32 }
%struct.EFI_EFLAGS_REG = type { i32 }
%struct._EFI_BLOCK_IO_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_BLOCK_IO_MEDIA = type { i32, i8, i8, i8, i8, i8, i32, i32, i64, i64, i32, i32 }
%struct.BIOS_BLOCK_IO_DEV = type { i64, ptr, ptr, %struct._EFI_BLOCK_IO_PROTOCOL, %struct.EFI_BLOCK_IO_MEDIA, ptr, ptr, ptr, %struct.BIOS_LEGACY_DRIVE }
%struct.BIOS_LEGACY_DRIVE = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, ptr, i8, i8, i8, i8, i16, i16, %struct.EDD_DRIVE_PARAMETERS }
%struct.EDD_DRIVE_PARAMETERS = type <{ i16, i16, i32, i32, i32, i64, i16, i32, i16, i8, i8, i16, [4 x i8], [8 x i8], %union.EDD_INTERFACE_PATH, %union.EDD_DEVICE_PATH, i8, i8 }>
%union.EDD_INTERFACE_PATH = type { %struct.EDD_PCI }
%struct.EDD_PCI = type { i8, i8, i8, i8, i32 }
%union.EDD_DEVICE_PATH = type { %struct.EDD_USB }
%struct.EDD_USB = type { i64, i64 }
%struct.EDD_DEVICE_ADDRESS_PACKET = type { i8, i8, i8, i8, i32, i64, i64, i32, i32 }
%struct.EFI_BYTE_REGS = type { i8, i8, i16, i8, i8, i16, i8, i8, i16, i8, i8, i16 }
%struct.EFI_WORD_REGS = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, %struct.EFI_FLAGS_REG, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 }
%struct.EFI_FLAGS_REG = type { i16 }
%struct._EFI_LEGACY_BIOS_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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 }

@.str.5 = external hidden unnamed_addr constant [162 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@mEddBufferUnder1Mb = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@gBS = external global ptr, align 8
@gEfiBlockIoProtocolGuid = external global %struct.GUID, align 4
@.str.10 = external hidden unnamed_addr constant [57 x i8], align 1

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

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

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

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @Edd30BiosWriteBlocks(ptr noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) #1 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %union.EFI_IA32_REGISTER_SET, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i64 %2, ptr %9, align 8, !tbaa !11
  store i64 %3, ptr %10, align 8, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %25, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !13
  store ptr %27, ptr %12, align 8, !tbaa !5
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %28, i32 0, i32 6
  %30 = load i32, ptr %29, align 4, !tbaa !15
  %31 = zext i32 %30 to i64
  store i64 %31, ptr %19, align 8, !tbaa !11
  %32 = call ptr @ZeroMem(ptr noundef %15, i64 noundef 48)
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !17
  %37 = icmp ne i32 %33, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %5
  store i64 -9223372036854775795, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

39:                                               ; preds = %5
  %40 = load i64, ptr %9, align 8, !tbaa !11
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %41, i32 0, i32 8
  %43 = load i64, ptr %42, align 8, !tbaa !18
  %44 = icmp ugt i64 %40, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %39
  store i64 -9223372036854775801, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

46:                                               ; preds = %39
  %47 = load i64, ptr %9, align 8, !tbaa !11
  %48 = load i64, ptr %10, align 8, !tbaa !11
  %49 = load i64, ptr %19, align 8, !tbaa !11
  %50 = udiv i64 %48, %49
  %51 = add i64 %47, %50
  %52 = sub i64 %51, 1
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %53, i32 0, i32 8
  %55 = load i64, ptr %54, align 8, !tbaa !18
  %56 = icmp ugt i64 %52, %55
  br i1 %56, label %57, label %58

57:                                               ; preds = %46
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

58:                                               ; preds = %46
  %59 = load i64, ptr %10, align 8, !tbaa !11
  %60 = load i64, ptr %19, align 8, !tbaa !11
  %61 = urem i64 %59, %60
  %62 = icmp ne i64 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %58
  store i64 -9223372036854775804, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

64:                                               ; preds = %58
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

68:                                               ; preds = %64
  %69 = load i64, ptr %10, align 8, !tbaa !11
  %70 = icmp eq i64 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  store i64 0, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

72:                                               ; preds = %68
  %73 = call zeroext i8 @DebugAssertEnabled()
  %74 = zext i8 %73 to i32
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %72
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = ptrtoint ptr %77 to i64
  %79 = sub i64 %78, ptrtoint (ptr getelementptr inbounds (%struct.BIOS_BLOCK_IO_DEV, ptr null, i32 0, i32 3) to i64)
  %80 = inttoptr i64 %79 to ptr
  %81 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %80, i32 0, i32 0
  %82 = load i64, ptr %81, align 8, !tbaa !19
  %83 = icmp ne i64 %82, 1869177442
  br i1 %83, label %84, label %86

84:                                               ; preds = %76
  call void @DebugAssert(ptr noundef @.str.5, i64 noundef 616, ptr noundef @.str.7)
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  br label %91

86:                                               ; preds = %76, %72
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = ptrtoint ptr %87 to i64
  %89 = sub i64 %88, ptrtoint (ptr getelementptr inbounds (%struct.BIOS_BLOCK_IO_DEV, ptr null, i32 0, i32 3) to i64)
  %90 = inttoptr i64 %89 to ptr
  br label %91

91:                                               ; preds = %86, %84
  %92 = phi ptr [ %85, %84 ], [ %90, %86 ]
  store ptr %92, ptr %13, align 8, !tbaa !5
  %93 = load ptr, ptr @mEddBufferUnder1Mb, align 8, !tbaa !5
  store ptr %93, ptr %14, align 8, !tbaa !5
  %94 = load i64, ptr %19, align 8, !tbaa !11
  %95 = udiv i64 65024, %94
  store i64 %95, ptr %22, align 8, !tbaa !11
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = ptrtoint ptr %96 to i64
  store i64 %97, ptr %16, align 8, !tbaa !11
  br label %98

98:                                               ; preds = %282, %91
  %99 = load i64, ptr %10, align 8, !tbaa !11
  %100 = icmp ugt i64 %99, 0
  br i1 %100, label %101, label %297

101:                                              ; preds = %98
  %102 = load i64, ptr %10, align 8, !tbaa !11
  %103 = load i64, ptr %19, align 8, !tbaa !11
  %104 = udiv i64 %102, %103
  store i64 %104, ptr %17, align 8, !tbaa !11
  %105 = load i64, ptr %17, align 8, !tbaa !11
  %106 = load i64, ptr %22, align 8, !tbaa !11
  %107 = icmp ugt i64 %105, %106
  br i1 %107, label %108, label %110

108:                                              ; preds = %101
  %109 = load i64, ptr %22, align 8, !tbaa !11
  br label %112

110:                                              ; preds = %101
  %111 = load i64, ptr %17, align 8, !tbaa !11
  br label %112

112:                                              ; preds = %110, %108
  %113 = phi i64 [ %109, %108 ], [ %111, %110 ]
  store i64 %113, ptr %17, align 8, !tbaa !11
  %114 = load ptr, ptr %14, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %114, i32 0, i32 0
  store i8 32, ptr %115, align 1, !tbaa !24
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %116, i32 0, i32 1
  store i8 0, ptr %117, align 1, !tbaa !26
  %118 = load i64, ptr %17, align 8, !tbaa !11
  %119 = trunc i64 %118 to i8
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %120, i32 0, i32 2
  store i8 %119, ptr %121, align 1, !tbaa !27
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %122, i32 0, i32 3
  store i8 0, ptr %123, align 1, !tbaa !28
  %124 = load ptr, ptr %14, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %124, i32 0, i32 4
  store i32 -1, ptr %125, align 1, !tbaa !29
  %126 = load i64, ptr %9, align 8, !tbaa !11
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %127, i32 0, i32 5
  store i64 %126, ptr %128, align 1, !tbaa !30
  %129 = load i64, ptr %16, align 8, !tbaa !11
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %130, i32 0, i32 6
  store i64 %129, ptr %131, align 1, !tbaa !31
  %132 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  store i8 67, ptr %132, align 1, !tbaa !32
  %133 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 0
  store i8 0, ptr %133, align 4, !tbaa !32
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %134, i32 0, i32 8
  %136 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %135, i32 0, i32 1
  %137 = load i8, ptr %136, align 1, !tbaa !33
  %138 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 9
  store i8 %137, ptr %138, align 4, !tbaa !32
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = ptrtoint ptr %139 to i64
  %141 = trunc i64 %140 to i16
  %142 = zext i16 %141 to i32
  %143 = and i32 %142, 65535
  %144 = trunc i32 %143 to i16
  %145 = getelementptr inbounds %struct.EFI_WORD_REGS, ptr %15, i32 0, i32 8
  store i16 %144, ptr %145, align 4, !tbaa !32
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = ptrtoint ptr %146 to i64
  %148 = lshr i64 %147, 4
  %149 = trunc i64 %148 to i16
  %150 = zext i16 %149 to i32
  %151 = and i32 %150, 61440
  %152 = trunc i32 %151 to i16
  %153 = getelementptr inbounds %struct.EFI_WORD_REGS, ptr %15, i32 0, i32 17
  store i16 %152, ptr %153, align 2, !tbaa !32
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %154, i32 0, i32 7
  %156 = load ptr, ptr %155, align 8, !tbaa !34
  %157 = getelementptr inbounds %struct._EFI_LEGACY_BIOS_PROTOCOL, ptr %156, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !35
  %159 = load ptr, ptr %13, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %159, i32 0, i32 7
  %161 = load ptr, ptr %160, align 8, !tbaa !34
  %162 = call zeroext i8 %158(ptr noundef %161, i8 noundef zeroext 19, ptr noundef %15)
  %163 = zext i8 %162 to i64
  store i64 %163, ptr %21, align 8, !tbaa !11
  br label %164

164:                                              ; preds = %112
  %165 = call zeroext i8 @DebugPrintEnabled()
  %166 = icmp ne i8 %165, 0
  br i1 %166, label %167, label %184

167:                                              ; preds = %164
  br label %168

168:                                              ; preds = %167
  %169 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096)
  %170 = icmp ne i8 %169, 0
  br i1 %170, label %171, label %181

171:                                              ; preds = %168
  %172 = load ptr, ptr %13, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %172, i32 0, i32 8
  %174 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %173, i32 0, i32 1
  %175 = load i8, ptr %174, align 1, !tbaa !33
  %176 = zext i8 %175 to i32
  %177 = load i64, ptr %21, align 8, !tbaa !11
  %178 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  %179 = load i8, ptr %178, align 1, !tbaa !32
  %180 = zext i8 %179 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef @.str.10, i32 noundef %176, i64 noundef %177, i32 noundef %180)
  br label %181

181:                                              ; preds = %171, %168
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183, %164
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %187, i32 0, i32 2
  store i8 1, ptr %188, align 1, !tbaa !37
  %189 = load i64, ptr %21, align 8, !tbaa !11
  %190 = icmp ne i64 %189, 0
  br i1 %190, label %191, label %282

191:                                              ; preds = %186
  %192 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  %193 = load i8, ptr %192, align 1, !tbaa !32
  %194 = load ptr, ptr %13, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %194, i32 0, i32 8
  %196 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %195, i32 0, i32 8
  store i8 %193, ptr %196, align 8, !tbaa !38
  %197 = load ptr, ptr %13, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %197, i32 0, i32 8
  %199 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %198, i32 0, i32 8
  %200 = load i8, ptr %199, align 8, !tbaa !38
  %201 = zext i8 %200 to i32
  %202 = icmp eq i32 %201, 6
  br i1 %202, label %203, label %262

203:                                              ; preds = %191
  %204 = load ptr, ptr %12, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %204, i32 0, i32 0
  %206 = load i32, ptr %205, align 8, !tbaa !17
  %207 = add i32 %206, 1
  store i32 %207, ptr %205, align 8, !tbaa !17
  %208 = load ptr, ptr %13, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %208, i32 0, i32 8
  store ptr %209, ptr %20, align 8, !tbaa !5
  %210 = load ptr, ptr %13, align 8, !tbaa !5
  %211 = load ptr, ptr %20, align 8, !tbaa !5
  %212 = call i64 @Int13GetDeviceParameters(ptr noundef %210, ptr noundef %211)
  %213 = icmp ne i64 %212, 0
  br i1 %213, label %214, label %261

214:                                              ; preds = %203
  %215 = load ptr, ptr %13, align 8, !tbaa !5
  %216 = load ptr, ptr %20, align 8, !tbaa !5
  %217 = call i64 @Int13Extensions(ptr noundef %215, ptr noundef %216)
  %218 = icmp ne i64 %217, 0
  br i1 %218, label %219, label %234

219:                                              ; preds = %214
  %220 = load ptr, ptr %20, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %220, i32 0, i32 16
  %222 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %221, i32 0, i32 5
  %223 = load i64, ptr %222, align 8, !tbaa !39
  %224 = sub i64 %223, 1
  %225 = load ptr, ptr %12, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %225, i32 0, i32 8
  store i64 %224, ptr %226, align 8, !tbaa !18
  %227 = load ptr, ptr %20, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %227, i32 0, i32 16
  %229 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %228, i32 0, i32 6
  %230 = load i16, ptr %229, align 8, !tbaa !40
  %231 = zext i16 %230 to i32
  %232 = load ptr, ptr %12, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %232, i32 0, i32 6
  store i32 %231, ptr %233, align 4, !tbaa !15
  br label %242

234:                                              ; preds = %214
  br label %235

235:                                              ; preds = %234
  %236 = call zeroext i8 @DebugAssertEnabled()
  %237 = icmp ne i8 %236, 0
  br i1 %237, label %238, label %239

238:                                              ; preds = %235
  call void @DebugAssert(ptr noundef @.str.5, i64 noundef 667, ptr noundef @.str.9)
  br label %239

239:                                              ; preds = %238, %235
  br label %240

240:                                              ; preds = %239
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241, %219
  %243 = load ptr, ptr %12, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %243, i32 0, i32 4
  store i8 0, ptr %244, align 1, !tbaa !41
  %245 = load ptr, ptr @gBS, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %245, i32 0, i32 17
  %247 = load ptr, ptr %246, align 8, !tbaa !42
  %248 = load ptr, ptr %13, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %248, i32 0, i32 1
  %250 = load ptr, ptr %249, align 8, !tbaa !45
  %251 = call i64 %247(ptr noundef %250, ptr noundef @gEfiBlockIoProtocolGuid, ptr noundef %23)
  %252 = load ptr, ptr @gBS, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %252, i32 0, i32 15
  %254 = load ptr, ptr %253, align 8, !tbaa !46
  %255 = load ptr, ptr %13, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %255, i32 0, i32 1
  %257 = load ptr, ptr %256, align 8, !tbaa !45
  %258 = load ptr, ptr %23, align 8, !tbaa !5
  %259 = load ptr, ptr %23, align 8, !tbaa !5
  %260 = call i64 %254(ptr noundef %257, ptr noundef @gEfiBlockIoProtocolGuid, ptr noundef %258, ptr noundef %259)
  store i64 -9223372036854775795, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

261:                                              ; preds = %203
  br label %273

262:                                              ; preds = %191
  %263 = load ptr, ptr %13, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %263, i32 0, i32 8
  %265 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %264, i32 0, i32 8
  %266 = load i8, ptr %265, align 8, !tbaa !38
  %267 = zext i8 %266 to i32
  %268 = icmp eq i32 %267, 3
  br i1 %268, label %269, label %272

269:                                              ; preds = %262
  %270 = load ptr, ptr %12, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %270, i32 0, i32 4
  store i8 1, ptr %271, align 1, !tbaa !41
  store i64 -9223372036854775800, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

272:                                              ; preds = %262
  br label %273

273:                                              ; preds = %272, %261
  %274 = load ptr, ptr %12, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %274, i32 0, i32 1
  %276 = load i8, ptr %275, align 4, !tbaa !47
  %277 = icmp ne i8 %276, 0
  br i1 %277, label %278, label %281

278:                                              ; preds = %273
  %279 = load ptr, ptr %12, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %279, i32 0, i32 2
  store i8 0, ptr %280, align 1, !tbaa !37
  br label %281

281:                                              ; preds = %278, %273
  store i64 -9223372036854775801, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

282:                                              ; preds = %186
  %283 = load ptr, ptr %12, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %283, i32 0, i32 4
  store i8 0, ptr %284, align 1, !tbaa !41
  %285 = load i64, ptr %17, align 8, !tbaa !11
  %286 = load i64, ptr %19, align 8, !tbaa !11
  %287 = mul i64 %285, %286
  store i64 %287, ptr %18, align 8, !tbaa !11
  %288 = load i64, ptr %10, align 8, !tbaa !11
  %289 = load i64, ptr %18, align 8, !tbaa !11
  %290 = sub i64 %288, %289
  store i64 %290, ptr %10, align 8, !tbaa !11
  %291 = load i64, ptr %18, align 8, !tbaa !11
  %292 = load i64, ptr %16, align 8, !tbaa !11
  %293 = add i64 %292, %291
  store i64 %293, ptr %16, align 8, !tbaa !11
  %294 = load i64, ptr %17, align 8, !tbaa !11
  %295 = load i64, ptr %9, align 8, !tbaa !11
  %296 = add i64 %295, %294
  store i64 %296, ptr %9, align 8, !tbaa !11
  br label %98, !llvm.loop !48

297:                                              ; preds = %98
  store i64 0, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %298

298:                                              ; preds = %297, %281, %269, %242, %71, %67, %63, %57, %45, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %299 = load i64, ptr %6, align 8
  ret i64 %299
}

; 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) #2

declare zeroext i8 @DebugAssertEnabled() #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"_EFI_BLOCK_IO_PROTOCOL", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!16, !10, i64 12}
!16 = !{!"", !10, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !10, i64 12, !10, i64 16, !12, i64 24, !12, i64 32, !10, i64 40, !10, i64 44}
!17 = !{!16, !10, i64 0}
!18 = !{!16, !12, i64 24}
!19 = !{!20, !12, i64 0}
!20 = !{!"", !12, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !16, i64 72, !6, i64 120, !6, i64 128, !6, i64 136, !21, i64 144}
!21 = !{!"", !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, !6, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !22, i64 28, !22, i64 30, !23, i64 32}
!22 = !{!"short", !7, i64 0}
!23 = !{!"", !22, i64 0, !22, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !12, i64 16, !22, i64 24, !10, i64 26, !22, i64 30, !7, i64 32, !7, i64 33, !22, i64 34, !7, i64 36, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 72, !7, i64 73}
!24 = !{!25, !7, i64 0}
!25 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !10, i64 4, !12, i64 8, !12, i64 16, !10, i64 24, !10, i64 28}
!26 = !{!25, !7, i64 1}
!27 = !{!25, !7, i64 2}
!28 = !{!25, !7, i64 3}
!29 = !{!25, !10, i64 4}
!30 = !{!25, !12, i64 8}
!31 = !{!25, !12, i64 16}
!32 = !{!7, !7, i64 0}
!33 = !{!20, !7, i64 145}
!34 = !{!20, !6, i64 136}
!35 = !{!36, !6, i64 0}
!36 = !{!"_EFI_LEGACY_BIOS_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, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!37 = !{!16, !7, i64 5}
!38 = !{!20, !7, i64 152}
!39 = !{!21, !12, i64 48}
!40 = !{!21, !22, i64 56}
!41 = !{!16, !7, i64 7}
!42 = !{!43, !6, i64 152}
!43 = !{!"", !44, 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}
!44 = !{!"", !12, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!45 = !{!20, !6, i64 8}
!46 = !{!43, !6, i64 136}
!47 = !{!16, !7, i64 4}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}


; 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.GUID = type { i32, i16, i16, [8 x i8] }
%union.EFI_IA32_REGISTER_SET = type { %struct.EFI_DWORD_REGS }
%struct.EFI_DWORD_REGS = type { i32, i32, i32, i32, i32, i32, %struct.EFI_EFLAGS_REG, i16, i16, i16, i16, i16, i16, i32, i32 }
%struct.EFI_EFLAGS_REG = type { i32 }

@.str.5 = external hidden unnamed_addr constant [162 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@mEddBufferUnder1Mb = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiBlockIoProtocolGuid = external global %struct.GUID, align 4
@.str.10 = external hidden unnamed_addr constant [57 x i8], align 1

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

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

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @Edd30BiosWriteBlocks(ptr noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %6 = alloca %union.EFI_IA32_REGISTER_SET, align 4
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = zext i32 %11 to i64
  %13 = call ptr @ZeroMem(ptr noundef nonnull %6, i64 noundef 48) #4
  %14 = load i32, ptr %9, align 8, !tbaa !14
  %.not = icmp eq i32 %14, %1
  br i1 %.not, label %15, label %.loopexit

15:                                               ; preds = %5
  %16 = getelementptr inbounds i8, ptr %9, i64 24
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = icmp ult i64 %17, %2
  br i1 %18, label %.loopexit, label %19

19:                                               ; preds = %15
  %20 = udiv i64 %3, %12
  %21 = urem i64 %3, %12
  %22 = add i64 %2, -1
  %23 = add i64 %22, %20
  %24 = icmp ugt i64 %23, %17
  br i1 %24, label %.loopexit, label %25

25:                                               ; preds = %19
  %.not81 = icmp eq i64 %21, 0
  br i1 %.not81, label %26, label %.loopexit

26:                                               ; preds = %25
  %27 = icmp eq ptr %4, null
  br i1 %27, label %.loopexit, label %28

28:                                               ; preds = %26
  %29 = icmp eq i64 %3, 0
  br i1 %29, label %.loopexit, label %30

30:                                               ; preds = %28
  %31 = call zeroext i8 @DebugAssertEnabled() #4
  %.not82 = icmp eq i8 %31, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre97 = add i64 %.pre, -24
  %.pre99 = inttoptr i64 %.pre97 to ptr
  br i1 %.not82, label %._crit_edge, label %32

32:                                               ; preds = %30
  %33 = load i64, ptr %.pre99, align 8, !tbaa !16
  %.not83 = icmp eq i64 %33, 1869177442
  br i1 %.not83, label %._crit_edge, label %34

34:                                               ; preds = %32
  call void @DebugAssert(ptr noundef nonnull @.str.5, i64 noundef 616, ptr noundef nonnull @.str.7) #4
  br label %._crit_edge

._crit_edge:                                      ; preds = %30, %32, %34
  %35 = phi ptr [ %0, %34 ], [ %.pre99, %32 ], [ %.pre99, %30 ]
  %36 = load ptr, ptr @mEddBufferUnder1Mb, align 8, !tbaa !21
  %37 = udiv i32 65024, %11
  %.zext = zext nneg i32 %37 to i64
  %38 = ptrtoint ptr %4 to i64
  %39 = getelementptr inbounds i8, ptr %36, i64 1
  %40 = getelementptr inbounds i8, ptr %36, i64 2
  %41 = getelementptr inbounds i8, ptr %36, i64 3
  %42 = getelementptr inbounds i8, ptr %36, i64 4
  %43 = getelementptr inbounds i8, ptr %36, i64 8
  %44 = getelementptr inbounds i8, ptr %36, i64 16
  %45 = getelementptr inbounds i8, ptr %6, i64 1
  %46 = getelementptr inbounds i8, ptr %35, i64 145
  %47 = getelementptr inbounds i8, ptr %6, i64 12
  %48 = ptrtoint ptr %36 to i64
  %49 = trunc i64 %48 to i16
  %50 = getelementptr inbounds i8, ptr %6, i64 16
  %51 = lshr i64 %48, 4
  %52 = trunc i64 %51 to i16
  %53 = and i16 %52, -4096
  %54 = getelementptr inbounds i8, ptr %6, i64 34
  %55 = getelementptr inbounds i8, ptr %35, i64 136
  %56 = getelementptr inbounds i8, ptr %9, i64 5
  %57 = getelementptr inbounds i8, ptr %9, i64 7
  br label %58

58:                                               ; preds = %._crit_edge, %114
  %.07396 = phi i64 [ %2, %._crit_edge ], [ %118, %114 ]
  %.07495 = phi i64 [ %3, %._crit_edge ], [ %116, %114 ]
  %.07594 = phi i64 [ %38, %._crit_edge ], [ %117, %114 ]
  %59 = udiv i64 %.07495, %12
  %60 = call i64 @llvm.umin.i64(i64 %59, i64 %.zext)
  store i8 32, ptr %36, align 1, !tbaa !22
  store i8 0, ptr %39, align 1, !tbaa !24
  %61 = trunc i64 %60 to i8
  store i8 %61, ptr %40, align 1, !tbaa !25
  store i8 0, ptr %41, align 1, !tbaa !26
  store i32 -1, ptr %42, align 1, !tbaa !27
  store i64 %.07396, ptr %43, align 1, !tbaa !28
  store i64 %.07594, ptr %44, align 1, !tbaa !29
  store i8 67, ptr %45, align 1, !tbaa !30
  store i8 0, ptr %6, align 4, !tbaa !30
  %62 = load i8, ptr %46, align 1, !tbaa !31
  store i8 %62, ptr %47, align 4, !tbaa !30
  store i16 %49, ptr %50, align 4, !tbaa !30
  store i16 %53, ptr %54, align 2, !tbaa !30
  %63 = load ptr, ptr %55, align 8, !tbaa !32
  %64 = load ptr, ptr %63, align 8, !tbaa !33
  %65 = call zeroext i8 %64(ptr noundef nonnull %63, i8 noundef zeroext 19, ptr noundef nonnull %6) #4
  %66 = zext i8 %65 to i64
  %67 = call zeroext i8 @DebugPrintEnabled() #4
  %.not85 = icmp eq i8 %67, 0
  br i1 %.not85, label %75, label %68

68:                                               ; preds = %58
  %69 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096) #4
  %.not86 = icmp eq i8 %69, 0
  br i1 %.not86, label %75, label %70

70:                                               ; preds = %68
  %71 = load i8, ptr %46, align 1, !tbaa !31
  %72 = zext i8 %71 to i32
  %73 = load i8, ptr %45, align 1, !tbaa !30
  %74 = zext i8 %73 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef nonnull @.str.10, i32 noundef %72, i64 noundef %66, i32 noundef %74) #4
  br label %75

75:                                               ; preds = %68, %70, %58
  store i8 1, ptr %56, align 1, !tbaa !35
  %.not87 = icmp eq i8 %65, 0
  br i1 %.not87, label %114, label %76

76:                                               ; preds = %75
  %77 = getelementptr inbounds i8, ptr %35, i64 144
  %78 = load i8, ptr %45, align 1, !tbaa !30
  %79 = getelementptr inbounds i8, ptr %35, i64 152
  store i8 %78, ptr %79, align 8, !tbaa !36
  switch i8 %78, label %110 [
    i8 6, label %80
    i8 3, label %109
  ]

80:                                               ; preds = %76
  %81 = load i32, ptr %9, align 8, !tbaa !14
  %82 = add i32 %81, 1
  store i32 %82, ptr %9, align 8, !tbaa !14
  %83 = call i64 @Int13GetDeviceParameters(ptr noundef nonnull %35, ptr noundef nonnull %77)
  %.not88 = icmp eq i64 %83, 0
  br i1 %.not88, label %110, label %84

84:                                               ; preds = %80
  %85 = call i64 @Int13Extensions(ptr noundef nonnull %35, ptr noundef nonnull %77)
  %.not90 = icmp eq i64 %85, 0
  br i1 %.not90, label %93, label %86

86:                                               ; preds = %84
  %87 = getelementptr inbounds i8, ptr %35, i64 192
  %88 = load i64, ptr %87, align 8, !tbaa !37
  %89 = add i64 %88, -1
  store i64 %89, ptr %16, align 8, !tbaa !15
  %90 = getelementptr inbounds i8, ptr %35, i64 200
  %91 = load i16, ptr %90, align 8, !tbaa !38
  %92 = zext i16 %91 to i32
  store i32 %92, ptr %10, align 4, !tbaa !11
  br label %96

93:                                               ; preds = %84
  %94 = call zeroext i8 @DebugAssertEnabled() #4
  %.not91 = icmp eq i8 %94, 0
  br i1 %.not91, label %96, label %95

95:                                               ; preds = %93
  call void @DebugAssert(ptr noundef nonnull @.str.5, i64 noundef 667, ptr noundef nonnull @.str.9) #4
  br label %96

96:                                               ; preds = %93, %95, %86
  store i8 0, ptr %57, align 1, !tbaa !39
  %97 = load ptr, ptr @gBS, align 8, !tbaa !21
  %98 = getelementptr inbounds i8, ptr %97, i64 152
  %99 = load ptr, ptr %98, align 8, !tbaa !40
  %100 = getelementptr inbounds i8, ptr %35, i64 8
  %101 = load ptr, ptr %100, align 8, !tbaa !43
  %102 = call i64 %99(ptr noundef %101, ptr noundef nonnull @gEfiBlockIoProtocolGuid, ptr noundef nonnull %7) #4
  %103 = load ptr, ptr @gBS, align 8, !tbaa !21
  %104 = getelementptr inbounds i8, ptr %103, i64 136
  %105 = load ptr, ptr %104, align 8, !tbaa !44
  %106 = load ptr, ptr %100, align 8, !tbaa !43
  %107 = load ptr, ptr %7, align 8, !tbaa !21
  %108 = call i64 %105(ptr noundef %106, ptr noundef nonnull @gEfiBlockIoProtocolGuid, ptr noundef %107, ptr noundef %107) #4
  br label %.loopexit

109:                                              ; preds = %76
  store i8 1, ptr %57, align 1, !tbaa !39
  br label %.loopexit

110:                                              ; preds = %76, %80
  %111 = getelementptr inbounds i8, ptr %9, i64 4
  %112 = load i8, ptr %111, align 4, !tbaa !45
  %.not89 = icmp eq i8 %112, 0
  br i1 %.not89, label %.loopexit, label %113

113:                                              ; preds = %110
  store i8 0, ptr %56, align 1, !tbaa !35
  br label %.loopexit

114:                                              ; preds = %75
  store i8 0, ptr %57, align 1, !tbaa !39
  %115 = mul nuw nsw i64 %60, %12
  %116 = sub i64 %.07495, %115
  %117 = add i64 %115, %.07594
  %118 = add i64 %60, %.07396
  %.not84 = icmp eq i64 %116, 0
  br i1 %.not84, label %.loopexit, label %58, !llvm.loop !46

.loopexit:                                        ; preds = %114, %110, %113, %28, %26, %25, %19, %15, %5, %109, %96
  %.0 = phi i64 [ -9223372036854775795, %96 ], [ -9223372036854775800, %109 ], [ -9223372036854775795, %5 ], [ -9223372036854775801, %15 ], [ -9223372036854775806, %19 ], [ -9223372036854775804, %25 ], [ -9223372036854775806, %26 ], [ 0, %28 ], [ -9223372036854775801, %113 ], [ -9223372036854775801, %110 ], [ 0, %114 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #4
  ret i64 %.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 #2

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #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 nosync nounwind speculatable willreturn memory(none) }
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 8}
!6 = !{!"_EFI_BLOCK_IO_PROTOCOL", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!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, !13, i64 12}
!12 = !{!"", !13, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !13, i64 12, !13, i64 16, !7, i64 24, !7, i64 32, !13, i64 40, !13, i64 44}
!13 = !{!"int", !8, i64 0}
!14 = !{!12, !13, i64 0}
!15 = !{!12, !7, i64 24}
!16 = !{!17, !7, i64 0}
!17 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !12, i64 72, !10, i64 120, !10, i64 128, !10, i64 136, !18, i64 144}
!18 = !{!"", !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, !10, i64 16, !8, i64 24, !8, i64 25, !8, i64 26, !8, i64 27, !19, i64 28, !19, i64 30, !20, i64 32}
!19 = !{!"short", !8, i64 0}
!20 = !{!"", !19, i64 0, !19, i64 2, !13, i64 4, !13, i64 8, !13, i64 12, !7, i64 16, !19, i64 24, !13, i64 26, !19, i64 30, !8, i64 32, !8, i64 33, !19, i64 34, !8, i64 36, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 72, !8, i64 73}
!21 = !{!10, !10, i64 0}
!22 = !{!23, !8, i64 0}
!23 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !13, i64 4, !7, i64 8, !7, i64 16, !13, i64 24, !13, i64 28}
!24 = !{!23, !8, i64 1}
!25 = !{!23, !8, i64 2}
!26 = !{!23, !8, i64 3}
!27 = !{!23, !13, i64 4}
!28 = !{!23, !7, i64 8}
!29 = !{!23, !7, i64 16}
!30 = !{!8, !8, i64 0}
!31 = !{!17, !8, i64 145}
!32 = !{!17, !10, i64 136}
!33 = !{!34, !10, i64 0}
!34 = !{!"_EFI_LEGACY_BIOS_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, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!35 = !{!12, !8, i64 5}
!36 = !{!17, !8, i64 152}
!37 = !{!18, !7, i64 48}
!38 = !{!18, !19, i64 56}
!39 = !{!12, !8, i64 7}
!40 = !{!41, !10, i64 152}
!41 = !{!"", !42, i64 0, !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, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368}
!42 = !{!"", !7, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!43 = !{!17, !10, i64 8}
!44 = !{!41, !10, i64 136}
!45 = !{!12, !8, i64 4}
!46 = distinct !{!46, !47}
!47 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass