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

; 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
@mEdd11Buffer = external global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [84 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 @Edd11BiosWriteBlocks(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 %306

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 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %306

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 %306

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 %306

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 %306

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 %306

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 1004, 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 @mEdd11Buffer, align 8, !tbaa !5
  %97 = ptrtoint ptr %96 to i64
  store i64 %97, ptr %16, align 8, !tbaa !11
  br label %98

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

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 i64, ptr %16, align 8, !tbaa !11
  %125 = lshr i64 %124, 4
  %126 = shl i64 %125, 16
  %127 = trunc i64 %126 to i32
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %128, i32 0, i32 4
  store i32 %127, ptr %129, align 1, !tbaa !29
  %130 = load i64, ptr %9, align 8, !tbaa !11
  %131 = load ptr, ptr %14, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.EDD_DEVICE_ADDRESS_PACKET, ptr %131, i32 0, i32 5
  store i64 %130, ptr %132, align 1, !tbaa !30
  %133 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  store i8 67, ptr %133, align 1, !tbaa !31
  %134 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 0
  store i8 0, ptr %134, align 4, !tbaa !31
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %135, i32 0, i32 8
  %137 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %136, i32 0, i32 1
  %138 = load i8, ptr %137, align 1, !tbaa !32
  %139 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 9
  store i8 %138, ptr %139, align 4, !tbaa !31
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = ptrtoint ptr %140 to i64
  %142 = trunc i64 %141 to i16
  %143 = zext i16 %142 to i32
  %144 = and i32 %143, 65535
  %145 = trunc i32 %144 to i16
  %146 = getelementptr inbounds %struct.EFI_WORD_REGS, ptr %15, i32 0, i32 8
  store i16 %145, ptr %146, align 4, !tbaa !31
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = ptrtoint ptr %147 to i64
  %149 = lshr i64 %148, 4
  %150 = trunc i64 %149 to i16
  %151 = zext i16 %150 to i32
  %152 = and i32 %151, 61440
  %153 = trunc i32 %152 to i16
  %154 = getelementptr inbounds %struct.EFI_WORD_REGS, ptr %15, i32 0, i32 17
  store i16 %153, ptr %154, align 2, !tbaa !31
  %155 = load i64, ptr %17, align 8, !tbaa !11
  %156 = load i64, ptr %19, align 8, !tbaa !11
  %157 = mul i64 %155, %156
  store i64 %157, ptr %18, align 8, !tbaa !11
  %158 = load i64, ptr %16, align 8, !tbaa !11
  %159 = inttoptr i64 %158 to ptr
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = load i64, ptr %18, align 8, !tbaa !11
  %162 = call ptr @CopyMem(ptr noundef %159, ptr noundef %160, i64 noundef %161)
  %163 = load ptr, ptr %13, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %163, i32 0, i32 7
  %165 = load ptr, ptr %164, align 8, !tbaa !33
  %166 = getelementptr inbounds %struct._EFI_LEGACY_BIOS_PROTOCOL, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !34
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %168, i32 0, i32 7
  %170 = load ptr, ptr %169, align 8, !tbaa !33
  %171 = call zeroext i8 %167(ptr noundef %170, i8 noundef zeroext 19, ptr noundef %15)
  %172 = zext i8 %171 to i64
  store i64 %172, ptr %21, align 8, !tbaa !11
  br label %173

173:                                              ; preds = %112
  %174 = call zeroext i8 @DebugPrintEnabled()
  %175 = icmp ne i8 %174, 0
  br i1 %175, label %176, label %195

176:                                              ; preds = %173
  br label %177

177:                                              ; preds = %176
  %178 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096)
  %179 = icmp ne i8 %178, 0
  br i1 %179, label %180, label %192

180:                                              ; preds = %177
  %181 = load ptr, ptr %13, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %181, i32 0, i32 8
  %183 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %182, i32 0, i32 1
  %184 = load i8, ptr %183, align 1, !tbaa !32
  %185 = zext i8 %184 to i32
  %186 = load i64, ptr %21, align 8, !tbaa !11
  %187 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  %188 = load i8, ptr %187, align 1, !tbaa !31
  %189 = zext i8 %188 to i32
  %190 = load i64, ptr %9, align 8, !tbaa !11
  %191 = load i64, ptr %17, align 8, !tbaa !11
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef @.str.13, i32 noundef %185, i64 noundef %186, i32 noundef %189, i64 noundef %190, i64 noundef %191)
  br label %192

192:                                              ; preds = %180, %177
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194, %173
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  %198 = load ptr, ptr %12, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %198, i32 0, i32 2
  store i8 1, ptr %199, align 1, !tbaa !36
  %200 = load i64, ptr %21, align 8, !tbaa !11
  %201 = icmp ne i64 %200, 0
  br i1 %201, label %202, label %293

202:                                              ; preds = %197
  %203 = getelementptr inbounds %struct.EFI_BYTE_REGS, ptr %15, i32 0, i32 1
  %204 = load i8, ptr %203, align 1, !tbaa !31
  %205 = load ptr, ptr %13, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %205, i32 0, i32 8
  %207 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %206, i32 0, i32 8
  store i8 %204, ptr %207, align 8, !tbaa !37
  %208 = load ptr, ptr %13, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %208, i32 0, i32 8
  %210 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %209, i32 0, i32 8
  %211 = load i8, ptr %210, align 8, !tbaa !37
  %212 = zext i8 %211 to i32
  %213 = icmp eq i32 %212, 6
  br i1 %213, label %214, label %273

214:                                              ; preds = %202
  %215 = load ptr, ptr %12, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %215, i32 0, i32 0
  %217 = load i32, ptr %216, align 8, !tbaa !17
  %218 = add i32 %217, 1
  store i32 %218, ptr %216, align 8, !tbaa !17
  %219 = load ptr, ptr %13, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %219, i32 0, i32 8
  store ptr %220, ptr %20, align 8, !tbaa !5
  %221 = load ptr, ptr %13, align 8, !tbaa !5
  %222 = load ptr, ptr %20, align 8, !tbaa !5
  %223 = call i64 @Int13GetDeviceParameters(ptr noundef %221, ptr noundef %222)
  %224 = icmp ne i64 %223, 0
  br i1 %224, label %225, label %272

225:                                              ; preds = %214
  %226 = load ptr, ptr %13, align 8, !tbaa !5
  %227 = load ptr, ptr %20, align 8, !tbaa !5
  %228 = call i64 @Int13Extensions(ptr noundef %226, ptr noundef %227)
  %229 = icmp ne i64 %228, 0
  br i1 %229, label %230, label %245

230:                                              ; preds = %225
  %231 = load ptr, ptr %20, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %231, i32 0, i32 16
  %233 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %232, i32 0, i32 5
  %234 = load i64, ptr %233, align 8, !tbaa !38
  %235 = sub i64 %234, 1
  %236 = load ptr, ptr %12, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %236, i32 0, i32 8
  store i64 %235, ptr %237, align 8, !tbaa !18
  %238 = load ptr, ptr %20, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %238, i32 0, i32 16
  %240 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %239, i32 0, i32 6
  %241 = load i16, ptr %240, align 8, !tbaa !39
  %242 = zext i16 %241 to i32
  %243 = load ptr, ptr %12, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %243, i32 0, i32 6
  store i32 %242, ptr %244, align 4, !tbaa !15
  br label %253

245:                                              ; preds = %225
  br label %246

246:                                              ; preds = %245
  %247 = call zeroext i8 @DebugAssertEnabled()
  %248 = icmp ne i8 %247, 0
  br i1 %248, label %249, label %250

249:                                              ; preds = %246
  call void @DebugAssert(ptr noundef @.str.5, i64 noundef 1062, ptr noundef @.str.9)
  br label %250

250:                                              ; preds = %249, %246
  br label %251

251:                                              ; preds = %250
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252, %230
  %254 = load ptr, ptr %12, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %254, i32 0, i32 4
  store i8 0, ptr %255, align 1, !tbaa !40
  %256 = load ptr, ptr @gBS, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %256, i32 0, i32 17
  %258 = load ptr, ptr %257, align 8, !tbaa !41
  %259 = load ptr, ptr %13, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %259, i32 0, i32 1
  %261 = load ptr, ptr %260, align 8, !tbaa !44
  %262 = call i64 %258(ptr noundef %261, ptr noundef @gEfiBlockIoProtocolGuid, ptr noundef %23)
  %263 = load ptr, ptr @gBS, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %263, i32 0, i32 15
  %265 = load ptr, ptr %264, align 8, !tbaa !45
  %266 = load ptr, ptr %13, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %266, i32 0, i32 1
  %268 = load ptr, ptr %267, align 8, !tbaa !44
  %269 = load ptr, ptr %23, align 8, !tbaa !5
  %270 = load ptr, ptr %23, align 8, !tbaa !5
  %271 = call i64 %265(ptr noundef %268, ptr noundef @gEfiBlockIoProtocolGuid, ptr noundef %269, ptr noundef %270)
  store i64 -9223372036854775795, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %306

272:                                              ; preds = %214
  br label %284

273:                                              ; preds = %202
  %274 = load ptr, ptr %13, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.BIOS_BLOCK_IO_DEV, ptr %274, i32 0, i32 8
  %276 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %275, i32 0, i32 8
  %277 = load i8, ptr %276, align 8, !tbaa !37
  %278 = zext i8 %277 to i32
  %279 = icmp eq i32 %278, 3
  br i1 %279, label %280, label %283

280:                                              ; preds = %273
  %281 = load ptr, ptr %12, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %281, i32 0, i32 4
  store i8 1, ptr %282, align 1, !tbaa !40
  store i64 -9223372036854775800, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %306

283:                                              ; preds = %273
  br label %284

284:                                              ; preds = %283, %272
  %285 = load ptr, ptr %12, align 8, !tbaa !5
  %286 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %285, i32 0, i32 1
  %287 = load i8, ptr %286, align 4, !tbaa !46
  %288 = icmp ne i8 %287, 0
  br i1 %288, label %289, label %292

289:                                              ; preds = %284
  %290 = load ptr, ptr %12, align 8, !tbaa !5
  %291 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %290, i32 0, i32 2
  store i8 0, ptr %291, align 1, !tbaa !36
  br label %292

292:                                              ; preds = %289, %284
  store i64 -9223372036854775801, ptr %6, align 8
  store i32 1, ptr %24, align 4
  br label %306

293:                                              ; preds = %197
  %294 = load ptr, ptr %12, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %294, i32 0, i32 4
  store i8 0, ptr %295, align 1, !tbaa !40
  %296 = load i64, ptr %10, align 8, !tbaa !11
  %297 = load i64, ptr %18, align 8, !tbaa !11
  %298 = sub i64 %296, %297
  store i64 %298, ptr %10, align 8, !tbaa !11
  %299 = load ptr, ptr %11, align 8, !tbaa !5
  %300 = load i64, ptr %18, align 8, !tbaa !11
  %301 = getelementptr inbounds i8, ptr %299, i64 %300
  store ptr %301, ptr %11, align 8, !tbaa !5
  %302 = load i64, ptr %17, align 8, !tbaa !11
  %303 = load i64, ptr %9, align 8, !tbaa !11
  %304 = add i64 %303, %302
  store i64 %304, ptr %9, align 8, !tbaa !11
  br label %98, !llvm.loop !47

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

306:                                              ; preds = %305, %292, %280, %253, %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
  %307 = load i64, ptr %6, align 8
  ret i64 %307
}

; 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 ptr @CopyMem(ptr noundef, 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 = !{!7, !7, i64 0}
!32 = !{!20, !7, i64 145}
!33 = !{!20, !6, i64 136}
!34 = !{!35, !6, i64 0}
!35 = !{!"_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}
!36 = !{!16, !7, i64 5}
!37 = !{!20, !7, i64 152}
!38 = !{!21, !12, i64 48}
!39 = !{!21, !22, i64 56}
!40 = !{!16, !7, i64 7}
!41 = !{!42, !6, i64 152}
!42 = !{!"", !43, 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}
!43 = !{!"", !12, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!44 = !{!20, !6, i64 8}
!45 = !{!42, !6, i64 136}
!46 = !{!16, !7, i64 4}
!47 = distinct !{!47, !48}
!48 = !{!"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
@mEdd11Buffer = external local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [84 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 @Edd11BiosWriteBlocks(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
  %.not84 = icmp eq i64 %21, 0
  br i1 %.not84, 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
  %.not85 = icmp eq i8 %31, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre100 = add i64 %.pre, -24
  %.pre102 = inttoptr i64 %.pre100 to ptr
  br i1 %.not85, label %._crit_edge, label %32

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

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

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

60:                                               ; preds = %._crit_edge, %118
  %.07699 = phi i64 [ %2, %._crit_edge ], [ %121, %118 ]
  %.07798 = phi i64 [ %3, %._crit_edge ], [ %119, %118 ]
  %.07897 = phi ptr [ %4, %._crit_edge ], [ %120, %118 ]
  %61 = udiv i64 %.07798, %12
  %62 = call i64 @llvm.umin.i64(i64 %61, i64 %.zext)
  store i8 32, ptr %36, align 1, !tbaa !22
  store i8 0, ptr %40, align 1, !tbaa !24
  %63 = trunc i64 %62 to i8
  store i8 %63, ptr %41, align 1, !tbaa !25
  store i8 0, ptr %42, align 1, !tbaa !26
  store i32 %44, ptr %45, align 1, !tbaa !27
  store i64 %.07699, ptr %46, align 1, !tbaa !28
  store i8 67, ptr %47, align 1, !tbaa !29
  store i8 0, ptr %6, align 4, !tbaa !29
  %64 = load i8, ptr %48, align 1, !tbaa !30
  store i8 %64, ptr %49, align 4, !tbaa !29
  store i16 %51, ptr %52, align 4, !tbaa !29
  store i16 %55, ptr %56, align 2, !tbaa !29
  %65 = mul nuw nsw i64 %62, %12
  %66 = call ptr @CopyMem(ptr noundef %38, ptr noundef %.07897, i64 noundef %65) #4
  %67 = load ptr, ptr %57, align 8, !tbaa !31
  %68 = load ptr, ptr %67, align 8, !tbaa !32
  %69 = call zeroext i8 %68(ptr noundef nonnull %67, i8 noundef zeroext 19, ptr noundef nonnull %6) #4
  %70 = zext i8 %69 to i64
  %71 = call zeroext i8 @DebugPrintEnabled() #4
  %.not88 = icmp eq i8 %71, 0
  br i1 %.not88, label %79, label %72

72:                                               ; preds = %60
  %73 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096) #4
  %.not89 = icmp eq i8 %73, 0
  br i1 %.not89, label %79, label %74

74:                                               ; preds = %72
  %75 = load i8, ptr %48, align 1, !tbaa !30
  %76 = zext i8 %75 to i32
  %77 = load i8, ptr %47, align 1, !tbaa !29
  %78 = zext i8 %77 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef nonnull @.str.13, i32 noundef %76, i64 noundef %70, i32 noundef %78, i64 noundef %.07699, i64 noundef %62) #4
  br label %79

79:                                               ; preds = %72, %74, %60
  store i8 1, ptr %58, align 1, !tbaa !34
  %.not90 = icmp eq i8 %69, 0
  br i1 %.not90, label %118, label %80

80:                                               ; preds = %79
  %81 = getelementptr inbounds i8, ptr %35, i64 144
  %82 = load i8, ptr %47, align 1, !tbaa !29
  %83 = getelementptr inbounds i8, ptr %35, i64 152
  store i8 %82, ptr %83, align 8, !tbaa !35
  switch i8 %82, label %114 [
    i8 6, label %84
    i8 3, label %113
  ]

84:                                               ; preds = %80
  %85 = load i32, ptr %9, align 8, !tbaa !14
  %86 = add i32 %85, 1
  store i32 %86, ptr %9, align 8, !tbaa !14
  %87 = call i64 @Int13GetDeviceParameters(ptr noundef nonnull %35, ptr noundef nonnull %81)
  %.not91 = icmp eq i64 %87, 0
  br i1 %.not91, label %114, label %88

88:                                               ; preds = %84
  %89 = call i64 @Int13Extensions(ptr noundef nonnull %35, ptr noundef nonnull %81)
  %.not93 = icmp eq i64 %89, 0
  br i1 %.not93, label %97, label %90

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

97:                                               ; preds = %88
  %98 = call zeroext i8 @DebugAssertEnabled() #4
  %.not94 = icmp eq i8 %98, 0
  br i1 %.not94, label %100, label %99

99:                                               ; preds = %97
  call void @DebugAssert(ptr noundef nonnull @.str.5, i64 noundef 1062, ptr noundef nonnull @.str.9) #4
  br label %100

100:                                              ; preds = %97, %99, %90
  store i8 0, ptr %59, align 1, !tbaa !38
  %101 = load ptr, ptr @gBS, align 8, !tbaa !21
  %102 = getelementptr inbounds i8, ptr %101, i64 152
  %103 = load ptr, ptr %102, align 8, !tbaa !39
  %104 = getelementptr inbounds i8, ptr %35, i64 8
  %105 = load ptr, ptr %104, align 8, !tbaa !42
  %106 = call i64 %103(ptr noundef %105, ptr noundef nonnull @gEfiBlockIoProtocolGuid, ptr noundef nonnull %7) #4
  %107 = load ptr, ptr @gBS, align 8, !tbaa !21
  %108 = getelementptr inbounds i8, ptr %107, i64 136
  %109 = load ptr, ptr %108, align 8, !tbaa !43
  %110 = load ptr, ptr %104, align 8, !tbaa !42
  %111 = load ptr, ptr %7, align 8, !tbaa !21
  %112 = call i64 %109(ptr noundef %110, ptr noundef nonnull @gEfiBlockIoProtocolGuid, ptr noundef %111, ptr noundef %111) #4
  br label %.loopexit

113:                                              ; preds = %80
  store i8 1, ptr %59, align 1, !tbaa !38
  br label %.loopexit

114:                                              ; preds = %80, %84
  %115 = getelementptr inbounds i8, ptr %9, i64 4
  %116 = load i8, ptr %115, align 4, !tbaa !44
  %.not92 = icmp eq i8 %116, 0
  br i1 %.not92, label %.loopexit, label %117

117:                                              ; preds = %114
  store i8 0, ptr %58, align 1, !tbaa !34
  br label %.loopexit

118:                                              ; preds = %79
  store i8 0, ptr %59, align 1, !tbaa !38
  %119 = sub i64 %.07798, %65
  %120 = getelementptr inbounds i8, ptr %.07897, i64 %65
  %121 = add i64 %62, %.07699
  %.not87 = icmp eq i64 %119, 0
  br i1 %.not87, label %.loopexit, label %60, !llvm.loop !45

.loopexit:                                        ; preds = %118, %114, %117, %28, %26, %25, %19, %15, %5, %113, %100
  %.0 = phi i64 [ -9223372036854775795, %100 ], [ -9223372036854775800, %113 ], [ -9223372036854775795, %5 ], [ -9223372036854775806, %15 ], [ -9223372036854775806, %19 ], [ -9223372036854775804, %25 ], [ -9223372036854775806, %26 ], [ 0, %28 ], [ -9223372036854775801, %117 ], [ -9223372036854775801, %114 ], [ 0, %118 ]
  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 ptr @CopyMem(ptr noundef, 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 = !{!8, !8, i64 0}
!30 = !{!17, !8, i64 145}
!31 = !{!17, !10, i64 136}
!32 = !{!33, !10, i64 0}
!33 = !{!"_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}
!34 = !{!12, !8, i64 5}
!35 = !{!17, !8, i64 152}
!36 = !{!18, !7, i64 48}
!37 = !{!18, !19, i64 56}
!38 = !{!12, !8, i64 7}
!39 = !{!40, !10, i64 152}
!40 = !{!"", !41, 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}
!41 = !{!"", !7, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!42 = !{!17, !10, i64 8}
!43 = !{!40, !10, i64 136}
!44 = !{!12, !8, i64 4}
!45 = distinct !{!45, !46}
!46 = !{!"llvm.loop.mustprogress"}


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