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

; 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_IMAGE_INPUT = type { i32, i16, i16, ptr }
%struct._HII_DATABASE_PRIVATE_DATA = type { i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._EFI_HII_FONT_PROTOCOL, %struct._EFI_HII_IMAGE_PROTOCOL, %struct._EFI_HII_STRING_PROTOCOL, %struct._EFI_HII_DATABASE_PROTOCOL, %struct._EFI_HII_CONFIG_ROUTING_PROTOCOL, %struct._LIST_ENTRY, i64, %struct._LIST_ENTRY, i64, %struct.GUID, ptr }
%struct._EFI_HII_FONT_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._EFI_HII_IMAGE_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr }
%struct._EFI_HII_STRING_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr }
%struct._EFI_HII_DATABASE_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_HII_CONFIG_ROUTING_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct._EFI_IMAGE_OUTPUT = type { i16, i16, %union.anon }
%union.anon = type { ptr }
%struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL = type { i8, i8, i8, i8 }
%struct._EFI_GRAPHICS_OUTPUT_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct._EFI_FONT_DISPLAY_INFO = type { %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, i32, %struct.EFI_FONT_INFO }
%struct.EFI_FONT_INFO = type { i32, i16, [1 x i16] }

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 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

declare zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #1

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

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

declare ptr @AllocateZeroPool(i64 noundef) #1

declare void @FreePool(ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @ImageToBlt(ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i8 noundef zeroext, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i64 @HiiDrawImage(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, i64 noundef %5) #3 {
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i64, align 8
  %29 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i64 %4, ptr %12, align 8, !tbaa !11
  store i64 %5, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %38, label %32

32:                                               ; preds = %6
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %38, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %35, %32, %6
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

39:                                               ; preds = %35
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = and i32 %40, 1
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %43, label %48

43:                                               ; preds = %39
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

48:                                               ; preds = %43, %39
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = and i32 %49, 48
  %51 = icmp eq i32 %50, 48
  br i1 %51, label %52, label %53

52:                                               ; preds = %48
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

53:                                               ; preds = %48
  store ptr null, ptr %27, align 8, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %54, ptr %17, align 8, !tbaa !5
  store i8 0, ptr %16, align 1, !tbaa !13
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = and i32 %55, 48
  %57 = icmp eq i32 %56, 16
  br i1 %57, label %58, label %59

58:                                               ; preds = %53
  store i8 1, ptr %16, align 1, !tbaa !13
  br label %73

59:                                               ; preds = %53
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = and i32 %60, 48
  %62 = icmp eq i32 %61, 32
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  store i8 0, ptr %16, align 1, !tbaa !13
  br label %72

64:                                               ; preds = %59
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !14
  %68 = and i32 %67, 1
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %70, label %71

70:                                               ; preds = %64
  store i8 1, ptr %16, align 1, !tbaa !13
  br label %71

71:                                               ; preds = %70, %64
  br label %72

72:                                               ; preds = %71, %63
  br label %73

73:                                               ; preds = %72, %58
  %74 = load i8, ptr %16, align 1, !tbaa !13
  %75 = icmp ne i8 %74, 0
  br i1 %75, label %76, label %88

76:                                               ; preds = %73
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = icmp eq ptr %78, null
  br i1 %79, label %80, label %81

80:                                               ; preds = %76
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

81:                                               ; preds = %76
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = and i32 %82, 128
  %84 = icmp eq i32 %83, 128
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i64 -9223372036854775806, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

86:                                               ; preds = %81
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87, %73
  %89 = call zeroext i8 @DebugAssertEnabled()
  %90 = zext i8 %89 to i32
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %102

92:                                               ; preds = %88
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = ptrtoint ptr %93 to i64
  %95 = sub i64 %94, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %96 = inttoptr i64 %95 to ptr
  %97 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %96, i32 0, i32 0
  %98 = load i64, ptr %97, align 8, !tbaa !17
  %99 = icmp ne i64 %98, 1883531592
  br i1 %99, label %100, label %102

100:                                              ; preds = %92
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1273, ptr noundef @.str.8)
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  br label %107

102:                                              ; preds = %92, %88
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = ptrtoint ptr %103 to i64
  %105 = sub i64 %104, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %106 = inttoptr i64 %105 to ptr
  br label %107

107:                                              ; preds = %102, %100
  %108 = phi ptr [ %101, %100 ], [ %106, %102 ]
  store ptr %108, ptr %15, align 8, !tbaa !5
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = load ptr, ptr %109, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %260

112:                                              ; preds = %107
  %113 = load ptr, ptr %17, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %113, i32 0, i32 1
  %115 = load i16, ptr %114, align 4, !tbaa !26
  %116 = zext i16 %115 to i64
  store i64 %116, ptr %21, align 8, !tbaa !11
  %117 = load ptr, ptr %17, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %117, i32 0, i32 2
  %119 = load i16, ptr %118, align 2, !tbaa !27
  %120 = zext i16 %119 to i64
  store i64 %120, ptr %22, align 8, !tbaa !11
  %121 = load i64, ptr %21, align 8, !tbaa !11
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = load ptr, ptr %122, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %123, i32 0, i32 0
  %125 = load i16, ptr %124, align 8, !tbaa !28
  %126 = zext i16 %125 to i64
  %127 = load i64, ptr %12, align 8, !tbaa !11
  %128 = sub i64 %126, %127
  %129 = icmp ugt i64 %121, %128
  br i1 %129, label %130, label %138

130:                                              ; preds = %112
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = load ptr, ptr %131, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %132, i32 0, i32 0
  %134 = load i16, ptr %133, align 8, !tbaa !28
  %135 = zext i16 %134 to i64
  %136 = load i64, ptr %12, align 8, !tbaa !11
  %137 = sub i64 %135, %136
  store i64 %137, ptr %21, align 8, !tbaa !11
  br label %138

138:                                              ; preds = %130, %112
  %139 = load i64, ptr %22, align 8, !tbaa !11
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %141, i32 0, i32 1
  %143 = load i16, ptr %142, align 2, !tbaa !30
  %144 = zext i16 %143 to i64
  %145 = load i64, ptr %13, align 8, !tbaa !11
  %146 = sub i64 %144, %145
  %147 = icmp ugt i64 %139, %146
  br i1 %147, label %148, label %156

148:                                              ; preds = %138
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %150, i32 0, i32 1
  %152 = load i16, ptr %151, align 2, !tbaa !30
  %153 = zext i16 %152 to i64
  %154 = load i64, ptr %13, align 8, !tbaa !11
  %155 = sub i64 %153, %154
  store i64 %155, ptr %22, align 8, !tbaa !11
  br label %156

156:                                              ; preds = %148, %138
  %157 = load i64, ptr %21, align 8, !tbaa !11
  %158 = load i64, ptr %22, align 8, !tbaa !11
  %159 = mul i64 %157, %158
  %160 = mul i64 %159, 4
  store i64 %160, ptr %20, align 8, !tbaa !11
  %161 = load i64, ptr %20, align 8, !tbaa !11
  %162 = call ptr @AllocateZeroPool(i64 noundef %161)
  store ptr %162, ptr %19, align 8, !tbaa !5
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = icmp eq ptr %163, null
  br i1 %164, label %165, label %166

165:                                              ; preds = %156
  store i64 -9223372036854775799, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

166:                                              ; preds = %156
  %167 = load i64, ptr %21, align 8, !tbaa !11
  %168 = load ptr, ptr %17, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %168, i32 0, i32 1
  %170 = load i16, ptr %169, align 4, !tbaa !26
  %171 = zext i16 %170 to i64
  %172 = icmp eq i64 %167, %171
  br i1 %172, label %173, label %187

173:                                              ; preds = %166
  %174 = load i64, ptr %22, align 8, !tbaa !11
  %175 = load ptr, ptr %17, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %175, i32 0, i32 2
  %177 = load i16, ptr %176, align 2, !tbaa !27
  %178 = zext i16 %177 to i64
  %179 = icmp eq i64 %174, %178
  br i1 %179, label %180, label %187

180:                                              ; preds = %173
  %181 = load ptr, ptr %19, align 8, !tbaa !5
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %182, i32 0, i32 3
  %184 = load ptr, ptr %183, align 8, !tbaa !31
  %185 = load i64, ptr %20, align 8, !tbaa !11
  %186 = call ptr @CopyMem(ptr noundef %181, ptr noundef %184, i64 noundef %185)
  br label %227

187:                                              ; preds = %173, %166
  store i64 0, ptr %24, align 8, !tbaa !11
  br label %188

188:                                              ; preds = %223, %187
  %189 = load i64, ptr %24, align 8, !tbaa !11
  %190 = load i64, ptr %22, align 8, !tbaa !11
  %191 = icmp ult i64 %189, %190
  br i1 %191, label %192, label %226

192:                                              ; preds = %188
  %193 = load ptr, ptr %17, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %193, i32 0, i32 1
  %195 = load i16, ptr %194, align 4, !tbaa !26
  %196 = zext i16 %195 to i64
  %197 = load i64, ptr %24, align 8, !tbaa !11
  %198 = mul i64 %196, %197
  store i64 %198, ptr %25, align 8, !tbaa !11
  %199 = load i64, ptr %21, align 8, !tbaa !11
  %200 = load i64, ptr %24, align 8, !tbaa !11
  %201 = mul i64 %199, %200
  store i64 %201, ptr %26, align 8, !tbaa !11
  store i64 0, ptr %23, align 8, !tbaa !11
  br label %202

202:                                              ; preds = %219, %192
  %203 = load i64, ptr %23, align 8, !tbaa !11
  %204 = load i64, ptr %21, align 8, !tbaa !11
  %205 = icmp ult i64 %203, %204
  br i1 %205, label %206, label %222

206:                                              ; preds = %202
  %207 = load ptr, ptr %19, align 8, !tbaa !5
  %208 = load i64, ptr %26, align 8, !tbaa !11
  %209 = load i64, ptr %23, align 8, !tbaa !11
  %210 = add i64 %208, %209
  %211 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %207, i64 %210
  %212 = load ptr, ptr %17, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %212, i32 0, i32 3
  %214 = load ptr, ptr %213, align 8, !tbaa !31
  %215 = load i64, ptr %25, align 8, !tbaa !11
  %216 = load i64, ptr %23, align 8, !tbaa !11
  %217 = add i64 %215, %216
  %218 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %214, i64 %217
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %211, ptr align 1 %218, i64 4, i1 false), !tbaa.struct !32
  br label %219

219:                                              ; preds = %206
  %220 = load i64, ptr %23, align 8, !tbaa !11
  %221 = add i64 %220, 1
  store i64 %221, ptr %23, align 8, !tbaa !11
  br label %202, !llvm.loop !33

222:                                              ; preds = %202
  br label %223

223:                                              ; preds = %222
  %224 = load i64, ptr %24, align 8, !tbaa !11
  %225 = add i64 %224, 1
  store i64 %225, ptr %24, align 8, !tbaa !11
  br label %188, !llvm.loop !35

226:                                              ; preds = %188
  br label %227

227:                                              ; preds = %226, %180
  %228 = load i32, ptr %9, align 4, !tbaa !9
  %229 = and i32 %228, 128
  %230 = icmp eq i32 %229, 128
  br i1 %230, label %231, label %248

231:                                              ; preds = %227
  %232 = load ptr, ptr %11, align 8, !tbaa !5
  %233 = load ptr, ptr %232, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %233, i32 0, i32 2
  %235 = load ptr, ptr %234, align 8, !tbaa !13
  %236 = getelementptr inbounds %struct._EFI_GRAPHICS_OUTPUT_PROTOCOL, ptr %235, i32 0, i32 2
  %237 = load ptr, ptr %236, align 8, !tbaa !36
  %238 = load ptr, ptr %11, align 8, !tbaa !5
  %239 = load ptr, ptr %238, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %239, i32 0, i32 2
  %241 = load ptr, ptr %240, align 8, !tbaa !13
  %242 = load ptr, ptr %19, align 8, !tbaa !5
  %243 = load i64, ptr %12, align 8, !tbaa !11
  %244 = load i64, ptr %13, align 8, !tbaa !11
  %245 = load i64, ptr %21, align 8, !tbaa !11
  %246 = load i64, ptr %22, align 8, !tbaa !11
  %247 = call i64 %237(ptr noundef %241, ptr noundef %242, i32 noundef 2, i64 noundef 0, i64 noundef 0, i64 noundef %243, i64 noundef %244, i64 noundef %245, i64 noundef %246, i64 noundef 0)
  store i64 %247, ptr %14, align 8, !tbaa !11
  br label %257

248:                                              ; preds = %227
  %249 = load ptr, ptr %19, align 8, !tbaa !5
  %250 = load i64, ptr %12, align 8, !tbaa !11
  %251 = load i64, ptr %13, align 8, !tbaa !11
  %252 = load i64, ptr %21, align 8, !tbaa !11
  %253 = load i64, ptr %22, align 8, !tbaa !11
  %254 = load i8, ptr %16, align 1, !tbaa !13
  %255 = load ptr, ptr %11, align 8, !tbaa !5
  %256 = call i64 @ImageToBlt(ptr noundef %249, i64 noundef %250, i64 noundef %251, i64 noundef %252, i64 noundef %253, i8 noundef zeroext %254, ptr noundef %255)
  store i64 %256, ptr %14, align 8, !tbaa !11
  br label %257

257:                                              ; preds = %248, %231
  %258 = load ptr, ptr %19, align 8, !tbaa !5
  call void @FreePool(ptr noundef %258)
  %259 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %259, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

260:                                              ; preds = %107
  %261 = load ptr, ptr %17, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %261, i32 0, i32 1
  %263 = load i16, ptr %262, align 4, !tbaa !26
  %264 = zext i16 %263 to i64
  %265 = load i64, ptr %12, align 8, !tbaa !11
  %266 = add i64 %264, %265
  store i64 %266, ptr %21, align 8, !tbaa !11
  %267 = load ptr, ptr %17, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %267, i32 0, i32 2
  %269 = load i16, ptr %268, align 2, !tbaa !27
  %270 = zext i16 %269 to i64
  %271 = load i64, ptr %13, align 8, !tbaa !11
  %272 = add i64 %270, %271
  store i64 %272, ptr %22, align 8, !tbaa !11
  %273 = load i64, ptr %21, align 8, !tbaa !11
  %274 = load i64, ptr %22, align 8, !tbaa !11
  %275 = mul i64 %273, %274
  %276 = mul i64 %275, 4
  store i64 %276, ptr %20, align 8, !tbaa !11
  %277 = load i64, ptr %20, align 8, !tbaa !11
  %278 = call ptr @AllocateZeroPool(i64 noundef %277)
  store ptr %278, ptr %19, align 8, !tbaa !5
  %279 = load ptr, ptr %19, align 8, !tbaa !5
  %280 = icmp eq ptr %279, null
  br i1 %280, label %281, label %282

281:                                              ; preds = %260
  store i64 -9223372036854775799, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

282:                                              ; preds = %260
  %283 = call ptr @AllocateZeroPool(i64 noundef 16)
  store ptr %283, ptr %18, align 8, !tbaa !5
  %284 = load ptr, ptr %18, align 8, !tbaa !5
  %285 = icmp eq ptr %284, null
  br i1 %285, label %286, label %288

286:                                              ; preds = %282
  %287 = load ptr, ptr %19, align 8, !tbaa !5
  call void @FreePool(ptr noundef %287)
  store i64 -9223372036854775799, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

288:                                              ; preds = %282
  %289 = load i64, ptr %21, align 8, !tbaa !11
  %290 = trunc i64 %289 to i16
  %291 = load ptr, ptr %18, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %291, i32 0, i32 0
  store i16 %290, ptr %292, align 8, !tbaa !28
  %293 = load i64, ptr %22, align 8, !tbaa !11
  %294 = trunc i64 %293 to i16
  %295 = load ptr, ptr %18, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %295, i32 0, i32 1
  store i16 %294, ptr %296, align 2, !tbaa !30
  %297 = load ptr, ptr %19, align 8, !tbaa !5
  %298 = load ptr, ptr %18, align 8, !tbaa !5
  %299 = getelementptr inbounds %struct._EFI_IMAGE_OUTPUT, ptr %298, i32 0, i32 2
  store ptr %297, ptr %299, align 8, !tbaa !13
  %300 = load ptr, ptr %15, align 8, !tbaa !5
  %301 = call i64 @GetSystemFont(ptr noundef %300, ptr noundef %27, ptr noundef null)
  store i64 %301, ptr %14, align 8, !tbaa !11
  %302 = load i64, ptr %14, align 8, !tbaa !11
  %303 = icmp slt i64 %302, 0
  br i1 %303, label %304, label %308

304:                                              ; preds = %288
  %305 = load ptr, ptr %19, align 8, !tbaa !5
  call void @FreePool(ptr noundef %305)
  %306 = load ptr, ptr %18, align 8, !tbaa !5
  call void @FreePool(ptr noundef %306)
  %307 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %307, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

308:                                              ; preds = %288
  br label %309

309:                                              ; preds = %308
  %310 = call zeroext i8 @DebugAssertEnabled()
  %311 = icmp ne i8 %310, 0
  br i1 %311, label %312, label %317

312:                                              ; preds = %309
  %313 = load ptr, ptr %27, align 8, !tbaa !5
  %314 = icmp ne ptr %313, null
  br i1 %314, label %316, label %315

315:                                              ; preds = %312
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1387, ptr noundef @.str.10)
  br label %316

316:                                              ; preds = %315, %312
  br label %317

317:                                              ; preds = %316, %309
  br label %318

318:                                              ; preds = %317
  br label %319

319:                                              ; preds = %318
  store i64 0, ptr %28, align 8, !tbaa !11
  br label %320

320:                                              ; preds = %332, %319
  %321 = load i64, ptr %28, align 8, !tbaa !11
  %322 = load i64, ptr %21, align 8, !tbaa !11
  %323 = load i64, ptr %22, align 8, !tbaa !11
  %324 = mul i64 %322, %323
  %325 = icmp ult i64 %321, %324
  br i1 %325, label %326, label %335

326:                                              ; preds = %320
  %327 = load ptr, ptr %19, align 8, !tbaa !5
  %328 = load i64, ptr %28, align 8, !tbaa !11
  %329 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %327, i64 %328
  %330 = load ptr, ptr %27, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct._EFI_FONT_DISPLAY_INFO, ptr %330, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %329, ptr align 4 %331, i64 4, i1 false), !tbaa.struct !32
  br label %332

332:                                              ; preds = %326
  %333 = load i64, ptr %28, align 8, !tbaa !11
  %334 = add i64 %333, 1
  store i64 %334, ptr %28, align 8, !tbaa !11
  br label %320, !llvm.loop !38

335:                                              ; preds = %320
  %336 = load ptr, ptr %27, align 8, !tbaa !5
  call void @FreePool(ptr noundef %336)
  %337 = load ptr, ptr %18, align 8, !tbaa !5
  %338 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %337, ptr %338, align 8, !tbaa !5
  %339 = load ptr, ptr %17, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %339, i32 0, i32 3
  %341 = load ptr, ptr %340, align 8, !tbaa !31
  %342 = load i64, ptr %12, align 8, !tbaa !11
  %343 = load i64, ptr %13, align 8, !tbaa !11
  %344 = load ptr, ptr %17, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %344, i32 0, i32 1
  %346 = load i16, ptr %345, align 4, !tbaa !26
  %347 = zext i16 %346 to i64
  %348 = load ptr, ptr %17, align 8, !tbaa !5
  %349 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %348, i32 0, i32 2
  %350 = load i16, ptr %349, align 2, !tbaa !27
  %351 = zext i16 %350 to i64
  %352 = load i8, ptr %16, align 1, !tbaa !13
  %353 = load ptr, ptr %11, align 8, !tbaa !5
  %354 = call i64 @ImageToBlt(ptr noundef %341, i64 noundef %342, i64 noundef %343, i64 noundef %347, i64 noundef %351, i8 noundef zeroext %352, ptr noundef %353)
  store i64 %354, ptr %7, align 8
  store i32 1, ptr %29, align 4
  br label %355

355:                                              ; preds = %335, %304, %286, %281, %257, %165, %85, %80, %52, %47, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %356 = load i64, ptr %7, align 8
  ret i64 %356
}

declare i64 @GetSystemFont(ptr noundef, ptr noundef, 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"_EFI_IMAGE_INPUT", !10, i64 0, !16, i64 4, !16, i64 6, !6, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"_HII_DATABASE_PRIVATE_DATA", !12, i64 0, !19, i64 8, !19, i64 24, !20, i64 40, !21, i64 72, !22, i64 112, !23, i64 152, !24, i64 240, !19, i64 288, !12, i64 304, !19, i64 312, !12, i64 328, !25, i64 336, !6, i64 352}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"_EFI_HII_FONT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!21 = !{!"_EFI_HII_IMAGE_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!22 = !{!"_EFI_HII_STRING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!23 = !{!"_EFI_HII_DATABASE_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}
!24 = !{!"_EFI_HII_CONFIG_ROUTING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!25 = !{!"", !10, i64 0, !16, i64 4, !16, i64 6, !7, i64 8}
!26 = !{!15, !16, i64 4}
!27 = !{!15, !16, i64 6}
!28 = !{!29, !16, i64 0}
!29 = !{!"_EFI_IMAGE_OUTPUT", !16, i64 0, !16, i64 2, !7, i64 8}
!30 = !{!29, !16, i64 2}
!31 = !{!15, !6, i64 8}
!32 = !{i64 0, i64 1, !13, i64 1, i64 1, !13, i64 2, i64 1, !13, i64 3, i64 1, !13}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}
!36 = !{!37, !6, i64 16}
!37 = !{!"_EFI_GRAPHICS_OUTPUT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!38 = distinct !{!38, !34}


; 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_GRAPHICS_OUTPUT_BLT_PIXEL = type { i8, i8, i8, i8 }

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @ImageToBlt(ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i64 @HiiDrawImage(ptr noundef %0, i32 noundef %1, ptr noundef readonly %2, ptr noundef %3, i64 noundef %4, i64 noundef %5) local_unnamed_addr #2 {
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %8 = icmp eq ptr %0, null
  %9 = icmp eq ptr %2, null
  %or.cond = or i1 %8, %9
  %10 = icmp eq ptr %3, null
  %or.cond3 = or i1 %or.cond, %10
  br i1 %or.cond3, label %166, label %11

11:                                               ; preds = %6
  %12 = and i32 %1, 1
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %16, label %13

13:                                               ; preds = %11
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %166, label %16

16:                                               ; preds = %13, %11
  %17 = and i32 %1, 48
  %18 = icmp eq i32 %17, 48
  br i1 %18, label %166, label %19

19:                                               ; preds = %16
  store ptr null, ptr %7, align 8, !tbaa !5
  switch i32 %17, label %20 [
    i32 16, label %.thread147
    i32 32, label %.thread
  ]

20:                                               ; preds = %19
  %21 = load i32, ptr %2, align 8, !tbaa !9
  %22 = and i32 %21, 1
  %.not134 = icmp eq i32 %22, 0
  br i1 %.not134, label %.thread, label %.thread147

.thread147:                                       ; preds = %19, %20
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  %25 = and i32 %1, 128
  %.not136 = icmp eq i32 %25, 0
  %or.cond143 = and i1 %.not136, %24
  br i1 %or.cond143, label %.thread, label %166

.thread:                                          ; preds = %19, %.thread147, %20
  %.0120146 = phi i8 [ 1, %.thread147 ], [ 0, %20 ], [ 0, %19 ]
  %26 = tail call zeroext i8 @DebugAssertEnabled() #4
  %.not137 = icmp eq i8 %26, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre164 = add i64 %.pre, -72
  %.pre166 = inttoptr i64 %.pre164 to ptr
  br i1 %.not137, label %.thread._crit_edge, label %27

27:                                               ; preds = %.thread
  %28 = load i64, ptr %.pre166, align 8, !tbaa !13
  %.not138 = icmp eq i64 %28, 1883531592
  br i1 %.not138, label %.thread._crit_edge, label %29

29:                                               ; preds = %27
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1273, ptr noundef nonnull @.str.8) #4
  br label %.thread._crit_edge

.thread._crit_edge:                               ; preds = %.thread, %27, %29
  %30 = phi ptr [ %0, %29 ], [ %.pre166, %27 ], [ %.pre166, %.thread ]
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %.not139 = icmp eq ptr %31, null
  %32 = getelementptr inbounds i8, ptr %2, i64 4
  %33 = load i16, ptr %32, align 4, !tbaa !23
  %34 = zext i16 %33 to i64
  br i1 %.not139, label %112, label %35

35:                                               ; preds = %.thread._crit_edge
  %36 = getelementptr inbounds i8, ptr %2, i64 6
  %37 = load i16, ptr %36, align 2, !tbaa !24
  %38 = zext i16 %37 to i64
  %39 = load i16, ptr %31, align 8, !tbaa !25
  %40 = zext i16 %39 to i64
  %41 = sub i64 %40, %4
  %spec.select142 = tail call i64 @llvm.umin.i64(i64 %41, i64 %34)
  %42 = getelementptr inbounds i8, ptr %31, i64 2
  %43 = load i16, ptr %42, align 2, !tbaa !27
  %44 = zext i16 %43 to i64
  %45 = sub i64 %44, %5
  %.0118 = tail call i64 @llvm.umin.i64(i64 %45, i64 %38)
  %46 = shl nuw nsw i64 %spec.select142, 2
  %47 = mul nuw nsw i64 %46, %.0118
  %48 = tail call ptr @AllocateZeroPool(i64 noundef %47) #4
  %49 = icmp eq ptr %48, null
  br i1 %49, label %166, label %50

50:                                               ; preds = %35
  %51 = load i16, ptr %32, align 4, !tbaa !23
  %52 = zext i16 %51 to i64
  %53 = icmp eq i64 %spec.select142, %52
  br i1 %53, label %54, label %62

54:                                               ; preds = %50
  %55 = load i16, ptr %36, align 2, !tbaa !24
  %56 = zext i16 %55 to i64
  %57 = icmp eq i64 %.0118, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = getelementptr inbounds i8, ptr %2, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !28
  %61 = tail call ptr @CopyMem(ptr noundef nonnull %48, ptr noundef %60, i64 noundef %47) #4
  br label %.loopexit

62:                                               ; preds = %54, %50
  %.not156 = icmp eq i64 %.0118, 0
  br i1 %.not156, label %.loopexit, label %.lr.ph154

.lr.ph154:                                        ; preds = %62
  %.not157 = icmp eq i64 %spec.select142, 0
  %63 = getelementptr inbounds i8, ptr %2, i64 8
  br i1 %.not157, label %.loopexit, label %.lr.ph.us.preheader

.lr.ph.us.preheader:                              ; preds = %.lr.ph154
  %xtraiter = and i64 %spec.select142, 3
  %64 = icmp ult i64 %spec.select142, 4
  %unroll_iter = and i64 %spec.select142, 65532
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %.0116152.us = phi i64 [ %100, %._crit_edge.us ], [ 0, %.lr.ph.us.preheader ]
  %65 = load i16, ptr %32, align 4, !tbaa !23
  %66 = zext i16 %65 to i64
  %67 = mul nuw nsw i64 %.0116152.us, %66
  %68 = mul nuw nsw i64 %.0116152.us, %spec.select142
  %69 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %48, i64 %68
  br i1 %64, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new

.lr.ph.us.new:                                    ; preds = %.lr.ph.us, %.lr.ph.us.new
  %.0117151.us = phi i64 [ %93, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %niter = phi i64 [ %niter.next.3, %.lr.ph.us.new ], [ 0, %.lr.ph.us ]
  %70 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %69, i64 %.0117151.us
  %71 = load ptr, ptr %63, align 8, !tbaa !28
  %72 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %71, i64 %67
  %73 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %72, i64 %.0117151.us
  %74 = load i32, ptr %73, align 1
  store i32 %74, ptr %70, align 1
  %75 = or disjoint i64 %.0117151.us, 1
  %76 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %69, i64 %75
  %77 = load ptr, ptr %63, align 8, !tbaa !28
  %78 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %77, i64 %67
  %79 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %78, i64 %75
  %80 = load i32, ptr %79, align 1
  store i32 %80, ptr %76, align 1
  %81 = or disjoint i64 %.0117151.us, 2
  %82 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %69, i64 %81
  %83 = load ptr, ptr %63, align 8, !tbaa !28
  %84 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %83, i64 %67
  %85 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %84, i64 %81
  %86 = load i32, ptr %85, align 1
  store i32 %86, ptr %82, align 1
  %87 = or disjoint i64 %.0117151.us, 3
  %88 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %69, i64 %87
  %89 = load ptr, ptr %63, align 8, !tbaa !28
  %90 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %89, i64 %67
  %91 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %90, i64 %87
  %92 = load i32, ptr %91, align 1
  store i32 %92, ptr %88, align 1
  %93 = add nuw nsw i64 %.0117151.us, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.new, !llvm.loop !29

._crit_edge.us.unr-lcssa:                         ; preds = %.lr.ph.us.new, %.lr.ph.us
  %.0117151.us.unr = phi i64 [ 0, %.lr.ph.us ], [ %93, %.lr.ph.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.unr-lcssa, %.epil.preheader
  %.0117151.us.epil = phi i64 [ %99, %.epil.preheader ], [ %.0117151.us.unr, %._crit_edge.us.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.us.unr-lcssa ]
  %94 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %69, i64 %.0117151.us.epil
  %95 = load ptr, ptr %63, align 8, !tbaa !28
  %96 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %95, i64 %67
  %97 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %96, i64 %.0117151.us.epil
  %98 = load i32, ptr %97, align 1
  store i32 %98, ptr %94, align 1
  %99 = add nuw nsw i64 %.0117151.us.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.us, label %.epil.preheader, !llvm.loop !31

._crit_edge.us:                                   ; preds = %.epil.preheader, %._crit_edge.us.unr-lcssa
  %100 = add nuw nsw i64 %.0116152.us, 1
  %exitcond160.not = icmp eq i64 %100, %.0118
  br i1 %exitcond160.not, label %.loopexit, label %.lr.ph.us, !llvm.loop !33

.loopexit:                                        ; preds = %._crit_edge.us, %.lr.ph154, %62, %58
  %101 = and i32 %1, 128
  %.not140 = icmp eq i32 %101, 0
  br i1 %.not140, label %109, label %102

102:                                              ; preds = %.loopexit
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i64 8
  %105 = load ptr, ptr %104, align 8, !tbaa !34
  %106 = getelementptr inbounds i8, ptr %105, i64 16
  %107 = load ptr, ptr %106, align 8, !tbaa !35
  %108 = tail call i64 %107(ptr noundef %105, ptr noundef nonnull %48, i32 noundef 2, i64 noundef 0, i64 noundef 0, i64 noundef %4, i64 noundef %5, i64 noundef %spec.select142, i64 noundef %.0118, i64 noundef 0) #4
  br label %111

109:                                              ; preds = %.loopexit
  %110 = tail call i64 @ImageToBlt(ptr noundef nonnull %48, i64 noundef %4, i64 noundef %5, i64 noundef %spec.select142, i64 noundef %.0118, i8 noundef zeroext %.0120146, ptr noundef nonnull %3)
  br label %111

111:                                              ; preds = %109, %102
  %.0115 = phi i64 [ %108, %102 ], [ %110, %109 ]
  tail call void @FreePool(ptr noundef nonnull %48) #4
  br label %166

112:                                              ; preds = %.thread._crit_edge
  %113 = add i64 %34, %4
  %114 = getelementptr inbounds i8, ptr %2, i64 6
  %115 = load i16, ptr %114, align 2, !tbaa !24
  %116 = zext i16 %115 to i64
  %117 = add i64 %116, %5
  %118 = mul i64 %117, %113
  %119 = shl i64 %118, 2
  %120 = tail call ptr @AllocateZeroPool(i64 noundef %119) #4
  %121 = icmp eq ptr %120, null
  br i1 %121, label %166, label %122

122:                                              ; preds = %112
  %123 = tail call ptr @AllocateZeroPool(i64 noundef 16) #4
  %124 = icmp eq ptr %123, null
  br i1 %124, label %125, label %126

125:                                              ; preds = %122
  tail call void @FreePool(ptr noundef nonnull %120) #4
  br label %166

126:                                              ; preds = %122
  %127 = trunc i64 %113 to i16
  store i16 %127, ptr %123, align 8, !tbaa !25
  %128 = trunc i64 %117 to i16
  %129 = getelementptr inbounds i8, ptr %123, i64 2
  store i16 %128, ptr %129, align 2, !tbaa !27
  %130 = getelementptr inbounds i8, ptr %123, i64 8
  store ptr %120, ptr %130, align 8, !tbaa !34
  %131 = call i64 @GetSystemFont(ptr noundef %30, ptr noundef nonnull %7, ptr noundef null) #4
  %132 = icmp slt i64 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %126
  call void @FreePool(ptr noundef nonnull %120) #4
  call void @FreePool(ptr noundef nonnull %123) #4
  br label %166

134:                                              ; preds = %126
  %135 = call zeroext i8 @DebugAssertEnabled() #4
  %136 = icmp eq i8 %135, 0
  %137 = load ptr, ptr %7, align 8
  %138 = icmp ne ptr %137, null
  %or.cond5 = select i1 %136, i1 true, i1 %138
  br i1 %or.cond5, label %140, label %139

139:                                              ; preds = %134
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1387, ptr noundef nonnull @.str.10) #4
  %.pre162.pre = load ptr, ptr %7, align 8, !tbaa !5
  br label %140

140:                                              ; preds = %139, %134
  %.pre162 = phi ptr [ %.pre162.pre, %139 ], [ %137, %134 ]
  %.not158 = icmp eq i64 %118, 0
  br i1 %.not158, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %140
  %141 = getelementptr inbounds i8, ptr %.pre162, i64 4
  %min.iters.check = icmp ult i64 %118, 16
  br i1 %min.iters.check, label %.lr.ph.preheader171, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %142 = mul i64 %117, %113
  %143 = shl i64 %142, 2
  %scevgep = getelementptr i8, ptr %120, i64 %143
  %scevgep168 = getelementptr i8, ptr %.pre162, i64 8
  %bound0 = icmp ult ptr %120, %scevgep168
  %bound1 = icmp ult ptr %141, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph.preheader171, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %118, -8
  %144 = load i32, ptr %141, align 4, !alias.scope !37
  %broadcast.splatinsert169 = insertelement <4 x i32> poison, i32 %144, i64 0
  %broadcast.splat170 = shufflevector <4 x i32> %broadcast.splatinsert169, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %145 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %120, i64 %index
  %146 = getelementptr inbounds i8, ptr %145, i64 16
  store <4 x i32> %broadcast.splat170, ptr %145, align 1, !alias.scope !40, !noalias !37
  store <4 x i32> %broadcast.splat170, ptr %146, align 1, !alias.scope !40, !noalias !37
  %index.next = add nuw i64 %index, 8
  %147 = icmp eq i64 %index.next, %n.vec
  br i1 %147, label %middle.block, label %vector.body, !llvm.loop !42

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %118, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader171

.lr.ph.preheader171:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %.0155.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter172 = and i64 %118, 3
  %lcmp.mod173.not = icmp eq i64 %xtraiter172, 0
  br i1 %lcmp.mod173.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader171, %.lr.ph.prol
  %.0155.prol = phi i64 [ %150, %.lr.ph.prol ], [ %.0155.ph, %.lr.ph.preheader171 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader171 ]
  %148 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %120, i64 %.0155.prol
  %149 = load i32, ptr %141, align 4
  store i32 %149, ptr %148, align 1
  %150 = add nuw i64 %.0155.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter172
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !45

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader171
  %.0155.unr = phi i64 [ %.0155.ph, %.lr.ph.preheader171 ], [ %150, %.lr.ph.prol ]
  %151 = sub i64 %.0155.ph, %118
  %152 = icmp ugt i64 %151, -4
  br i1 %152, label %._crit_edge, label %.lr.ph.preheader171.new

.lr.ph.preheader171.new:                          ; preds = %.lr.ph.prol.loopexit
  %invariant.gep = getelementptr i8, ptr %120, i64 4
  %invariant.gep175 = getelementptr i8, ptr %120, i64 8
  %invariant.gep177 = getelementptr i8, ptr %120, i64 12
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader171.new
  %.0155 = phi i64 [ %.0155.unr, %.lr.ph.preheader171.new ], [ %158, %.lr.ph ]
  %153 = getelementptr inbounds %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %120, i64 %.0155
  %154 = load i32, ptr %141, align 4
  store i32 %154, ptr %153, align 1
  %gep = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %invariant.gep, i64 %.0155
  %155 = load i32, ptr %141, align 4
  store i32 %155, ptr %gep, align 1
  %gep176 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %invariant.gep175, i64 %.0155
  %156 = load i32, ptr %141, align 4
  store i32 %156, ptr %gep176, align 1
  %gep178 = getelementptr %struct.EFI_GRAPHICS_OUTPUT_BLT_PIXEL, ptr %invariant.gep177, i64 %.0155
  %157 = load i32, ptr %141, align 4
  store i32 %157, ptr %gep178, align 1
  %158 = add nuw i64 %.0155, 4
  %exitcond161.not.3 = icmp eq i64 %158, %118
  br i1 %exitcond161.not.3, label %._crit_edge, label %.lr.ph, !llvm.loop !46

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %140
  call void @FreePool(ptr noundef %.pre162) #4
  store ptr %123, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds i8, ptr %2, i64 8
  %160 = load ptr, ptr %159, align 8, !tbaa !28
  %161 = load i16, ptr %32, align 4, !tbaa !23
  %162 = zext i16 %161 to i64
  %163 = load i16, ptr %114, align 2, !tbaa !24
  %164 = zext i16 %163 to i64
  %165 = call i64 @ImageToBlt(ptr noundef %160, i64 noundef %4, i64 noundef %5, i64 noundef %162, i64 noundef %164, i8 noundef zeroext %.0120146, ptr noundef nonnull %3)
  br label %166

166:                                              ; preds = %112, %35, %.thread147, %16, %13, %6, %._crit_edge, %133, %125, %111
  %.0114 = phi i64 [ %.0115, %111 ], [ -9223372036854775799, %125 ], [ %131, %133 ], [ %165, %._crit_edge ], [ -9223372036854775806, %6 ], [ -9223372036854775806, %13 ], [ -9223372036854775806, %16 ], [ -9223372036854775806, %.thread147 ], [ -9223372036854775799, %35 ], [ -9223372036854775799, %112 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  ret i64 %.0114
}

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

; 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 = { "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 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_EFI_IMAGE_INPUT", !11, i64 0, !12, i64 4, !12, i64 6, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_HII_DATABASE_PRIVATE_DATA", !15, i64 0, !16, i64 8, !16, i64 24, !17, i64 40, !18, i64 72, !19, i64 112, !20, i64 152, !21, i64 240, !16, i64 288, !15, i64 304, !16, i64 312, !15, i64 328, !22, i64 336, !6, i64 352}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!17 = !{!"_EFI_HII_FONT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!"_EFI_HII_IMAGE_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!19 = !{!"_EFI_HII_STRING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!20 = !{!"_EFI_HII_DATABASE_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}
!21 = !{!"_EFI_HII_CONFIG_ROUTING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!22 = !{!"", !11, i64 0, !12, i64 4, !12, i64 6, !7, i64 8}
!23 = !{!10, !12, i64 4}
!24 = !{!10, !12, i64 6}
!25 = !{!26, !12, i64 0}
!26 = !{!"_EFI_IMAGE_OUTPUT", !12, i64 0, !12, i64 2, !7, i64 8}
!27 = !{!26, !12, i64 2}
!28 = !{!10, !6, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.unroll.disable"}
!33 = distinct !{!33, !30}
!34 = !{!7, !7, i64 0}
!35 = !{!36, !6, i64 16}
!36 = !{!"_EFI_GRAPHICS_OUTPUT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!37 = !{!38}
!38 = distinct !{!38, !39}
!39 = distinct !{!39, !"LVerDomain"}
!40 = !{!41}
!41 = distinct !{!41, !39}
!42 = distinct !{!42, !30, !43, !44}
!43 = !{!"llvm.loop.isvectorized", i32 1}
!44 = !{!"llvm.loop.unroll.runtime.disable"}
!45 = distinct !{!45, !32}
!46 = distinct !{!46, !30, !43}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass