; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/ShellPkg/Library (HBufferImageRestoreMousePosition)

; 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.HEFI_EDITOR_BUFFER_IMAGE = type { ptr, ptr, i64, ptr, %struct.HEFI_EDITOR_POSITION, %struct.HEFI_EDITOR_POSITION, %struct.HEFI_EDITOR_POSITION, i64, i8, i8, i32, ptr, ptr, ptr }
%struct.HEFI_EDITOR_POSITION = type { i64, i64 }
%struct.HEFI_EDITOR_GLOBAL_EDITOR = type { ptr, %union.HEFI_EDITOR_COLOR_UNION, %struct.HEFI_EDITOR_POSITION, i8, ptr, i32, i32, i64, i64 }
%union.HEFI_EDITOR_COLOR_UNION = type { i64 }
%struct.EFI_SYSTEM_TABLE = type { %struct.EFI_TABLE_HEADER, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._HEFI_EDITOR_LINE = type { i64, [16 x i8], i64, %struct._LIST_ENTRY }
%struct._LIST_ENTRY = type { ptr, ptr }

@HBufferImage = external dso_local global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@HBufferImageMouseNeedRefresh = external dso_local global i8, align 1
@HBufferImageBackupVar = external dso_local global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@HMainEditor = external global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@HEditorMouseAction = external global i8, align 1
@gST = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [2 x i32], align 4
@.str.9 = external hidden unnamed_addr constant [3 x i32], align 4

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

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

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

declare i64 @ShellPrintEx(i32 noundef, i32 noundef, ptr noundef, ...) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @HBufferImageRestoreMousePosition() #3 {
  %1 = alloca i64, align 8
  %2 = alloca %union.HEFI_EDITOR_COLOR_UNION, align 8
  %3 = alloca %union.HEFI_EDITOR_COLOR_UNION, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  %12 = load i8, ptr getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 3), align 8, !tbaa !9
  %13 = icmp ne i8 %12, 0
  br i1 %13, label %14, label %275

14:                                               ; preds = %0
  %15 = load i8, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !14
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %274

17:                                               ; preds = %14
  store i8 0, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !14
  %18 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !15
  %19 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), align 8, !tbaa !15
  %20 = icmp eq i64 %18, %19
  br i1 %20, label %21, label %30

21:                                               ; preds = %17
  %22 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %23 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %24 = icmp eq i64 %22, %23
  br i1 %24, label %25, label %30

25:                                               ; preds = %21
  %26 = load i8, ptr @HEditorMouseAction, align 1, !tbaa !14
  %27 = zext i8 %26 to i32
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %25
  store i64 0, ptr %1, align 8
  store i32 1, ptr %11, align 4
  br label %276

30:                                               ; preds = %25, %21, %17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %2, ptr align 8 getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 1), i64 8, i1 false), !tbaa.struct !18
  store i64 0, ptr %3, align 8, !tbaa !14
  %31 = load i8, ptr %2, align 8
  %32 = lshr i8 %31, 4
  %33 = zext i8 %32 to i32
  %34 = and i32 %33, 15
  %35 = trunc i32 %34 to i8
  %36 = load i8, ptr %3, align 8
  %37 = and i8 %35, 15
  %38 = and i8 %36, -16
  %39 = or i8 %38, %37
  store i8 %39, ptr %3, align 8
  %40 = zext i8 %37 to i32
  %41 = load i8, ptr %2, align 8
  %42 = and i8 %41, 15
  %43 = zext i8 %42 to i32
  %44 = and i32 %43, 7
  %45 = trunc i32 %44 to i8
  %46 = load i8, ptr %3, align 8
  %47 = and i8 %45, 15
  %48 = shl i8 %47, 4
  %49 = and i8 %46, 15
  %50 = or i8 %49, %48
  store i8 %50, ptr %3, align 8
  %51 = zext i8 %47 to i32
  %52 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), align 8, !tbaa !15
  %53 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %54 = call zeroext i8 @HBufferImageIsInSelectedArea(i64 noundef %52, i64 noundef %53)
  %55 = icmp ne i8 %54, 0
  br i1 %55, label %67, label %56

56:                                               ; preds = %30
  %57 = load ptr, ptr @gST, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %57, i32 0, i32 6
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = getelementptr inbounds %struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = load ptr, ptr @gST, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %62, i32 0, i32 6
  %64 = load ptr, ptr %63, align 8, !tbaa !19
  %65 = load i64, ptr %2, align 8, !tbaa !14
  %66 = call i64 %61(ptr noundef %64, i64 noundef %65)
  br label %79

67:                                               ; preds = %30
  %68 = load ptr, ptr @gST, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %68, i32 0, i32 6
  %70 = load ptr, ptr %69, align 8, !tbaa !19
  %71 = getelementptr inbounds %struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, ptr %70, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !22
  %73 = load ptr, ptr @gST, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %73, i32 0, i32 6
  %75 = load ptr, ptr %74, align 8, !tbaa !19
  %76 = load i64, ptr %3, align 8, !tbaa !14
  %77 = and i64 %76, 127
  %78 = call i64 %72(ptr noundef %75, i64 noundef %77)
  br label %79

79:                                               ; preds = %67, %56
  %80 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 7), align 8, !tbaa !24
  %81 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), align 8, !tbaa !15
  %82 = add i64 %80, %81
  %83 = sub i64 %82, 2
  store i64 %83, ptr %4, align 8, !tbaa !25
  %84 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %85 = call zeroext i8 @HBufferImageIsAtHighBits(i64 noundef %84, ptr noundef %5)
  store i8 %85, ptr %10, align 1, !tbaa !14
  store i8 1, ptr %6, align 1, !tbaa !14
  %86 = load i64, ptr %4, align 8, !tbaa !25
  %87 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 2), align 8, !tbaa !26
  %88 = icmp ugt i64 %86, %87
  br i1 %88, label %92, label %89

89:                                               ; preds = %79
  %90 = load i64, ptr %5, align 8, !tbaa !25
  %91 = icmp eq i64 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %89, %79
  store i8 0, ptr %6, align 1, !tbaa !14
  br label %110

93:                                               ; preds = %89
  %94 = load ptr, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !27
  store ptr %94, ptr %7, align 8, !tbaa !5
  %95 = load i64, ptr %4, align 8, !tbaa !25
  %96 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 6), align 8, !tbaa !28
  %97 = sub i64 %95, %96
  %98 = call ptr @HMoveLine(i64 noundef %97)
  store ptr %98, ptr %8, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = icmp eq ptr %99, null
  br i1 %100, label %107, label %101

101:                                              ; preds = %93
  %102 = load i64, ptr %5, align 8, !tbaa !25
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %103, i32 0, i32 2
  %105 = load i64, ptr %104, align 8, !tbaa !29
  %106 = icmp ugt i64 %102, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %101, %93
  store i8 0, ptr %6, align 1, !tbaa !14
  br label %108

108:                                              ; preds = %107, %101
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %109, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !27
  br label %110

110:                                              ; preds = %108, %92
  %111 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %112 = trunc i64 %111 to i32
  %113 = sub nsw i32 %112, 1
  %114 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), align 8, !tbaa !15
  %115 = trunc i64 %114 to i32
  %116 = sub nsw i32 %115, 1
  %117 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %113, i32 noundef %116, ptr noundef @.str.7)
  %118 = load i8, ptr %6, align 1, !tbaa !14
  %119 = icmp ne i8 %118, 0
  br i1 %119, label %120, label %157

120:                                              ; preds = %110
  %121 = load i8, ptr %10, align 1, !tbaa !14
  %122 = icmp ne i8 %121, 0
  br i1 %122, label %123, label %137

123:                                              ; preds = %120
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %124, i32 0, i32 1
  %126 = load i64, ptr %5, align 8, !tbaa !25
  %127 = sub i64 %126, 1
  %128 = getelementptr inbounds [16 x i8], ptr %125, i64 0, i64 %127
  %129 = load i8, ptr %128, align 1, !tbaa !14
  %130 = zext i8 %129 to i32
  %131 = and i32 %130, 240
  %132 = trunc i32 %131 to i8
  store i8 %132, ptr %9, align 1, !tbaa !14
  %133 = load i8, ptr %9, align 1, !tbaa !14
  %134 = zext i8 %133 to i32
  %135 = ashr i32 %134, 4
  %136 = trunc i32 %135 to i8
  store i8 %136, ptr %9, align 1, !tbaa !14
  br label %147

137:                                              ; preds = %120
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %138, i32 0, i32 1
  %140 = load i64, ptr %5, align 8, !tbaa !25
  %141 = sub i64 %140, 1
  %142 = getelementptr inbounds [16 x i8], ptr %139, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !14
  %144 = zext i8 %143 to i32
  %145 = and i32 %144, 15
  %146 = trunc i32 %145 to i8
  store i8 %146, ptr %9, align 1, !tbaa !14
  br label %147

147:                                              ; preds = %137, %123
  %148 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %149 = trunc i64 %148 to i32
  %150 = sub nsw i32 %149, 1
  %151 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImageBackupVar, i32 0, i32 5), align 8, !tbaa !15
  %152 = trunc i64 %151 to i32
  %153 = sub nsw i32 %152, 1
  %154 = load i8, ptr %9, align 1, !tbaa !14
  %155 = zext i8 %154 to i32
  %156 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %150, i32 noundef %153, ptr noundef @.str.9, i32 noundef %155)
  br label %157

157:                                              ; preds = %147, %110
  %158 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !15
  %159 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %160 = call zeroext i8 @HBufferImageIsInSelectedArea(i64 noundef %158, i64 noundef %159)
  %161 = icmp ne i8 %160, 0
  br i1 %161, label %174, label %162

162:                                              ; preds = %157
  %163 = load ptr, ptr @gST, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %163, i32 0, i32 6
  %165 = load ptr, ptr %164, align 8, !tbaa !19
  %166 = getelementptr inbounds %struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, ptr %165, i32 0, i32 5
  %167 = load ptr, ptr %166, align 8, !tbaa !22
  %168 = load ptr, ptr @gST, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %168, i32 0, i32 6
  %170 = load ptr, ptr %169, align 8, !tbaa !19
  %171 = load i64, ptr %3, align 8, !tbaa !14
  %172 = and i64 %171, 127
  %173 = call i64 %167(ptr noundef %170, i64 noundef %172)
  br label %185

174:                                              ; preds = %157
  %175 = load ptr, ptr @gST, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %175, i32 0, i32 6
  %177 = load ptr, ptr %176, align 8, !tbaa !19
  %178 = getelementptr inbounds %struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, ptr %177, i32 0, i32 5
  %179 = load ptr, ptr %178, align 8, !tbaa !22
  %180 = load ptr, ptr @gST, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %180, i32 0, i32 6
  %182 = load ptr, ptr %181, align 8, !tbaa !19
  %183 = load i64, ptr %2, align 8, !tbaa !14
  %184 = call i64 %179(ptr noundef %182, i64 noundef %183)
  br label %185

185:                                              ; preds = %174, %162
  %186 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 7), align 8, !tbaa !24
  %187 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !15
  %188 = add i64 %186, %187
  %189 = sub i64 %188, 2
  store i64 %189, ptr %4, align 8, !tbaa !25
  %190 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %191 = call zeroext i8 @HBufferImageIsAtHighBits(i64 noundef %190, ptr noundef %5)
  store i8 %191, ptr %10, align 1, !tbaa !14
  store i8 1, ptr %6, align 1, !tbaa !14
  %192 = load i64, ptr %4, align 8, !tbaa !25
  %193 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 2), align 8, !tbaa !26
  %194 = icmp ugt i64 %192, %193
  br i1 %194, label %198, label %195

195:                                              ; preds = %185
  %196 = load i64, ptr %5, align 8, !tbaa !25
  %197 = icmp eq i64 %196, 0
  br i1 %197, label %198, label %199

198:                                              ; preds = %195, %185
  store i8 0, ptr %6, align 1, !tbaa !14
  br label %216

199:                                              ; preds = %195
  %200 = load ptr, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !27
  store ptr %200, ptr %7, align 8, !tbaa !5
  %201 = load i64, ptr %4, align 8, !tbaa !25
  %202 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 6), align 8, !tbaa !28
  %203 = sub i64 %201, %202
  %204 = call ptr @HMoveLine(i64 noundef %203)
  store ptr %204, ptr %8, align 8, !tbaa !5
  %205 = load ptr, ptr %8, align 8, !tbaa !5
  %206 = icmp eq ptr %205, null
  br i1 %206, label %213, label %207

207:                                              ; preds = %199
  %208 = load i64, ptr %5, align 8, !tbaa !25
  %209 = load ptr, ptr %8, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %209, i32 0, i32 2
  %211 = load i64, ptr %210, align 8, !tbaa !29
  %212 = icmp ugt i64 %208, %211
  br i1 %212, label %213, label %214

213:                                              ; preds = %207, %199
  store i8 0, ptr %6, align 1, !tbaa !14
  br label %214

214:                                              ; preds = %213, %207
  %215 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %215, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !27
  br label %216

216:                                              ; preds = %214, %198
  %217 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %218 = trunc i64 %217 to i32
  %219 = sub nsw i32 %218, 1
  %220 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !15
  %221 = trunc i64 %220 to i32
  %222 = sub nsw i32 %221, 1
  %223 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %219, i32 noundef %222, ptr noundef @.str.7)
  %224 = load i8, ptr %6, align 1, !tbaa !14
  %225 = icmp ne i8 %224, 0
  br i1 %225, label %226, label %263

226:                                              ; preds = %216
  %227 = load i8, ptr %10, align 1, !tbaa !14
  %228 = icmp ne i8 %227, 0
  br i1 %228, label %229, label %243

229:                                              ; preds = %226
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %230, i32 0, i32 1
  %232 = load i64, ptr %5, align 8, !tbaa !25
  %233 = sub i64 %232, 1
  %234 = getelementptr inbounds [16 x i8], ptr %231, i64 0, i64 %233
  %235 = load i8, ptr %234, align 1, !tbaa !14
  %236 = zext i8 %235 to i32
  %237 = and i32 %236, 240
  %238 = trunc i32 %237 to i8
  store i8 %238, ptr %9, align 1, !tbaa !14
  %239 = load i8, ptr %9, align 1, !tbaa !14
  %240 = zext i8 %239 to i32
  %241 = ashr i32 %240, 4
  %242 = trunc i32 %241 to i8
  store i8 %242, ptr %9, align 1, !tbaa !14
  br label %253

243:                                              ; preds = %226
  %244 = load ptr, ptr %8, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %244, i32 0, i32 1
  %246 = load i64, ptr %5, align 8, !tbaa !25
  %247 = sub i64 %246, 1
  %248 = getelementptr inbounds [16 x i8], ptr %245, i64 0, i64 %247
  %249 = load i8, ptr %248, align 1, !tbaa !14
  %250 = zext i8 %249 to i32
  %251 = and i32 %250, 15
  %252 = trunc i32 %251 to i8
  store i8 %252, ptr %9, align 1, !tbaa !14
  br label %253

253:                                              ; preds = %243, %229
  %254 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), i32 0, i32 1), align 8, !tbaa !17
  %255 = trunc i64 %254 to i32
  %256 = sub nsw i32 %255, 1
  %257 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !15
  %258 = trunc i64 %257 to i32
  %259 = sub nsw i32 %258, 1
  %260 = load i8, ptr %9, align 1, !tbaa !14
  %261 = zext i8 %260 to i32
  %262 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %256, i32 noundef %259, ptr noundef @.str.9, i32 noundef %261)
  br label %263

263:                                              ; preds = %253, %216
  %264 = load ptr, ptr @gST, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %264, i32 0, i32 6
  %266 = load ptr, ptr %265, align 8, !tbaa !19
  %267 = getelementptr inbounds %struct._EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL, ptr %266, i32 0, i32 5
  %268 = load ptr, ptr %267, align 8, !tbaa !22
  %269 = load ptr, ptr @gST, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.EFI_SYSTEM_TABLE, ptr %269, i32 0, i32 6
  %271 = load ptr, ptr %270, align 8, !tbaa !19
  %272 = load i64, ptr %2, align 8, !tbaa !14
  %273 = call i64 %268(ptr noundef %271, i64 noundef %272)
  br label %274

274:                                              ; preds = %263, %14
  br label %275

275:                                              ; preds = %274, %0
  store i64 0, ptr %1, align 8
  store i32 1, ptr %11, align 4
  br label %276

276:                                              ; preds = %275, %29
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  %277 = load i64, ptr %1, align 8
  ret i64 %277
}

declare ptr @HMoveLine(i64 noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 32}
!10 = !{!"", !6, i64 0, !7, i64 8, !11, i64 16, !7, i64 32, !6, i64 40, !13, i64 48, !13, i64 52, !12, i64 56, !12, i64 64}
!11 = !{!"", !12, i64 0, !12, i64 8}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !12, i64 48}
!16 = !{!"", !6, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !11, i64 32, !11, i64 48, !11, i64 64, !12, i64 80, !7, i64 88, !7, i64 89, !13, i64 92, !6, i64 96, !6, i64 104, !6, i64 112}
!17 = !{!16, !12, i64 56}
!18 = !{i64 0, i64 8, !14}
!19 = !{!20, !6, i64 64}
!20 = !{!"", !21, i64 0, !6, i64 24, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !6, i64 112}
!21 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!22 = !{!23, !6, i64 40}
!23 = !{!"_EFI_SIMPLE_TEXT_OUTPUT_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}
!24 = !{!16, !12, i64 80}
!25 = !{!12, !12, i64 0}
!26 = !{!16, !12, i64 16}
!27 = !{!16, !6, i64 24}
!28 = !{!16, !12, i64 64}
!29 = !{!30, !12, i64 24}
!30 = !{!"_HEFI_EDITOR_LINE", !12, i64 0, !7, i64 8, !12, i64 24, !31, i64 32}
!31 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}


; 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.HEFI_EDITOR_BUFFER_IMAGE = type { ptr, ptr, i64, ptr, %struct.HEFI_EDITOR_POSITION, %struct.HEFI_EDITOR_POSITION, %struct.HEFI_EDITOR_POSITION, i64, i8, i8, i32, ptr, ptr, ptr }
%struct.HEFI_EDITOR_POSITION = type { i64, i64 }
%struct.HEFI_EDITOR_GLOBAL_EDITOR = type { ptr, %union.HEFI_EDITOR_COLOR_UNION, %struct.HEFI_EDITOR_POSITION, i8, ptr, i32, i32, i64, i64 }
%union.HEFI_EDITOR_COLOR_UNION = type { i64 }

@HBufferImage = external dso_local local_unnamed_addr global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@HBufferImageMouseNeedRefresh = external dso_local local_unnamed_addr global i8, align 1
@HBufferImageBackupVar = external dso_local local_unnamed_addr global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@HMainEditor = external local_unnamed_addr global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@HEditorMouseAction = external local_unnamed_addr global i8, align 1
@gST = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [2 x i32], align 4
@.str.9 = external hidden unnamed_addr constant [3 x i32], align 4

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

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

declare i64 @ShellPrintEx(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @HBufferImageRestoreMousePosition() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @HMainEditor, i64 32), align 8, !tbaa !5
  %3 = icmp ne i8 %2, 0
  %4 = load i8, ptr @HBufferImageMouseNeedRefresh, align 1
  %5 = icmp ne i8 %4, 0
  %or.cond8 = select i1 %3, i1 %5, i1 false
  br i1 %or.cond8, label %6, label %140

6:                                                ; preds = %0
  store i8 0, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !13
  %7 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !14
  %8 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 48), align 8, !tbaa !14
  %9 = icmp eq i64 %7, %8
  %.pre = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 56), align 8, !tbaa !16
  br i1 %9, label %10, label %15

10:                                               ; preds = %6
  %11 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !16
  %12 = icmp eq i64 %11, %.pre
  %13 = load i8, ptr @HEditorMouseAction, align 1
  %14 = icmp ne i8 %13, 0
  %or.cond = select i1 %12, i1 %14, i1 false
  br i1 %or.cond, label %140, label %15

15:                                               ; preds = %10, %6
  %.sroa.041.0.copyload = load i8, ptr getelementptr inbounds (i8, ptr @HMainEditor, i64 8), align 8
  %.sroa.8.sroa.0.0.copyload = load i56, ptr getelementptr inbounds (i8, ptr @HMainEditor, i64 9), align 1, !tbaa !13
  %16 = lshr i8 %.sroa.041.0.copyload, 4
  %17 = shl i8 %.sroa.041.0.copyload, 4
  %18 = and i8 %17, 112
  %19 = or disjoint i8 %18, %16
  %20 = tail call zeroext i8 @HBufferImageIsInSelectedArea(i64 noundef %8, i64 noundef %.pre)
  %.not = icmp eq i8 %20, 0
  %21 = load ptr, ptr @gST, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %21, i64 64
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %23, i64 40
  %25 = load ptr, ptr %24, align 8, !tbaa !21
  %.sroa.0.0.insert.ext = zext nneg i8 %19 to i64
  %.sroa.8.0.insert.ext = zext i56 %.sroa.8.sroa.0.0.copyload to i64
  %.sroa.8.0.insert.shift = shl nuw i64 %.sroa.8.0.insert.ext, 8
  %.sroa.041.0.insert.ext = zext i8 %.sroa.041.0.copyload to i64
  %.sroa.041.0.insert.insert = or disjoint i64 %.sroa.8.0.insert.shift, %.sroa.041.0.insert.ext
  %.sroa.0.0.insert.ext.sink = select i1 %.not, i64 %.sroa.041.0.insert.insert, i64 %.sroa.0.0.insert.ext
  %26 = tail call i64 %25(ptr noundef %23, i64 noundef %.sroa.0.0.insert.ext.sink) #3
  %27 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 80), align 8, !tbaa !23
  %28 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 48), align 8, !tbaa !14
  %29 = add i64 %27, -2
  %30 = add i64 %29, %28
  %31 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 56), align 8, !tbaa !16
  %32 = call zeroext i8 @HBufferImageIsAtHighBits(i64 noundef %31, ptr noundef nonnull %1)
  %33 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 16), align 8, !tbaa !24
  %34 = icmp ugt i64 %30, %33
  %35 = load i64, ptr %1, align 8
  %36 = icmp eq i64 %35, 0
  %or.cond4 = select i1 %34, i1 true, i1 %36
  br i1 %or.cond4, label %51, label %37

37:                                               ; preds = %15
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !25
  %39 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 64), align 8, !tbaa !26
  %40 = sub i64 %30, %39
  %41 = call ptr @HMoveLine(i64 noundef %40) #3
  %42 = icmp eq ptr %41, null
  br i1 %42, label %48, label %43

43:                                               ; preds = %37
  %44 = load i64, ptr %1, align 8, !tbaa !27
  %45 = getelementptr inbounds i8, ptr %41, i64 24
  %46 = load i64, ptr %45, align 8, !tbaa !28
  %47 = icmp ugt i64 %44, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %43, %37
  br label %49

49:                                               ; preds = %48, %43
  %50 = phi i1 [ true, %48 ], [ false, %43 ]
  store ptr %38, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !25
  br label %51

51:                                               ; preds = %15, %49
  %.168 = phi i1 [ %50, %49 ], [ true, %15 ]
  %.065 = phi ptr [ %41, %49 ], [ null, %15 ]
  %52 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 56), align 8, !tbaa !16
  %53 = trunc i64 %52 to i32
  %54 = add nsw i32 %53, -1
  %55 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 48), align 8, !tbaa !14
  %56 = trunc i64 %55 to i32
  %57 = add nsw i32 %56, -1
  %58 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %54, i32 noundef %57, ptr noundef nonnull @.str.7) #3
  br i1 %.168, label %75, label %59

59:                                               ; preds = %51
  %.not75 = icmp eq i8 %32, 0
  %60 = getelementptr inbounds i8, ptr %.065, i64 8
  %61 = load i64, ptr %1, align 8, !tbaa !27
  %62 = add i64 %61, -1
  %63 = getelementptr inbounds [16 x i8], ptr %60, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !13
  %65 = lshr i8 %64, 4
  %66 = and i8 %64, 15
  %.0 = select i1 %.not75, i8 %66, i8 %65
  %67 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 56), align 8, !tbaa !16
  %68 = trunc i64 %67 to i32
  %69 = add nsw i32 %68, -1
  %70 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImageBackupVar, i64 48), align 8, !tbaa !14
  %71 = trunc i64 %70 to i32
  %72 = add nsw i32 %71, -1
  %73 = zext nneg i8 %.0 to i32
  %74 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %69, i32 noundef %72, ptr noundef nonnull @.str.9, i32 noundef %73) #3
  br label %75

75:                                               ; preds = %59, %51
  %76 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !14
  %77 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !16
  %78 = call zeroext i8 @HBufferImageIsInSelectedArea(i64 noundef %76, i64 noundef %77)
  %.not76 = icmp eq i8 %78, 0
  %79 = load ptr, ptr @gST, align 8, !tbaa !17
  %80 = getelementptr inbounds i8, ptr %79, i64 64
  %81 = load ptr, ptr %80, align 8, !tbaa !18
  %82 = getelementptr inbounds i8, ptr %81, i64 40
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  %.sroa.8.0.insert.ext53 = zext i56 %.sroa.8.sroa.0.0.copyload to i64
  %.sroa.8.0.insert.shift54 = shl nuw i64 %.sroa.8.0.insert.ext53, 8
  %.sroa.041.0.insert.ext45 = zext i8 %.sroa.041.0.copyload to i64
  %.sroa.041.0.insert.insert47 = or disjoint i64 %.sroa.8.0.insert.shift54, %.sroa.041.0.insert.ext45
  %.sroa.0.0.insert.ext32 = zext nneg i8 %19 to i64
  %.sroa.041.0.insert.insert47.sink = select i1 %.not76, i64 %.sroa.0.0.insert.ext32, i64 %.sroa.041.0.insert.insert47
  %84 = call i64 %83(ptr noundef %81, i64 noundef %.sroa.041.0.insert.insert47.sink) #3
  %85 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 80), align 8, !tbaa !23
  %86 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !14
  %87 = add i64 %85, -2
  %88 = add i64 %87, %86
  %89 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !16
  %90 = call zeroext i8 @HBufferImageIsAtHighBits(i64 noundef %89, ptr noundef nonnull %1)
  %91 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 16), align 8, !tbaa !24
  %92 = icmp ugt i64 %88, %91
  %93 = load i64, ptr %1, align 8
  %94 = icmp eq i64 %93, 0
  %or.cond6 = select i1 %92, i1 true, i1 %94
  br i1 %or.cond6, label %109, label %95

95:                                               ; preds = %75
  %96 = load ptr, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !25
  %97 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 64), align 8, !tbaa !26
  %98 = sub i64 %88, %97
  %99 = call ptr @HMoveLine(i64 noundef %98) #3
  %100 = icmp eq ptr %99, null
  br i1 %100, label %106, label %101

101:                                              ; preds = %95
  %102 = load i64, ptr %1, align 8, !tbaa !27
  %103 = getelementptr inbounds i8, ptr %99, i64 24
  %104 = load i64, ptr %103, align 8, !tbaa !28
  %105 = icmp ugt i64 %102, %104
  br i1 %105, label %106, label %107

106:                                              ; preds = %101, %95
  br label %107

107:                                              ; preds = %106, %101
  %108 = phi i1 [ true, %106 ], [ false, %101 ]
  store ptr %96, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !25
  br label %109

109:                                              ; preds = %75, %107
  %.3 = phi i1 [ %108, %107 ], [ true, %75 ]
  %.166 = phi ptr [ %99, %107 ], [ %.065, %75 ]
  %110 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !16
  %111 = trunc i64 %110 to i32
  %112 = add nsw i32 %111, -1
  %113 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !14
  %114 = trunc i64 %113 to i32
  %115 = add nsw i32 %114, -1
  %116 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %112, i32 noundef %115, ptr noundef nonnull @.str.7) #3
  br i1 %.3, label %133, label %117

117:                                              ; preds = %109
  %.not78 = icmp eq i8 %90, 0
  %118 = getelementptr inbounds i8, ptr %.166, i64 8
  %119 = load i64, ptr %1, align 8, !tbaa !27
  %120 = add i64 %119, -1
  %121 = getelementptr inbounds [16 x i8], ptr %118, i64 0, i64 %120
  %122 = load i8, ptr %121, align 1, !tbaa !13
  %123 = lshr i8 %122, 4
  %124 = and i8 %122, 15
  %.1 = select i1 %.not78, i8 %124, i8 %123
  %125 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !16
  %126 = trunc i64 %125 to i32
  %127 = add nsw i32 %126, -1
  %128 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !14
  %129 = trunc i64 %128 to i32
  %130 = add nsw i32 %129, -1
  %131 = zext nneg i8 %.1 to i32
  %132 = call i64 (i32, i32, ptr, ...) @ShellPrintEx(i32 noundef %127, i32 noundef %130, ptr noundef nonnull @.str.9, i32 noundef %131) #3
  br label %133

133:                                              ; preds = %117, %109
  %134 = load ptr, ptr @gST, align 8, !tbaa !17
  %135 = getelementptr inbounds i8, ptr %134, i64 64
  %136 = load ptr, ptr %135, align 8, !tbaa !18
  %137 = getelementptr inbounds i8, ptr %136, i64 40
  %138 = load ptr, ptr %137, align 8, !tbaa !21
  %.sroa.8.0.insert.ext58 = zext i56 %.sroa.8.sroa.0.0.copyload to i64
  %.sroa.8.0.insert.shift59 = shl nuw i64 %.sroa.8.0.insert.ext58, 8
  %.sroa.041.0.insert.ext49 = zext i8 %.sroa.041.0.copyload to i64
  %.sroa.041.0.insert.insert51 = or disjoint i64 %.sroa.8.0.insert.shift59, %.sroa.041.0.insert.ext49
  %139 = call i64 %138(ptr noundef %136, i64 noundef %.sroa.041.0.insert.insert51) #3
  br label %140

140:                                              ; preds = %0, %133, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret i64 0
}

declare ptr @HMoveLine(i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !8, i64 32}
!6 = !{!"", !7, i64 0, !8, i64 8, !10, i64 16, !8, i64 32, !7, i64 40, !12, i64 48, !12, i64 52, !11, i64 56, !11, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 8}
!11 = !{!"long long", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !11, i64 48}
!15 = !{!"", !7, i64 0, !7, i64 8, !11, i64 16, !7, i64 24, !10, i64 32, !10, i64 48, !10, i64 64, !11, i64 80, !8, i64 88, !8, i64 89, !12, i64 92, !7, i64 96, !7, i64 104, !7, i64 112}
!16 = !{!15, !11, i64 56}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !7, i64 64}
!19 = !{!"", !20, i64 0, !7, i64 24, !12, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !7, i64 112}
!20 = !{!"", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!21 = !{!22, !7, i64 40}
!22 = !{!"_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72}
!23 = !{!15, !11, i64 80}
!24 = !{!15, !11, i64 16}
!25 = !{!15, !7, i64 24}
!26 = !{!15, !11, i64 64}
!27 = !{!11, !11, i64 0}
!28 = !{!29, !11, i64 24}
!29 = !{!"_HEFI_EDITOR_LINE", !11, i64 0, !8, i64 8, !11, i64 24, !30, i64 32}
!30 = !{!"_LIST_ENTRY", !7, i64 0, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass