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

; 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_HII_IIBT_IMAGE_1BIT_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_1BIT_BASE }
%struct._EFI_HII_IMAGE_BLOCK = type { i8 }
%struct._EFI_HII_IIBT_IMAGE_1BIT_BASE = type <{ i16, i16, [1 x i8] }>
%struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_4BIT_BASE }
%struct._EFI_HII_IIBT_IMAGE_4BIT_BASE = type <{ i16, i16, [1 x i8] }>
%struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_8BIT_BASE }
%struct._EFI_HII_IIBT_IMAGE_8BIT_BASE = type <{ i16, i16, [1 x i8] }>
%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 }

@.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

declare zeroext i8 @IsHiiHandleValid(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @HiiSetImage(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %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 i16, align 2
  %17 = alloca i8, align 1
  %18 = alloca %struct._EFI_HII_IIBT_IMAGE_1BIT_BLOCK, align 1
  %19 = alloca %struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK, align 1
  %20 = alloca %struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK, align 1
  %21 = alloca i16, align 2
  %22 = alloca i16, align 2
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i16 %2, ptr %8, align 2, !tbaa !9
  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 2, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #3
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %48, label %36

36:                                               ; preds = %4
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %48, label %39

39:                                               ; preds = %36
  %40 = load i16, ptr %8, align 2, !tbaa !9
  %41 = zext i16 %40 to i32
  %42 = icmp slt i32 %41, 1
  br i1 %42, label %48, label %43

43:                                               ; preds = %39
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %44, i32 0, i32 3
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = icmp eq ptr %46, null
  br i1 %47, label %48, label %49

48:                                               ; preds = %43, %39, %36, %4
  store i64 -9223372036854775806, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

49:                                               ; preds = %43
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call zeroext i8 @IsHiiHandleValid(ptr noundef %50)
  %52 = icmp ne i8 %51, 0
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

54:                                               ; preds = %49
  %55 = call zeroext i8 @DebugAssertEnabled()
  %56 = zext i8 %55 to i32
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %68

58:                                               ; preds = %54
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = ptrtoint ptr %59 to i64
  %61 = sub i64 %60, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %62 = inttoptr i64 %61 to ptr
  %63 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %62, i32 0, i32 0
  %64 = load i64, ptr %63, align 8, !tbaa !14
  %65 = icmp ne i64 %64, 1883531592
  br i1 %65, label %66, label %68

66:                                               ; preds = %58
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1038, ptr noundef @.str.8)
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  br label %73

68:                                               ; preds = %58, %54
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = ptrtoint ptr %69 to i64
  %71 = sub i64 %70, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_PRIVATE_DATA, ptr null, i32 0, i32 4) to i64)
  %72 = inttoptr i64 %71 to ptr
  br label %73

73:                                               ; preds = %68, %66
  %74 = phi ptr [ %67, %66 ], [ %72, %68 ]
  store ptr %74, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %13, align 8, !tbaa !5
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %struct._LIST_ENTRY, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !24
  store ptr %78, ptr %11, align 8, !tbaa !5
  br label %79

79:                                               ; preds = %115, %73
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._HII_DATABASE_PRIVATE_DATA, ptr %81, i32 0, i32 1
  %83 = icmp ne ptr %80, %82
  br i1 %83, label %84, label %119

84:                                               ; preds = %79
  %85 = call zeroext i8 @DebugAssertEnabled()
  %86 = zext i8 %85 to i32
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %98

88:                                               ; preds = %84
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = ptrtoint ptr %89 to i64
  %91 = sub i64 %90, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_RECORD, ptr null, i32 0, i32 4) to i64)
  %92 = inttoptr i64 %91 to ptr
  %93 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %92, i32 0, i32 0
  %94 = load i64, ptr %93, align 8, !tbaa !25
  %95 = icmp ne i64 %94, 1919183208
  br i1 %95, label %96, label %98

96:                                               ; preds = %88
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1048, ptr noundef @.str.8)
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  br label %103

98:                                               ; preds = %88, %84
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = ptrtoint ptr %99 to i64
  %101 = sub i64 %100, ptrtoint (ptr getelementptr inbounds (%struct._HII_DATABASE_RECORD, ptr null, i32 0, i32 4) to i64)
  %102 = inttoptr i64 %101 to ptr
  br label %103

103:                                              ; preds = %98, %96
  %104 = phi ptr [ %97, %96 ], [ %102, %98 ]
  store ptr %104, ptr %12, align 8, !tbaa !5
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %105, i32 0, i32 3
  %107 = load ptr, ptr %106, align 8, !tbaa !27
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = icmp eq ptr %107, %108
  br i1 %109, label %110, label %114

110:                                              ; preds = %103
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._HII_DATABASE_RECORD, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !28
  store ptr %113, ptr %13, align 8, !tbaa !5
  br label %119

114:                                              ; preds = %103
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._LIST_ENTRY, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !29
  store ptr %118, ptr %11, align 8, !tbaa !5
  br label %79, !llvm.loop !30

119:                                              ; preds = %110, %79
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = icmp eq ptr %120, null
  br i1 %121, label %122, label %123

122:                                              ; preds = %119
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

123:                                              ; preds = %119
  %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 !32
  store ptr %126, ptr %14, align 8, !tbaa !5
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  %128 = icmp eq ptr %127, null
  br i1 %128, label %129, label %130

129:                                              ; preds = %123
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

130:                                              ; preds = %123
  %131 = load i16, ptr %8, align 2, !tbaa !9
  store i16 %131, ptr %16, align 2, !tbaa !9
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %132, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !35
  %135 = call ptr @GetImageIdOrAddress(ptr noundef %134, ptr noundef %16)
  store ptr %135, ptr %15, align 8, !tbaa !5
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = icmp eq ptr %136, null
  br i1 %137, label %138, label %139

138:                                              ; preds = %130
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

139:                                              ; preds = %130
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = load i8, ptr %140, align 1, !tbaa !39
  store i8 %141, ptr %17, align 1, !tbaa !39
  %142 = load i8, ptr %17, align 1, !tbaa !39
  %143 = zext i8 %142 to i32
  switch i32 %143, label %211 [
    i32 24, label %144
    i32 16, label %145
    i32 17, label %145
    i32 18, label %162
    i32 19, label %162
    i32 20, label %179
    i32 21, label %179
    i32 22, label %194
    i32 23, label %194
  ]

144:                                              ; preds = %139
  store i64 -9223372036854775805, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

145:                                              ; preds = %139, %139
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  %147 = call ptr @CopyMem(ptr noundef %18, ptr noundef %146, i64 noundef 7)
  %148 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_1BIT_BLOCK, ptr %18, i32 0, i32 2
  %149 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_1BIT_BASE, ptr %148, i32 0, i32 0
  %150 = load i16, ptr %149, align 1, !tbaa !40
  %151 = zext i16 %150 to i32
  %152 = add nsw i32 %151, 7
  %153 = sdiv i32 %152, 8
  %154 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_1BIT_BLOCK, ptr %18, i32 0, i32 2
  %155 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_1BIT_BASE, ptr %154, i32 0, i32 1
  %156 = load i16, ptr %155, align 1, !tbaa !44
  %157 = zext i16 %156 to i32
  %158 = mul nsw i32 %153, %157
  %159 = sext i32 %158 to i64
  %160 = add i64 6, %159
  %161 = trunc i64 %160 to i32
  store i32 %161, ptr %25, align 4, !tbaa !45
  br label %212

162:                                              ; preds = %139, %139
  %163 = load ptr, ptr %15, align 8, !tbaa !5
  %164 = call ptr @CopyMem(ptr noundef %19, ptr noundef %163, i64 noundef 7)
  %165 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK, ptr %19, i32 0, i32 2
  %166 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_4BIT_BASE, ptr %165, i32 0, i32 0
  %167 = load i16, ptr %166, align 1, !tbaa !46
  %168 = zext i16 %167 to i32
  %169 = add nsw i32 %168, 1
  %170 = sdiv i32 %169, 2
  %171 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK, ptr %19, i32 0, i32 2
  %172 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_4BIT_BASE, ptr %171, i32 0, i32 1
  %173 = load i16, ptr %172, align 1, !tbaa !49
  %174 = zext i16 %173 to i32
  %175 = mul nsw i32 %170, %174
  %176 = sext i32 %175 to i64
  %177 = add i64 6, %176
  %178 = trunc i64 %177 to i32
  store i32 %178, ptr %25, align 4, !tbaa !45
  br label %212

179:                                              ; preds = %139, %139
  %180 = load ptr, ptr %15, align 8, !tbaa !5
  %181 = call ptr @CopyMem(ptr noundef %20, ptr noundef %180, i64 noundef 7)
  %182 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK, ptr %20, i32 0, i32 2
  %183 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_8BIT_BASE, ptr %182, i32 0, i32 0
  %184 = load i16, ptr %183, align 1, !tbaa !50
  %185 = zext i16 %184 to i32
  %186 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK, ptr %20, i32 0, i32 2
  %187 = getelementptr inbounds %struct._EFI_HII_IIBT_IMAGE_8BIT_BASE, ptr %186, i32 0, i32 1
  %188 = load i16, ptr %187, align 1, !tbaa !53
  %189 = zext i16 %188 to i32
  %190 = mul nsw i32 %185, %189
  %191 = sext i32 %190 to i64
  %192 = add i64 6, %191
  %193 = trunc i64 %192 to i32
  store i32 %193, ptr %25, align 4, !tbaa !45
  br label %212

194:                                              ; preds = %139, %139
  %195 = load ptr, ptr %15, align 8, !tbaa !5
  %196 = getelementptr inbounds i8, ptr %195, i64 1
  %197 = call ptr @CopyMem(ptr noundef %21, ptr noundef %196, i64 noundef 2)
  %198 = load ptr, ptr %15, align 8, !tbaa !5
  %199 = getelementptr inbounds i8, ptr %198, i64 1
  %200 = getelementptr inbounds i8, ptr %199, i64 2
  %201 = call ptr @CopyMem(ptr noundef %22, ptr noundef %200, i64 noundef 2)
  %202 = load i16, ptr %21, align 2, !tbaa !9
  %203 = zext i16 %202 to i32
  %204 = load i16, ptr %22, align 2, !tbaa !9
  %205 = zext i16 %204 to i32
  %206 = mul nsw i32 %203, %205
  %207 = mul nsw i32 %206, 3
  %208 = sext i32 %207 to i64
  %209 = add i64 5, %208
  %210 = trunc i64 %209 to i32
  store i32 %210, ptr %25, align 4, !tbaa !45
  br label %212

211:                                              ; preds = %139
  store i64 -9223372036854775794, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

212:                                              ; preds = %194, %179, %162, %145
  %213 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %213, ptr %26, align 8, !tbaa !5
  %214 = load ptr, ptr %26, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %214, i32 0, i32 1
  %216 = load i16, ptr %215, align 4, !tbaa !54
  %217 = zext i16 %216 to i32
  %218 = load ptr, ptr %26, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %218, i32 0, i32 2
  %220 = load i16, ptr %219, align 2, !tbaa !55
  %221 = zext i16 %220 to i32
  %222 = mul nsw i32 %217, %221
  %223 = mul nsw i32 %222, 3
  %224 = sext i32 %223 to i64
  %225 = add i64 5, %224
  %226 = trunc i64 %225 to i32
  store i32 %226, ptr %24, align 4, !tbaa !45
  %227 = load i32, ptr %24, align 4, !tbaa !45
  %228 = zext i32 %227 to i64
  %229 = call ptr @AllocateZeroPool(i64 noundef %228)
  store ptr %229, ptr %27, align 8, !tbaa !5
  %230 = load ptr, ptr %27, align 8, !tbaa !5
  %231 = icmp eq ptr %230, null
  br i1 %231, label %232, label %233

232:                                              ; preds = %212
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

233:                                              ; preds = %212
  %234 = load ptr, ptr %27, align 8, !tbaa !5
  store ptr %234, ptr %28, align 8, !tbaa !5
  %235 = load ptr, ptr %26, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %235, i32 0, i32 0
  %237 = load i32, ptr %236, align 8, !tbaa !56
  %238 = and i32 %237, 1
  %239 = icmp eq i32 %238, 1
  br i1 %239, label %240, label %242

240:                                              ; preds = %233
  %241 = load ptr, ptr %28, align 8, !tbaa !5
  store i8 23, ptr %241, align 1, !tbaa !39
  br label %244

242:                                              ; preds = %233
  %243 = load ptr, ptr %28, align 8, !tbaa !5
  store i8 22, ptr %243, align 1, !tbaa !39
  br label %244

244:                                              ; preds = %242, %240
  %245 = load ptr, ptr %28, align 8, !tbaa !5
  %246 = getelementptr inbounds i8, ptr %245, i32 1
  store ptr %246, ptr %28, align 8, !tbaa !5
  %247 = load ptr, ptr %28, align 8, !tbaa !5
  %248 = load ptr, ptr %26, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %248, i32 0, i32 1
  %250 = call ptr @CopyMem(ptr noundef %247, ptr noundef %249, i64 noundef 2)
  %251 = load ptr, ptr %28, align 8, !tbaa !5
  %252 = getelementptr inbounds i8, ptr %251, i64 2
  store ptr %252, ptr %28, align 8, !tbaa !5
  %253 = load ptr, ptr %28, align 8, !tbaa !5
  %254 = load ptr, ptr %26, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %254, i32 0, i32 2
  %256 = call ptr @CopyMem(ptr noundef %253, ptr noundef %255, i64 noundef 2)
  %257 = load ptr, ptr %28, align 8, !tbaa !5
  %258 = getelementptr inbounds i8, ptr %257, i64 2
  store ptr %258, ptr %28, align 8, !tbaa !5
  %259 = load ptr, ptr %28, align 8, !tbaa !5
  %260 = load ptr, ptr %26, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %260, i32 0, i32 3
  %262 = load ptr, ptr %261, align 8, !tbaa !11
  %263 = load ptr, ptr %26, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct._EFI_IMAGE_INPUT, ptr %263, i32 0, i32 1
  %265 = load i16, ptr %264, align 4, !tbaa !54
  %266 = zext i16 %265 to i32
  %267 = load ptr, ptr %26, 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 !55
  %270 = zext i16 %269 to i32
  %271 = mul nsw i32 %266, %270
  %272 = sext i32 %271 to i64
  call void @CopyGopToRgbPixel(ptr noundef %259, ptr noundef %262, i64 noundef %272)
  %273 = load ptr, ptr %14, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %273, i32 0, i32 1
  %275 = load i32, ptr %274, align 4, !tbaa !57
  %276 = load i32, ptr %24, align 4, !tbaa !45
  %277 = add i32 %275, %276
  %278 = load i32, ptr %25, align 4, !tbaa !45
  %279 = sub i32 %277, %278
  store i32 %279, ptr %23, align 4, !tbaa !45
  %280 = load i32, ptr %23, align 4, !tbaa !45
  %281 = zext i32 %280 to i64
  %282 = call ptr @AllocateZeroPool(i64 noundef %281)
  store ptr %282, ptr %29, align 8, !tbaa !5
  %283 = load ptr, ptr %29, align 8, !tbaa !5
  %284 = icmp eq ptr %283, null
  br i1 %284, label %285, label %287

285:                                              ; preds = %244
  %286 = load ptr, ptr %27, align 8, !tbaa !5
  call void @FreePool(ptr noundef %286)
  store i64 -9223372036854775799, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

287:                                              ; preds = %244
  %288 = load ptr, ptr %29, align 8, !tbaa !5
  store ptr %288, ptr %30, align 8, !tbaa !5
  %289 = load ptr, ptr %15, align 8, !tbaa !5
  %290 = load ptr, ptr %14, align 8, !tbaa !5
  %291 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %290, i32 0, i32 3
  %292 = load ptr, ptr %291, align 8, !tbaa !35
  %293 = ptrtoint ptr %289 to i64
  %294 = ptrtoint ptr %292 to i64
  %295 = sub i64 %293, %294
  %296 = trunc i64 %295 to i32
  store i32 %296, ptr %31, align 4, !tbaa !45
  %297 = load ptr, ptr %14, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %297, i32 0, i32 1
  %299 = load i32, ptr %298, align 4, !tbaa !57
  %300 = load i32, ptr %31, align 4, !tbaa !45
  %301 = sub i32 %299, %300
  %302 = load i32, ptr %25, align 4, !tbaa !45
  %303 = sub i32 %301, %302
  store i32 %303, ptr %32, align 4, !tbaa !45
  %304 = load ptr, ptr %30, align 8, !tbaa !5
  %305 = load ptr, ptr %14, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %305, i32 0, i32 3
  %307 = load ptr, ptr %306, align 8, !tbaa !35
  %308 = load i32, ptr %31, align 4, !tbaa !45
  %309 = zext i32 %308 to i64
  %310 = call ptr @CopyMem(ptr noundef %304, ptr noundef %307, i64 noundef %309)
  %311 = load i32, ptr %31, align 4, !tbaa !45
  %312 = load ptr, ptr %30, align 8, !tbaa !5
  %313 = zext i32 %311 to i64
  %314 = getelementptr inbounds i8, ptr %312, i64 %313
  store ptr %314, ptr %30, align 8, !tbaa !5
  %315 = load ptr, ptr %30, align 8, !tbaa !5
  %316 = load ptr, ptr %27, align 8, !tbaa !5
  %317 = load i32, ptr %24, align 4, !tbaa !45
  %318 = zext i32 %317 to i64
  %319 = call ptr @CopyMem(ptr noundef %315, ptr noundef %316, i64 noundef %318)
  %320 = load i32, ptr %24, align 4, !tbaa !45
  %321 = load ptr, ptr %30, align 8, !tbaa !5
  %322 = zext i32 %320 to i64
  %323 = getelementptr inbounds i8, ptr %321, i64 %322
  store ptr %323, ptr %30, align 8, !tbaa !5
  %324 = load ptr, ptr %30, align 8, !tbaa !5
  %325 = load ptr, ptr %15, align 8, !tbaa !5
  %326 = load i32, ptr %25, align 4, !tbaa !45
  %327 = zext i32 %326 to i64
  %328 = getelementptr inbounds i8, ptr %325, i64 %327
  %329 = load i32, ptr %32, align 4, !tbaa !45
  %330 = zext i32 %329 to i64
  %331 = call ptr @CopyMem(ptr noundef %324, ptr noundef %328, i64 noundef %330)
  %332 = load ptr, ptr %14, align 8, !tbaa !5
  %333 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %332, i32 0, i32 3
  %334 = load ptr, ptr %333, align 8, !tbaa !35
  call void @FreePool(ptr noundef %334)
  %335 = load ptr, ptr %27, align 8, !tbaa !5
  call void @FreePool(ptr noundef %335)
  %336 = load ptr, ptr %29, align 8, !tbaa !5
  %337 = load ptr, ptr %14, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %337, i32 0, i32 3
  store ptr %336, ptr %338, align 8, !tbaa !35
  %339 = load i32, ptr %23, align 4, !tbaa !45
  %340 = load ptr, ptr %14, align 8, !tbaa !5
  %341 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %340, i32 0, i32 1
  store i32 %339, ptr %341, align 4, !tbaa !57
  %342 = load i32, ptr %24, align 4, !tbaa !45
  %343 = load i32, ptr %25, align 4, !tbaa !45
  %344 = sub i32 %342, %343
  %345 = load ptr, ptr %14, align 8, !tbaa !5
  %346 = getelementptr inbounds %struct._HII_IMAGE_PACKAGE_INSTANCE, ptr %345, i32 0, i32 0
  %347 = getelementptr inbounds %struct._EFI_HII_IMAGE_PACKAGE_HDR, ptr %346, i32 0, i32 0
  %348 = load i32, ptr %347, align 8
  %349 = and i32 %348, 16777215
  %350 = add i32 %349, %344
  %351 = load i32, ptr %347, align 8
  %352 = and i32 %350, 16777215
  %353 = and i32 %351, -16777216
  %354 = or i32 %353, %352
  store i32 %354, ptr %347, align 8
  %355 = load i32, ptr %24, align 4, !tbaa !45
  %356 = load i32, ptr %25, align 4, !tbaa !45
  %357 = sub i32 %355, %356
  %358 = load ptr, ptr %13, align 8, !tbaa !5
  %359 = getelementptr inbounds %struct._HII_DATABASE_PACKAGE_LIST_INSTANCE, ptr %358, i32 0, i32 0
  %360 = getelementptr inbounds %struct.EFI_HII_PACKAGE_LIST_HEADER, ptr %359, i32 0, i32 1
  %361 = load i32, ptr %360, align 8, !tbaa !58
  %362 = add i32 %361, %357
  store i32 %362, ptr %360, align 8, !tbaa !58
  store i64 0, ptr %5, align 8
  store i32 1, ptr %33, align 4
  br label %363

363:                                              ; preds = %287, %285, %232, %211, %144, %138, %129, %122, %53, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 2, 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
  %364 = load i64, ptr %5, align 8
  ret i64 %364
}

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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_EFI_IMAGE_INPUT", !13, i64 0, !10, i64 4, !10, i64 6, !6, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_HII_DATABASE_PRIVATE_DATA", !16, i64 0, !17, i64 8, !17, i64 24, !18, i64 40, !19, i64 72, !20, i64 112, !21, i64 152, !22, i64 240, !17, i64 288, !16, i64 304, !17, i64 312, !16, i64 328, !23, i64 336, !6, i64 352}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!18 = !{!"_EFI_HII_FONT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!"_EFI_HII_IMAGE_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!20 = !{!"_EFI_HII_STRING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!21 = !{!"_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}
!22 = !{!"_EFI_HII_CONFIG_ROUTING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!"", !13, i64 0, !10, i64 4, !10, i64 6, !7, i64 8}
!24 = !{!15, !6, i64 8}
!25 = !{!26, !16, i64 0}
!26 = !{!"_HII_DATABASE_RECORD", !16, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !17, i64 32}
!27 = !{!26, !6, i64 24}
!28 = !{!26, !6, i64 8}
!29 = !{!17, !6, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!33, !6, i64 104}
!33 = !{!"_HII_DATABASE_PACKAGE_LIST_INSTANCE", !34, i64 0, !17, i64 24, !17, i64 40, !17, i64 56, !17, i64 72, !17, i64 88, !6, i64 104, !17, i64 112, !6, i64 128}
!34 = !{!"", !23, i64 0, !13, i64 16}
!35 = !{!36, !6, i64 24}
!36 = !{!"_HII_IMAGE_PACKAGE_INSTANCE", !37, i64 0, !13, i64 12, !13, i64 16, !6, i64 24, !6, i64 32}
!37 = !{!"_EFI_HII_IMAGE_PACKAGE_HDR", !38, i64 0, !13, i64 4, !13, i64 8}
!38 = !{!"", !13, i64 0, !13, i64 3}
!39 = !{!7, !7, i64 0}
!40 = !{!41, !10, i64 2}
!41 = !{!"_EFI_HII_IIBT_IMAGE_1BIT_BLOCK", !42, i64 0, !7, i64 1, !43, i64 2}
!42 = !{!"_EFI_HII_IMAGE_BLOCK", !7, i64 0}
!43 = !{!"_EFI_HII_IIBT_IMAGE_1BIT_BASE", !10, i64 0, !10, i64 2, !7, i64 4}
!44 = !{!41, !10, i64 4}
!45 = !{!13, !13, i64 0}
!46 = !{!47, !10, i64 2}
!47 = !{!"_EFI_HII_IIBT_IMAGE_4BIT_BLOCK", !42, i64 0, !7, i64 1, !48, i64 2}
!48 = !{!"_EFI_HII_IIBT_IMAGE_4BIT_BASE", !10, i64 0, !10, i64 2, !7, i64 4}
!49 = !{!47, !10, i64 4}
!50 = !{!51, !10, i64 2}
!51 = !{!"_EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK", !42, i64 0, !7, i64 1, !52, i64 2}
!52 = !{!"_EFI_HII_IIBT_IMAGE_8BIT_BASE", !10, i64 0, !10, i64 2, !7, i64 4}
!53 = !{!51, !10, i64 4}
!54 = !{!12, !10, i64 4}
!55 = !{!12, !10, i64 6}
!56 = !{!12, !13, i64 0}
!57 = !{!36, !13, i64 12}
!58 = !{!33, !13, i64 16}


; 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_HII_IIBT_IMAGE_1BIT_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_1BIT_BASE }
%struct._EFI_HII_IMAGE_BLOCK = type { i8 }
%struct._EFI_HII_IIBT_IMAGE_1BIT_BASE = type <{ i16, i16, [1 x i8] }>
%struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_4BIT_BASE }
%struct._EFI_HII_IIBT_IMAGE_4BIT_BASE = type <{ i16, i16, [1 x i8] }>
%struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK = type { %struct._EFI_HII_IMAGE_BLOCK, i8, %struct._EFI_HII_IIBT_IMAGE_8BIT_BASE }
%struct._EFI_HII_IIBT_IMAGE_8BIT_BASE = type <{ i16, i16, [1 x 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) local_unnamed_addr #0

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

; Function Attrs: mustprogress 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) local_unnamed_addr #0

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775806, 1) i64 @HiiSetImage(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca i16, align 2
  %6 = alloca %struct._EFI_HII_IIBT_IMAGE_1BIT_BLOCK, align 1
  %7 = alloca %struct._EFI_HII_IIBT_IMAGE_4BIT_BLOCK, align 1
  %8 = alloca %struct._EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK, align 1
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %10) #3
  %11 = icmp eq ptr %0, null
  %12 = icmp eq ptr %3, null
  %or.cond = or i1 %11, %12
  %13 = icmp eq i16 %2, 0
  %or.cond4 = or i1 %13, %or.cond
  br i1 %or.cond4, label %.thread, label %14

14:                                               ; preds = %4
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %.thread, label %18

18:                                               ; preds = %14
  %19 = tail call zeroext i8 @IsHiiHandleValid(ptr noundef %1) #3
  %.not = icmp eq i8 %19, 0
  br i1 %.not, label %.thread, label %20

20:                                               ; preds = %18
  %21 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not102 = icmp eq i8 %21, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre112 = add i64 %.pre, -72
  %.pre114 = inttoptr i64 %.pre112 to ptr
  br i1 %.not102, label %._crit_edge111, label %22

22:                                               ; preds = %20
  %23 = load i64, ptr %.pre114, align 8, !tbaa !12
  %.not103 = icmp eq i64 %23, 1883531592
  br i1 %.not103, label %._crit_edge111, label %24

24:                                               ; preds = %22
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1038, ptr noundef nonnull @.str.8) #3
  br label %._crit_edge111

._crit_edge111:                                   ; preds = %20, %22, %24
  %25 = phi ptr [ %0, %24 ], [ %.pre114, %22 ], [ %.pre114, %20 ]
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  br label %27

27:                                               ; preds = %._crit_edge, %._crit_edge111
  %.093.in = phi ptr [ %26, %._crit_edge111 ], [ %.093, %._crit_edge ]
  %.093 = load ptr, ptr %.093.in, align 8, !tbaa !22
  %.not104 = icmp eq ptr %.093, %26
  br i1 %.not104, label %.thread, label %28

28:                                               ; preds = %27
  %29 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not105 = icmp eq i8 %29, 0
  %.pre116 = ptrtoint ptr %.093 to i64
  %.pre118 = add i64 %.pre116, -32
  %.pre120 = inttoptr i64 %.pre118 to ptr
  br i1 %.not105, label %._crit_edge, label %30

30:                                               ; preds = %28
  %31 = load i64, ptr %.pre120, align 8, !tbaa !23
  %.not106 = icmp eq i64 %31, 1919183208
  br i1 %.not106, label %._crit_edge, label %32

32:                                               ; preds = %30
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1048, ptr noundef nonnull @.str.8) #3
  br label %._crit_edge

._crit_edge:                                      ; preds = %28, %30, %32
  %33 = phi ptr [ %.093, %32 ], [ %.pre120, %30 ], [ %.pre120, %28 ]
  %34 = getelementptr inbounds i8, ptr %33, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !25
  %36 = icmp eq ptr %35, %1
  br i1 %36, label %37, label %27, !llvm.loop !26

37:                                               ; preds = %._crit_edge
  %38 = getelementptr inbounds i8, ptr %33, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !28
  %40 = icmp eq ptr %39, null
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %39, i64 104
  %43 = load ptr, ptr %42, align 8, !tbaa !29
  %44 = icmp eq ptr %43, null
  br i1 %44, label %.thread, label %45

45:                                               ; preds = %41
  store i16 %2, ptr %5, align 2, !tbaa !32
  %46 = getelementptr inbounds i8, ptr %43, i64 24
  %47 = load ptr, ptr %46, align 8, !tbaa !33
  %48 = call ptr @GetImageIdOrAddress(ptr noundef %47, ptr noundef nonnull %5)
  %49 = icmp eq ptr %48, null
  br i1 %49, label %.thread, label %50

50:                                               ; preds = %45
  %51 = load i8, ptr %48, align 1, !tbaa !37
  switch i8 %51, label %96 [
    i8 24, label %.thread
    i8 16, label %52
    i8 17, label %52
    i8 18, label %63
    i8 19, label %63
    i8 20, label %74
    i8 21, label %74
    i8 22, label %84
    i8 23, label %84
  ]

52:                                               ; preds = %50, %50
  %53 = call ptr @CopyMem(ptr noundef nonnull %6, ptr noundef nonnull %48, i64 noundef 7) #3
  %54 = getelementptr inbounds i8, ptr %6, i64 2
  %55 = load i16, ptr %54, align 1, !tbaa !38
  %56 = zext i16 %55 to i32
  %57 = add nuw nsw i32 %56, 7
  %58 = lshr i32 %57, 3
  %59 = getelementptr inbounds i8, ptr %6, i64 4
  %60 = load i16, ptr %59, align 1, !tbaa !42
  %61 = zext i16 %60 to i32
  %62 = mul nuw nsw i32 %58, %61
  %narrow107 = add nuw nsw i32 %62, 6
  br label %97

63:                                               ; preds = %50, %50
  %64 = call ptr @CopyMem(ptr noundef nonnull %7, ptr noundef nonnull %48, i64 noundef 7) #3
  %65 = getelementptr inbounds i8, ptr %7, i64 2
  %66 = load i16, ptr %65, align 1, !tbaa !43
  %67 = zext i16 %66 to i32
  %68 = add nuw nsw i32 %67, 1
  %69 = lshr i32 %68, 1
  %70 = getelementptr inbounds i8, ptr %7, i64 4
  %71 = load i16, ptr %70, align 1, !tbaa !46
  %72 = zext i16 %71 to i32
  %73 = mul nuw nsw i32 %69, %72
  %narrow = add nuw nsw i32 %73, 6
  br label %97

74:                                               ; preds = %50, %50
  %75 = call ptr @CopyMem(ptr noundef nonnull %8, ptr noundef nonnull %48, i64 noundef 7) #3
  %76 = getelementptr inbounds i8, ptr %8, i64 2
  %77 = load i16, ptr %76, align 1, !tbaa !47
  %78 = zext i16 %77 to i32
  %79 = getelementptr inbounds i8, ptr %8, i64 4
  %80 = load i16, ptr %79, align 1, !tbaa !50
  %81 = zext i16 %80 to i32
  %82 = mul nuw i32 %81, %78
  %83 = add nuw i32 %82, 6
  br label %97

84:                                               ; preds = %50, %50
  %85 = getelementptr inbounds i8, ptr %48, i64 1
  %86 = call ptr @CopyMem(ptr noundef nonnull %9, ptr noundef nonnull %85, i64 noundef 2) #3
  %87 = getelementptr inbounds i8, ptr %48, i64 3
  %88 = call ptr @CopyMem(ptr noundef nonnull %10, ptr noundef nonnull %87, i64 noundef 2) #3
  %89 = load i16, ptr %9, align 2, !tbaa !32
  %90 = zext i16 %89 to i32
  %91 = load i16, ptr %10, align 2, !tbaa !32
  %92 = zext i16 %91 to i32
  %93 = mul nuw nsw i32 %90, 3
  %94 = mul i32 %93, %92
  %95 = add i32 %94, 5
  br label %97

96:                                               ; preds = %50
  br label %.thread

97:                                               ; preds = %84, %74, %63, %52
  %.095 = phi i32 [ %95, %84 ], [ %83, %74 ], [ %narrow, %63 ], [ %narrow107, %52 ]
  %98 = getelementptr inbounds i8, ptr %3, i64 4
  %99 = load i16, ptr %98, align 4, !tbaa !51
  %100 = zext i16 %99 to i32
  %101 = getelementptr inbounds i8, ptr %3, i64 6
  %102 = load i16, ptr %101, align 2, !tbaa !52
  %103 = zext i16 %102 to i32
  %104 = mul nuw nsw i32 %100, 3
  %105 = mul i32 %104, %103
  %106 = add i32 %105, 5
  %107 = zext i32 %106 to i64
  %108 = call ptr @AllocateZeroPool(i64 noundef %107) #3
  %109 = icmp eq ptr %108, null
  br i1 %109, label %.thread, label %110

110:                                              ; preds = %97
  %111 = load i32, ptr %3, align 8, !tbaa !53
  %112 = and i32 %111, 1
  %.not108 = icmp eq i32 %112, 0
  %. = select i1 %.not108, i8 22, i8 23
  store i8 %., ptr %108, align 1, !tbaa !37
  %113 = getelementptr inbounds i8, ptr %108, i64 1
  %114 = call ptr @CopyMem(ptr noundef nonnull %113, ptr noundef nonnull %98, i64 noundef 2) #3
  %115 = getelementptr inbounds i8, ptr %108, i64 3
  %116 = call ptr @CopyMem(ptr noundef nonnull %115, ptr noundef nonnull %101, i64 noundef 2) #3
  %117 = getelementptr inbounds i8, ptr %108, i64 5
  %118 = load ptr, ptr %15, align 8, !tbaa !5
  %119 = load i16, ptr %98, align 4, !tbaa !51
  %120 = zext i16 %119 to i64
  %121 = load i16, ptr %101, align 2, !tbaa !52
  %122 = zext i16 %121 to i64
  %123 = mul nuw nsw i64 %122, %120
  call void @CopyGopToRgbPixel(ptr noundef nonnull %117, ptr noundef %118, i64 noundef %123)
  %124 = getelementptr inbounds i8, ptr %43, i64 12
  %125 = load i32, ptr %124, align 4, !tbaa !54
  %126 = sub i32 %106, %.095
  %127 = add i32 %126, %125
  %128 = zext i32 %127 to i64
  %129 = call ptr @AllocateZeroPool(i64 noundef %128) #3
  %130 = icmp eq ptr %129, null
  br i1 %130, label %131, label %132

131:                                              ; preds = %110
  call void @FreePool(ptr noundef nonnull %108) #3
  br label %.thread

132:                                              ; preds = %110
  %133 = load ptr, ptr %46, align 8, !tbaa !33
  %134 = ptrtoint ptr %48 to i64
  %135 = ptrtoint ptr %133 to i64
  %136 = sub i64 %134, %135
  %137 = trunc i64 %136 to i32
  %138 = load i32, ptr %124, align 4, !tbaa !54
  %139 = add i32 %.095, %137
  %140 = sub i32 %138, %139
  %141 = and i64 %136, 4294967295
  %142 = call ptr @CopyMem(ptr noundef nonnull %129, ptr noundef %133, i64 noundef %141) #3
  %143 = getelementptr inbounds i8, ptr %129, i64 %141
  %144 = call ptr @CopyMem(ptr noundef nonnull %143, ptr noundef nonnull %108, i64 noundef %107) #3
  %145 = getelementptr inbounds i8, ptr %143, i64 %107
  %146 = zext i32 %.095 to i64
  %147 = getelementptr inbounds i8, ptr %48, i64 %146
  %148 = zext i32 %140 to i64
  %149 = call ptr @CopyMem(ptr noundef nonnull %145, ptr noundef nonnull %147, i64 noundef %148) #3
  %150 = load ptr, ptr %46, align 8, !tbaa !33
  call void @FreePool(ptr noundef %150) #3
  call void @FreePool(ptr noundef nonnull %108) #3
  store ptr %129, ptr %46, align 8, !tbaa !33
  store i32 %127, ptr %124, align 4, !tbaa !54
  %151 = load i32, ptr %43, align 8
  %152 = add i32 %151, %126
  %153 = and i32 %152, 16777215
  %154 = and i32 %151, -16777216
  %155 = or disjoint i32 %153, %154
  store i32 %155, ptr %43, align 8
  %156 = getelementptr inbounds i8, ptr %39, i64 16
  %157 = load i32, ptr %156, align 8, !tbaa !55
  %158 = add i32 %157, %126
  store i32 %158, ptr %156, align 8, !tbaa !55
  br label %.thread

.thread:                                          ; preds = %27, %97, %50, %45, %41, %37, %18, %4, %14, %132, %131, %96
  %.0 = phi i64 [ -9223372036854775794, %96 ], [ -9223372036854775799, %131 ], [ 0, %132 ], [ -9223372036854775806, %14 ], [ -9223372036854775806, %4 ], [ -9223372036854775794, %18 ], [ -9223372036854775794, %37 ], [ -9223372036854775794, %41 ], [ -9223372036854775794, %45 ], [ -9223372036854775805, %50 ], [ -9223372036854775799, %97 ], [ -9223372036854775794, %27 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #3
  ret i64 %.0
}

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 = { mustprogress 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, !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 = !{!30, !11, i64 104}
!30 = !{!"_HII_DATABASE_PACKAGE_LIST_INSTANCE", !31, 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}
!31 = !{!"", !21, i64 0, !7, i64 16}
!32 = !{!10, !10, i64 0}
!33 = !{!34, !11, i64 24}
!34 = !{!"_HII_IMAGE_PACKAGE_INSTANCE", !35, i64 0, !7, i64 12, !7, i64 16, !11, i64 24, !11, i64 32}
!35 = !{!"_EFI_HII_IMAGE_PACKAGE_HDR", !36, i64 0, !7, i64 4, !7, i64 8}
!36 = !{!"", !7, i64 0, !7, i64 3}
!37 = !{!8, !8, i64 0}
!38 = !{!39, !10, i64 2}
!39 = !{!"_EFI_HII_IIBT_IMAGE_1BIT_BLOCK", !40, i64 0, !8, i64 1, !41, i64 2}
!40 = !{!"_EFI_HII_IMAGE_BLOCK", !8, i64 0}
!41 = !{!"_EFI_HII_IIBT_IMAGE_1BIT_BASE", !10, i64 0, !10, i64 2, !8, i64 4}
!42 = !{!39, !10, i64 4}
!43 = !{!44, !10, i64 2}
!44 = !{!"_EFI_HII_IIBT_IMAGE_4BIT_BLOCK", !40, i64 0, !8, i64 1, !45, i64 2}
!45 = !{!"_EFI_HII_IIBT_IMAGE_4BIT_BASE", !10, i64 0, !10, i64 2, !8, i64 4}
!46 = !{!44, !10, i64 4}
!47 = !{!48, !10, i64 2}
!48 = !{!"_EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK", !40, i64 0, !8, i64 1, !49, i64 2}
!49 = !{!"_EFI_HII_IIBT_IMAGE_8BIT_BASE", !10, i64 0, !10, i64 2, !8, i64 4}
!50 = !{!48, !10, i64 4}
!51 = !{!6, !10, i64 4}
!52 = !{!6, !10, i64 6}
!53 = !{!6, !7, i64 0}
!54 = !{!34, !7, i64 12}
!55 = !{!30, !7, i64 16}


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