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

; 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._HII_DATABASE_RECORD = type { i64, ptr, ptr, ptr, %struct._LIST_ENTRY }
%struct._HII_DATABASE_PACKAGE_LIST_INSTANCE = type { %struct.EFI_HII_PACKAGE_LIST_HEADER, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, %struct._LIST_ENTRY, ptr }
%struct.EFI_HII_PACKAGE_LIST_HEADER = type { %struct.GUID, i32 }
%struct._HII_IMAGE_PACKAGE_INSTANCE = type { %struct._EFI_HII_IMAGE_PACKAGE_HDR, i32, i32, ptr, ptr }
%struct._EFI_HII_IMAGE_PACKAGE_HDR = type { %struct.EFI_HII_PACKAGE_HEADER, i32, i32 }
%struct.EFI_HII_PACKAGE_HEADER = type { i32 }
%struct._EFI_HII_IIBT_END_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK }
%struct._EFI_HII_IMAGE_BLOCK = type { i8 }

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @GetImageIdOrAddress(ptr noundef, ptr noundef) #0

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @CopyGopToRgbPixel(ptr noundef, ptr noundef, i64 noundef) #0

declare ptr @AllocateZeroPool(i64 noundef) #2

declare void @FreePool(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @HiiNewImage(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  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 8, 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
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %35, label %24

24:                                               ; preds = %4
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %35, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %35, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %36

35:                                               ; preds = %30, %27, %24, %4
  store i64 -9223372036854775806, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

36:                                               ; preds = %30
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call zeroext i8 @IsHiiHandleValid(ptr noundef %37)
  %39 = icmp ne i8 %38, 0
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

41:                                               ; preds = %36
  %42 = call zeroext i8 @DebugAssertEnabled()
  %43 = zext i8 %42 to i32
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %55

45:                                               ; preds = %41
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = ptrtoint ptr %46 to i64
  %48 = sub i64 %47, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %49 = inttoptr i64 %48 to ptr
  %50 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %49, i32 0, i32 0
  %51 = load i64, ptr %50, align 8, !tbaa !13
  %52 = icmp ne i64 %51, 1883531592
  br i1 %52, label %53, label %55

53:                                               ; preds = %45
  call void @DebugAssert(ptr noundef @.str, i64 noundef 621, ptr noundef @.str.8)
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  br label %60

55:                                               ; preds = %45, %41
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = ptrtoint ptr %56 to i64
  %58 = sub i64 %57, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %59 = inttoptr i64 %58 to ptr
  br label %60

60:                                               ; preds = %55, %53
  %61 = phi ptr [ %54, %53 ], [ %59, %55 ]
  store ptr %61, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %13, align 8, !tbaa !5
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %62, i32 0, i32 1
  %64 = getelementptr inbounds %struct._LIST_ENTRY, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  store ptr %65, ptr %11, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %102, %60
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %68, i32 0, i32 1
  %70 = icmp ne ptr %67, %69
  br i1 %70, label %71, label %106

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

75:                                               ; preds = %71
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = ptrtoint ptr %76 to i64
  %78 = sub i64 %77, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_RECORD, ptr null, i32 0, i32 4) to i64)
  %79 = inttoptr i64 %78 to ptr
  %80 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %79, i32 0, i32 0
  %81 = load i64, ptr %80, align 8, !tbaa !24
  %82 = icmp ne i64 %81, 1919183208
  br i1 %82, label %83, label %85

83:                                               ; preds = %75
  call void @DebugAssert(ptr noundef @.str, i64 noundef 633, ptr noundef @.str.8)
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  br label %90

85:                                               ; preds = %75, %71
  %86 = load ptr, ptr %11, align 8, !tbaa !5
  %87 = ptrtoint ptr %86 to i64
  %88 = sub i64 %87, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_RECORD, ptr null, i32 0, i32 4) to i64)
  %89 = inttoptr i64 %88 to ptr
  br label %90

90:                                               ; preds = %85, %83
  %91 = phi ptr [ %84, %83 ], [ %89, %85 ]
  store ptr %91, ptr %12, align 8, !tbaa !5
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %92, i32 0, i32 3
  %94 = load ptr, ptr %93, align 8, !tbaa !26
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = icmp eq ptr %94, %95
  br i1 %96, label %97, label %101

97:                                               ; preds = %90
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !27
  store ptr %100, ptr %13, align 8, !tbaa !5
  br label %106

101:                                              ; preds = %90
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._LIST_ENTRY, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !28
  store ptr %105, ptr %11, align 8, !tbaa !5
  br label %66, !llvm.loop !29

106:                                              ; preds = %97, %66
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = icmp eq ptr %107, null
  br i1 %108, label %109, label %110

109:                                              ; preds = %106
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

110:                                              ; preds = %106
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %111, ptr %20, align 8, !tbaa !5
  %112 = load ptr, ptr %20, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %112, i32 0, i32 1
  %114 = load i16, ptr %113, align 4, !tbaa !31
  %115 = zext i16 %114 to i32
  %116 = load ptr, ptr %20, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %116, i32 0, i32 2
  %118 = load i16, ptr %117, align 2, !tbaa !32
  %119 = zext i16 %118 to i32
  %120 = mul nsw i32 %115, %119
  %121 = mul nsw i32 %120, 3
  %122 = sext i32 %121 to i64
  %123 = add i64 5, %122
  store i64 %123, ptr %19, align 8, !tbaa !33
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %124, i32 0, i32 6
  %126 = load ptr, ptr %125, align 8, !tbaa !34
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %206

128:                                              ; preds = %110
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %129, i32 0, i32 6
  %131 = load ptr, ptr %130, align 8, !tbaa !34
  store ptr %131, ptr %14, align 8, !tbaa !5
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  store i16 0, ptr %132, align 2, !tbaa !37
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %133, i32 0, i32 3
  %135 = load ptr, ptr %134, align 8, !tbaa !38
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = call ptr @GetImageIdOrAddress(ptr noundef %135, ptr noundef %136)
  %138 = load ptr, ptr %14, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %138, i32 0, i32 1
  %140 = load i32, ptr %139, align 4, !tbaa !42
  %141 = zext i32 %140 to i64
  %142 = load i64, ptr %19, align 8, !tbaa !33
  %143 = add i64 %141, %142
  store i64 %143, ptr %16, align 8, !tbaa !33
  %144 = load i64, ptr %16, align 8, !tbaa !33
  %145 = call ptr @AllocateZeroPool(i64 noundef %144)
  store ptr %145, ptr %15, align 8, !tbaa !5
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  %147 = icmp eq ptr %146, null
  br i1 %147, label %148, label %149

148:                                              ; preds = %128
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

149:                                              ; preds = %128
  %150 = load ptr, ptr %15, align 8, !tbaa !5
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %151, i32 0, i32 3
  %153 = load ptr, ptr %152, align 8, !tbaa !38
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %154, i32 0, i32 1
  %156 = load i32, ptr %155, align 4, !tbaa !42
  %157 = zext i32 %156 to i64
  %158 = sub i64 %157, 1
  %159 = call ptr @CopyMem(ptr noundef %150, ptr noundef %153, i64 noundef %158)
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %160, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !38
  call void @FreePool(ptr noundef %162)
  %163 = load ptr, ptr %15, align 8, !tbaa !5
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %164, i32 0, i32 3
  store ptr %163, ptr %165, align 8, !tbaa !38
  %166 = load ptr, ptr %14, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %166, i32 0, i32 1
  %168 = load i32, ptr %167, align 4, !tbaa !42
  %169 = zext i32 %168 to i64
  %170 = sub i64 %169, 1
  %171 = load ptr, ptr %15, align 8, !tbaa !5
  %172 = getelementptr inbounds i8, ptr %171, i64 %170
  store ptr %172, ptr %15, align 8, !tbaa !5
  %173 = load i64, ptr %19, align 8, !tbaa !33
  %174 = call ptr @AllocateZeroPool(i64 noundef %173)
  store ptr %174, ptr %17, align 8, !tbaa !5
  %175 = load ptr, ptr %17, align 8, !tbaa !5
  %176 = icmp eq ptr %175, null
  br i1 %176, label %177, label %181

177:                                              ; preds = %149
  %178 = load ptr, ptr %14, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %178, i32 0, i32 3
  %180 = load ptr, ptr %179, align 8, !tbaa !38
  call void @FreePool(ptr noundef %180)
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

181:                                              ; preds = %149
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %182, ptr %18, align 8, !tbaa !5
  %183 = load i64, ptr %16, align 8, !tbaa !33
  %184 = trunc i64 %183 to i32
  %185 = load ptr, ptr %14, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %185, i32 0, i32 1
  store i32 %184, ptr %186, align 4, !tbaa !42
  %187 = load i64, ptr %19, align 8, !tbaa !33
  %188 = trunc i64 %187 to i32
  %189 = load ptr, ptr %14, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %189, i32 0, i32 0
  %191 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %190, i32 0, i32 0
  %192 = load i32, ptr %191, align 8
  %193 = and i32 %192, 16777215
  %194 = add i32 %193, %188
  %195 = load i32, ptr %191, align 8
  %196 = and i32 %194, 16777215
  %197 = and i32 %195, -16777216
  %198 = or i32 %197, %196
  store i32 %198, ptr %191, align 8
  %199 = load i64, ptr %19, align 8, !tbaa !33
  %200 = trunc i64 %199 to i32
  %201 = load ptr, ptr %13, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %201, i32 0, i32 0
  %203 = getelementptr inbounds %struct.EFI_HII_PACKAGE_LIST_HEADER, ptr %202, i32 0, i32 1
  %204 = load i32, ptr %203, align 8, !tbaa !43
  %205 = add i32 %204, %200
  store i32 %205, ptr %203, align 8, !tbaa !43
  br label %285

206:                                              ; preds = %110
  %207 = call ptr @AllocateZeroPool(i64 noundef 40)
  store ptr %207, ptr %14, align 8, !tbaa !5
  %208 = load ptr, ptr %14, align 8, !tbaa !5
  %209 = icmp eq ptr %208, null
  br i1 %209, label %210, label %211

210:                                              ; preds = %206
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

211:                                              ; preds = %206
  %212 = load ptr, ptr %8, align 8, !tbaa !5
  store i16 1, ptr %212, align 2, !tbaa !37
  %213 = load i64, ptr %19, align 8, !tbaa !33
  %214 = add i64 1, %213
  store i64 %214, ptr %16, align 8, !tbaa !33
  %215 = load i64, ptr %16, align 8, !tbaa !33
  %216 = trunc i64 %215 to i32
  %217 = zext i32 %216 to i64
  %218 = add i64 %217, 12
  %219 = trunc i64 %218 to i32
  %220 = load ptr, ptr %14, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %220, i32 0, i32 0
  %222 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %221, i32 0, i32 0
  %223 = load i32, ptr %222, align 8
  %224 = and i32 %219, 16777215
  %225 = and i32 %223, -16777216
  %226 = or i32 %225, %224
  store i32 %226, ptr %222, align 8
  %227 = load ptr, ptr %14, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %227, i32 0, i32 0
  %229 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %228, i32 0, i32 0
  %230 = load i32, ptr %229, align 8
  %231 = and i32 %230, 16777215
  %232 = or i32 %231, 100663296
  store i32 %232, ptr %229, align 8
  %233 = load ptr, ptr %14, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %233, i32 0, i32 0
  %235 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %234, i32 0, i32 1
  store i32 12, ptr %235, align 4, !tbaa !44
  %236 = load ptr, ptr %14, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %236, i32 0, i32 0
  %238 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %237, i32 0, i32 2
  store i32 0, ptr %238, align 8, !tbaa !45
  %239 = load ptr, ptr %14, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %239, i32 0, i32 4
  store ptr null, ptr %240, align 8, !tbaa !46
  %241 = load ptr, ptr %14, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %241, i32 0, i32 2
  store i32 0, ptr %242, align 8, !tbaa !47
  %243 = load i64, ptr %16, align 8, !tbaa !33
  %244 = trunc i64 %243 to i32
  %245 = load ptr, ptr %14, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %245, i32 0, i32 1
  store i32 %244, ptr %246, align 4, !tbaa !42
  %247 = load i64, ptr %16, align 8, !tbaa !33
  %248 = call ptr @AllocateZeroPool(i64 noundef %247)
  %249 = load ptr, ptr %14, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %249, i32 0, i32 3
  store ptr %248, ptr %250, align 8, !tbaa !38
  %251 = load ptr, ptr %14, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %251, i32 0, i32 3
  %253 = load ptr, ptr %252, align 8, !tbaa !38
  %254 = icmp eq ptr %253, null
  br i1 %254, label %255, label %257

255:                                              ; preds = %211
  %256 = load ptr, ptr %14, align 8, !tbaa !5
  call void @FreePool(ptr noundef %256)
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

257:                                              ; preds = %211
  %258 = load ptr, ptr %14, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %258, i32 0, i32 3
  %260 = load ptr, ptr %259, align 8, !tbaa !38
  store ptr %260, ptr %15, align 8, !tbaa !5
  %261 = load i64, ptr %19, align 8, !tbaa !33
  %262 = call ptr @AllocateZeroPool(i64 noundef %261)
  store ptr %262, ptr %17, align 8, !tbaa !5
  %263 = load ptr, ptr %17, align 8, !tbaa !5
  %264 = icmp eq ptr %263, null
  br i1 %264, label %265, label %270

265:                                              ; preds = %257
  %266 = load ptr, ptr %14, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %266, i32 0, i32 3
  %268 = load ptr, ptr %267, align 8, !tbaa !38
  call void @FreePool(ptr noundef %268)
  %269 = load ptr, ptr %14, align 8, !tbaa !5
  call void @FreePool(ptr noundef %269)
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

270:                                              ; preds = %257
  %271 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %271, ptr %18, align 8, !tbaa !5
  %272 = load ptr, ptr %14, align 8, !tbaa !5
  %273 = load ptr, ptr %13, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %273, i32 0, i32 6
  store ptr %272, ptr %274, align 8, !tbaa !34
  %275 = load ptr, ptr %14, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %275, i32 0, i32 0
  %277 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %276, i32 0, i32 0
  %278 = load i32, ptr %277, align 8
  %279 = and i32 %278, 16777215
  %280 = load ptr, ptr %13, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %280, i32 0, i32 0
  %282 = getelementptr inbounds %struct.EFI_HII_PACKAGE_LIST_HEADER, ptr %281, i32 0, i32 1
  %283 = load i32, ptr %282, align 8, !tbaa !43
  %284 = add i32 %283, %279
  store i32 %284, ptr %282, align 8, !tbaa !43
  br label %285

285:                                              ; preds = %270, %181
  %286 = load ptr, ptr %20, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %286, i32 0, i32 0
  %288 = load i32, ptr %287, align 8, !tbaa !48
  %289 = icmp eq i32 %288, 1
  br i1 %289, label %290, label %292

290:                                              ; preds = %285
  %291 = load ptr, ptr %17, align 8, !tbaa !5
  store i8 23, ptr %291, align 1, !tbaa !49
  br label %294

292:                                              ; preds = %285
  %293 = load ptr, ptr %17, align 8, !tbaa !5
  store i8 22, ptr %293, align 1, !tbaa !49
  br label %294

294:                                              ; preds = %292, %290
  %295 = load ptr, ptr %17, align 8, !tbaa !5
  %296 = getelementptr inbounds i8, ptr %295, i32 1
  store ptr %296, ptr %17, align 8, !tbaa !5
  %297 = load ptr, ptr %17, align 8, !tbaa !5
  %298 = load ptr, ptr %20, align 8, !tbaa !5
  %299 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %298, i32 0, i32 1
  %300 = call ptr @CopyMem(ptr noundef %297, ptr noundef %299, i64 noundef 2)
  %301 = load ptr, ptr %17, align 8, !tbaa !5
  %302 = getelementptr inbounds i8, ptr %301, i64 2
  store ptr %302, ptr %17, align 8, !tbaa !5
  %303 = load ptr, ptr %17, align 8, !tbaa !5
  %304 = load ptr, ptr %20, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %304, i32 0, i32 2
  %306 = call ptr @CopyMem(ptr noundef %303, ptr noundef %305, i64 noundef 2)
  %307 = load ptr, ptr %17, align 8, !tbaa !5
  %308 = getelementptr inbounds i8, ptr %307, i64 2
  store ptr %308, ptr %17, align 8, !tbaa !5
  %309 = load ptr, ptr %17, align 8, !tbaa !5
  %310 = load ptr, ptr %20, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %310, i32 0, i32 3
  %312 = load ptr, ptr %311, align 8, !tbaa !9
  %313 = load ptr, ptr %20, align 8, !tbaa !5
  %314 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %313, i32 0, i32 1
  %315 = load i16, ptr %314, align 4, !tbaa !31
  %316 = zext i16 %315 to i32
  %317 = load ptr, ptr %20, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %317, i32 0, i32 2
  %319 = load i16, ptr %318, align 2, !tbaa !32
  %320 = zext i16 %319 to i32
  %321 = mul nsw i32 %316, %320
  %322 = sext i32 %321 to i64
  call void @CopyGopToRgbPixel(ptr noundef %309, ptr noundef %312, i64 noundef %322)
  %323 = load ptr, ptr %15, align 8, !tbaa !5
  %324 = load ptr, ptr %18, align 8, !tbaa !5
  %325 = load i64, ptr %19, align 8, !tbaa !33
  %326 = call ptr @CopyMem(ptr noundef %323, ptr noundef %324, i64 noundef %325)
  %327 = load ptr, ptr %18, align 8, !tbaa !5
  call void @FreePool(ptr noundef %327)
  %328 = load i64, ptr %19, align 8, !tbaa !33
  %329 = load ptr, ptr %15, align 8, !tbaa !5
  %330 = getelementptr inbounds i8, ptr %329, i64 %328
  store ptr %330, ptr %15, align 8, !tbaa !5
  %331 = load ptr, ptr %15, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct._EFI_HII_IIBT_END_BLOCK, ptr %331, i32 0, i32 0
  %333 = getelementptr inbounds %struct._EFI_HII_IMAGE_BLOCK, ptr %332, i32 0, i32 0
  store i8 0, ptr %333, align 1, !tbaa !50
  store i64 0, ptr %5, align 8
  store i32 1, ptr %21, align 4
  br label %334

334:                                              ; preds = %294, %265, %255, %210, %177, %148, %109, %40, %35
  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 8, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %335 = load i64, ptr %5, align 8
  ret i64 %335
}

declare zeroext i8 @IsHiiHandleValid(ptr noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!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 = !{!14, !6, i64 8}
!24 = !{!25, !15, i64 0}
!25 = !{!"_HII_DATABASE_RECORD", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !16, i64 32}
!26 = !{!25, !6, i64 24}
!27 = !{!25, !6, i64 8}
!28 = !{!16, !6, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!10, !12, i64 4}
!32 = !{!10, !12, i64 6}
!33 = !{!15, !15, i64 0}
!34 = !{!35, !6, i64 104}
!35 = !{!"_HII_DATABASE_PACKAGE_LIST_INSTANCE", !36, i64 0, !16, i64 24, !16, i64 40, !16, i64 56, !16, i64 72, !16, i64 88, !6, i64 104, !16, i64 112, !6, i64 128}
!36 = !{!"", !22, i64 0, !11, i64 16}
!37 = !{!12, !12, i64 0}
!38 = !{!39, !6, i64 24}
!39 = !{!"_HII_IMAGE_PACKAGE_INSTANCE", !40, i64 0, !11, i64 12, !11, i64 16, !6, i64 24, !6, i64 32}
!40 = !{!"_EFI_HII_IMAGE_PACKAGE_HDR", !41, i64 0, !11, i64 4, !11, i64 8}
!41 = !{!"", !11, i64 0, !11, i64 3}
!42 = !{!39, !11, i64 12}
!43 = !{!35, !11, i64 16}
!44 = !{!39, !11, i64 4}
!45 = !{!39, !11, i64 8}
!46 = !{!39, !6, i64 32}
!47 = !{!39, !11, i64 16}
!48 = !{!10, !11, i64 0}
!49 = !{!7, !7, i64 0}
!50 = !{!51, !7, i64 0}
!51 = !{!"_EFI_HII_IIBT_END_BLOCK", !52, i64 0}
!52 = !{!"_EFI_HII_IMAGE_BLOCK", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [147 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @GetImageIdOrAddress(ptr noundef, ptr noundef) local_unnamed_addr #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: nounwind uwtable
declare dso_local void @CopyGopToRgbPixel(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @HiiNewImage(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %2, null
  %or.cond = or i1 %5, %6
  %7 = icmp eq ptr %3, null
  %or.cond3 = or i1 %or.cond, %7
  br i1 %or.cond3, label %.thread, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %.thread, label %12

12:                                               ; preds = %8
  %13 = tail call zeroext i8 @IsHiiHandleValid(ptr noundef %1) #2
  %.not = icmp eq i8 %13, 0
  br i1 %.not, label %.thread, label %14

14:                                               ; preds = %12
  %15 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not113 = icmp eq i8 %15, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre121 = add i64 %.pre, -72
  %.pre123 = inttoptr i64 %.pre121 to ptr
  br i1 %.not113, label %._crit_edge120, label %16

16:                                               ; preds = %14
  %17 = load i64, ptr %.pre123, align 8, !tbaa !12
  %.not114 = icmp eq i64 %17, 1883531592
  br i1 %.not114, label %._crit_edge120, label %18

18:                                               ; preds = %16
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 621, ptr noundef nonnull @.str.8) #2
  br label %._crit_edge120

._crit_edge120:                                   ; preds = %14, %16, %18
  %19 = phi ptr [ %0, %18 ], [ %.pre123, %16 ], [ %.pre123, %14 ]
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  br label %21

21:                                               ; preds = %._crit_edge, %._crit_edge120
  %.099.in = phi ptr [ %20, %._crit_edge120 ], [ %.099, %._crit_edge ]
  %.099 = load ptr, ptr %.099.in, align 8, !tbaa !22
  %.not115 = icmp eq ptr %.099, %20
  br i1 %.not115, label %.thread, label %22

22:                                               ; preds = %21
  %23 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not116 = icmp eq i8 %23, 0
  %.pre125 = ptrtoint ptr %.099 to i64
  %.pre127 = add i64 %.pre125, -32
  %.pre129 = inttoptr i64 %.pre127 to ptr
  br i1 %.not116, label %._crit_edge, label %24

24:                                               ; preds = %22
  %25 = load i64, ptr %.pre129, align 8, !tbaa !23
  %.not117 = icmp eq i64 %25, 1919183208
  br i1 %.not117, label %._crit_edge, label %26

26:                                               ; preds = %24
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 633, ptr noundef nonnull @.str.8) #2
  br label %._crit_edge

._crit_edge:                                      ; preds = %22, %24, %26
  %27 = phi ptr [ %.099, %26 ], [ %.pre129, %24 ], [ %.pre129, %22 ]
  %28 = getelementptr inbounds i8, ptr %27, i64 24
  %29 = load ptr, ptr %28, align 8, !tbaa !25
  %30 = icmp eq ptr %29, %1
  br i1 %30, label %31, label %21, !llvm.loop !26

31:                                               ; preds = %._crit_edge
  %32 = getelementptr inbounds i8, ptr %27, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !28
  %34 = icmp eq ptr %33, null
  br i1 %34, label %.thread, label %35

35:                                               ; preds = %31
  %36 = getelementptr inbounds i8, ptr %3, i64 4
  %37 = load i16, ptr %36, align 4, !tbaa !29
  %38 = zext i16 %37 to i64
  %39 = getelementptr inbounds i8, ptr %3, i64 6
  %40 = load i16, ptr %39, align 2, !tbaa !30
  %41 = zext i16 %40 to i64
  %42 = mul nuw nsw i64 %38, 3
  %43 = mul nuw nsw i64 %42, %41
  %44 = and i64 %43, 4294967295
  %45 = add nuw nsw i64 %44, 5
  %46 = getelementptr inbounds i8, ptr %33, i64 104
  %47 = load ptr, ptr %46, align 8, !tbaa !31
  %.not118 = icmp eq ptr %47, null
  br i1 %.not118, label %81, label %48

48:                                               ; preds = %35
  store i16 0, ptr %2, align 2, !tbaa !34
  %49 = getelementptr inbounds i8, ptr %47, i64 24
  %50 = load ptr, ptr %49, align 8, !tbaa !35
  %51 = tail call ptr @GetImageIdOrAddress(ptr noundef %50, ptr noundef nonnull %2)
  %52 = getelementptr inbounds i8, ptr %47, i64 12
  %53 = load i32, ptr %52, align 4, !tbaa !39
  %54 = zext i32 %53 to i64
  %55 = add nuw nsw i64 %45, %54
  %56 = tail call ptr @AllocateZeroPool(i64 noundef %55) #2
  %57 = icmp eq ptr %56, null
  br i1 %57, label %.thread, label %58

58:                                               ; preds = %48
  %59 = load ptr, ptr %49, align 8, !tbaa !35
  %60 = load i32, ptr %52, align 4, !tbaa !39
  %61 = zext i32 %60 to i64
  %62 = add nsw i64 %61, -1
  %63 = tail call ptr @CopyMem(ptr noundef nonnull %56, ptr noundef %59, i64 noundef %62) #2
  %64 = load ptr, ptr %49, align 8, !tbaa !35
  tail call void @FreePool(ptr noundef %64) #2
  store ptr %56, ptr %49, align 8, !tbaa !35
  %65 = load i32, ptr %52, align 4, !tbaa !39
  %66 = tail call ptr @AllocateZeroPool(i64 noundef %45) #2
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %70

68:                                               ; preds = %58
  %69 = load ptr, ptr %49, align 8, !tbaa !35
  tail call void @FreePool(ptr noundef %69) #2
  br label %.thread

70:                                               ; preds = %58
  %71 = zext i32 %65 to i64
  %72 = getelementptr i8, ptr %56, i64 %71
  %73 = getelementptr i8, ptr %72, i64 -1
  %74 = trunc i64 %55 to i32
  store i32 %74, ptr %52, align 4, !tbaa !39
  %75 = trunc nuw i64 %45 to i32
  %76 = load i32, ptr %47, align 8
  %77 = add i32 %76, %75
  %78 = and i32 %77, 16777215
  %79 = and i32 %76, -16777216
  %80 = or disjoint i32 %78, %79
  store i32 %80, ptr %47, align 8
  br label %108

81:                                               ; preds = %35
  %82 = tail call ptr @AllocateZeroPool(i64 noundef 40) #2
  %83 = icmp eq ptr %82, null
  br i1 %83, label %.thread, label %84

84:                                               ; preds = %81
  store i16 1, ptr %2, align 2, !tbaa !34
  %85 = add nuw nsw i64 %44, 6
  %86 = trunc nuw i64 %85 to i32
  %87 = trunc i64 %43 to i32
  %88 = add i32 %87, 18
  %89 = and i32 %88, 16777215
  %90 = or disjoint i32 %89, 100663296
  store i32 %90, ptr %82, align 8
  %91 = getelementptr inbounds i8, ptr %82, i64 4
  store i32 12, ptr %91, align 4, !tbaa !40
  %92 = getelementptr inbounds i8, ptr %82, i64 8
  store i32 0, ptr %92, align 8, !tbaa !41
  %93 = getelementptr inbounds i8, ptr %82, i64 32
  store ptr null, ptr %93, align 8, !tbaa !42
  %94 = getelementptr inbounds i8, ptr %82, i64 16
  store i32 0, ptr %94, align 8, !tbaa !43
  %95 = getelementptr inbounds i8, ptr %82, i64 12
  store i32 %86, ptr %95, align 4, !tbaa !39
  %96 = tail call ptr @AllocateZeroPool(i64 noundef %85) #2
  %97 = getelementptr inbounds i8, ptr %82, i64 24
  store ptr %96, ptr %97, align 8, !tbaa !35
  %98 = icmp eq ptr %96, null
  br i1 %98, label %99, label %100

99:                                               ; preds = %84
  tail call void @FreePool(ptr noundef nonnull %82) #2
  br label %.thread

100:                                              ; preds = %84
  %101 = tail call ptr @AllocateZeroPool(i64 noundef %45) #2
  %102 = icmp eq ptr %101, null
  br i1 %102, label %103, label %105

103:                                              ; preds = %100
  %104 = load ptr, ptr %97, align 8, !tbaa !35
  tail call void @FreePool(ptr noundef %104) #2
  tail call void @FreePool(ptr noundef nonnull %82) #2
  br label %.thread

105:                                              ; preds = %100
  store ptr %82, ptr %46, align 8, !tbaa !31
  %106 = load i32, ptr %82, align 8
  %107 = and i32 %106, 16777215
  br label %108

108:                                              ; preds = %105, %70
  %.sink133 = phi i32 [ %107, %105 ], [ %75, %70 ]
  %.0102 = phi ptr [ %96, %105 ], [ %73, %70 ]
  %.0100 = phi ptr [ %101, %105 ], [ %66, %70 ]
  %109 = getelementptr inbounds i8, ptr %33, i64 16
  %110 = load i32, ptr %109, align 8, !tbaa !44
  %111 = add i32 %110, %.sink133
  store i32 %111, ptr %109, align 8, !tbaa !44
  %112 = load i32, ptr %3, align 8, !tbaa !45
  %113 = icmp eq i32 %112, 1
  %. = select i1 %113, i8 23, i8 22
  store i8 %., ptr %.0100, align 1, !tbaa !46
  %114 = getelementptr inbounds i8, ptr %.0100, i64 1
  %115 = tail call ptr @CopyMem(ptr noundef nonnull %114, ptr noundef nonnull %36, i64 noundef 2) #2
  %116 = getelementptr inbounds i8, ptr %.0100, i64 3
  %117 = tail call ptr @CopyMem(ptr noundef nonnull %116, ptr noundef nonnull %39, i64 noundef 2) #2
  %118 = getelementptr inbounds i8, ptr %.0100, i64 5
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = load i16, ptr %36, align 4, !tbaa !29
  %121 = zext i16 %120 to i64
  %122 = load i16, ptr %39, align 2, !tbaa !30
  %123 = zext i16 %122 to i64
  %124 = mul nuw nsw i64 %123, %121
  tail call void @CopyGopToRgbPixel(ptr noundef nonnull %118, ptr noundef %119, i64 noundef %124)
  %125 = tail call ptr @CopyMem(ptr noundef %.0102, ptr noundef nonnull %.0100, i64 noundef %45) #2
  tail call void @FreePool(ptr noundef nonnull %.0100) #2
  %126 = getelementptr inbounds i8, ptr %.0102, i64 %45
  store i8 0, ptr %126, align 1, !tbaa !47
  br label %.thread

.thread:                                          ; preds = %21, %81, %48, %31, %12, %4, %8, %108, %103, %99, %68
  %.0 = phi i64 [ -9223372036854775799, %68 ], [ 0, %108 ], [ -9223372036854775799, %99 ], [ -9223372036854775799, %103 ], [ -9223372036854775806, %8 ], [ -9223372036854775806, %4 ], [ -9223372036854775794, %12 ], [ -9223372036854775794, %31 ], [ -9223372036854775799, %48 ], [ -9223372036854775799, %81 ], [ -9223372036854775794, %21 ]
  ret i64 %.0
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 8}
!6 = !{!"_EFI_IMAGE_INPUT", !7, i64 0, !10, i64 4, !10, i64 6, !11, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"_HII_DATABASE_PRIVATE_DATA", !14, i64 0, !15, i64 8, !15, i64 24, !16, i64 40, !17, i64 72, !18, i64 112, !19, i64 152, !20, i64 240, !15, i64 288, !14, i64 304, !15, i64 312, !14, i64 328, !21, i64 336, !11, i64 352}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!16 = !{!"_EFI_HII_FONT_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!17 = !{!"_EFI_HII_IMAGE_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!18 = !{!"_EFI_HII_STRING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!19 = !{!"_EFI_HII_DATABASE_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80}
!20 = !{!"_EFI_HII_CONFIG_ROUTING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!21 = !{!"", !7, i64 0, !10, i64 4, !10, i64 6, !8, i64 8}
!22 = !{!15, !11, i64 0}
!23 = !{!24, !14, i64 0}
!24 = !{!"_HII_DATABASE_RECORD", !14, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !15, i64 32}
!25 = !{!24, !11, i64 24}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!24, !11, i64 8}
!29 = !{!6, !10, i64 4}
!30 = !{!6, !10, i64 6}
!31 = !{!32, !11, i64 104}
!32 = !{!"_HII_DATABASE_PACKAGE_LIST_INSTANCE", !33, i64 0, !15, i64 24, !15, i64 40, !15, i64 56, !15, i64 72, !15, i64 88, !11, i64 104, !15, i64 112, !11, i64 128}
!33 = !{!"", !21, i64 0, !7, i64 16}
!34 = !{!10, !10, i64 0}
!35 = !{!36, !11, i64 24}
!36 = !{!"_HII_IMAGE_PACKAGE_INSTANCE", !37, i64 0, !7, i64 12, !7, i64 16, !11, i64 24, !11, i64 32}
!37 = !{!"_EFI_HII_IMAGE_PACKAGE_HDR", !38, i64 0, !7, i64 4, !7, i64 8}
!38 = !{!"", !7, i64 0, !7, i64 3}
!39 = !{!36, !7, i64 12}
!40 = !{!36, !7, i64 4}
!41 = !{!36, !7, i64 8}
!42 = !{!36, !11, i64 32}
!43 = !{!36, !7, i64 16}
!44 = !{!32, !7, i64 16}
!45 = !{!6, !7, i64 0}
!46 = !{!8, !8, i64 0}
!47 = !{!48, !8, i64 0}
!48 = !{!"_EFI_HII_IIBT_END_BLOCK", !49, i64 0}
!49 = !{!"_EFI_HII_IMAGE_BLOCK", !8, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass