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

; 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_MEM_IMAGE = type { ptr, i64, i64 }
%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_PCI_ROOT_BRIDGE_IO_PROTOCOL = type { ptr, ptr, ptr, %struct.EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS, %struct.EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS, %struct.EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS = type { ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._HEFI_EDITOR_LINE = type { i64, [16 x i8], i64, %struct._LIST_ENTRY }

@HMemImage = external dso_local global %struct.HEFI_EDITOR_MEM_IMAGE, align 8
@HBufferImage = external global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@.str = external hidden unnamed_addr constant [19 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [32 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [14 x i32], align 4
@HMainEditor = external global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@.str.3 = external hidden unnamed_addr constant [164 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@HBufferImageNeedRefresh = external global i8, align 1
@HBufferImageOnlyLineNeedRefresh = external global i8, align 1
@HBufferImageMouseNeedRefresh = external global i8, align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @HMemImageSetMemOffsetSize(i64 noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @HMemImageRead(i64 noundef %0, i64 noundef %1, i8 noundef zeroext %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  store i8 %2, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i32 4, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 10), align 4, !tbaa !10
  %13 = load i64, ptr %6, align 8, !tbaa !5
  %14 = call ptr @AllocateZeroPool(i64 noundef %13)
  store ptr %14, ptr %9, align 8, !tbaa !15
  %15 = load ptr, ptr %9, align 8, !tbaa !15
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  %18 = call i64 @StatusBarSetStatusString(ptr noundef @.str)
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

19:                                               ; preds = %3
  %20 = load ptr, ptr @HMemImage, align 8, !tbaa !16
  %21 = getelementptr inbounds %struct._EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL, ptr %20, i32 0, i32 3
  %22 = getelementptr inbounds %struct.EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = load ptr, ptr @HMemImage, align 8, !tbaa !16
  %25 = load i64, ptr %5, align 8, !tbaa !5
  %26 = load i64, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !15
  %28 = call i64 %23(ptr noundef %24, i32 noundef 0, i64 noundef %25, i64 noundef %26, ptr noundef %27)
  store i64 %28, ptr %8, align 8, !tbaa !5
  %29 = load i64, ptr %8, align 8, !tbaa !5
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %19
  %32 = load ptr, ptr %9, align 8, !tbaa !15
  call void @FreePool(ptr noundef %32)
  %33 = call i64 @StatusBarSetStatusString(ptr noundef @.str.1)
  store i64 -9223372036854775807, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

34:                                               ; preds = %19
  %35 = call i64 @HBufferImageFree()
  %36 = load ptr, ptr %9, align 8, !tbaa !15
  %37 = load i64, ptr %6, align 8, !tbaa !5
  %38 = call i64 @HBufferImageBufferToList(ptr noundef %36, i64 noundef %37)
  store i64 %38, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %9, align 8, !tbaa !15
  call void @FreePool(ptr noundef %39)
  %40 = load i64, ptr %8, align 8, !tbaa !5
  %41 = icmp slt i64 %40, 0
  br i1 %41, label %42, label %45

42:                                               ; preds = %34
  %43 = call i64 @StatusBarSetStatusString(ptr noundef @.str)
  %44 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %44, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

45:                                               ; preds = %34
  %46 = load i64, ptr %5, align 8, !tbaa !5
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = call i64 @HMemImageSetMemOffsetSize(i64 noundef %46, i64 noundef %47)
  store i64 %48, ptr %8, align 8, !tbaa !5
  store i64 2, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 4), align 8, !tbaa !21
  store i64 10, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 4), i32 0, i32 1), align 8, !tbaa !22
  store i64 2, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !23
  store i64 10, 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 !24
  store i64 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 7), align 8, !tbaa !25
  store i8 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 8), align 8, !tbaa !26
  store i64 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 6), align 8, !tbaa !27
  store i64 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 6), i32 0, i32 1), align 8, !tbaa !28
  %49 = load i8, ptr %7, align 1, !tbaa !9
  %50 = icmp ne i8 %49, 0
  br i1 %50, label %69, label %51

51:                                               ; preds = %45
  %52 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 2), align 8, !tbaa !29
  %53 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef @.str.2, i64 noundef %52)
  store ptr %53, ptr %10, align 8, !tbaa !15
  %54 = load ptr, ptr %10, align 8, !tbaa !15
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = call i64 @StatusBarSetStatusString(ptr noundef @.str)
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

58:                                               ; preds = %51
  %59 = load ptr, ptr %10, align 8, !tbaa !15
  %60 = call i64 @StatusBarSetStatusString(ptr noundef %59)
  br label %61

61:                                               ; preds = %58
  %62 = load ptr, ptr %10, align 8, !tbaa !15
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %66

64:                                               ; preds = %61
  %65 = load ptr, ptr %10, align 8, !tbaa !15
  call void @FreePool(ptr noundef %65)
  store ptr null, ptr %10, align 8, !tbaa !15
  br label %66

66:                                               ; preds = %64, %61
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  store i64 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 7), align 8, !tbaa !30
  store i64 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 8), align 8, !tbaa !32
  br label %69

69:                                               ; preds = %68, %45
  %70 = load ptr, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 1), align 8, !tbaa !33
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %99

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

76:                                               ; preds = %72
  %77 = load ptr, ptr @HBufferImage, align 8, !tbaa !34
  %78 = getelementptr inbounds %struct._LIST_ENTRY, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !35
  %80 = ptrtoint ptr %79 to i64
  %81 = sub i64 %80, ptrtoint (ptr getelementptr inbounds (%struct._HEFI_EDITOR_LINE, ptr null, i32 0, i32 3) to i64)
  %82 = inttoptr i64 %81 to ptr
  %83 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %82, i32 0, i32 0
  %84 = load i64, ptr %83, align 8, !tbaa !37
  %85 = icmp ne i64 %84, 1819043173
  br i1 %85, label %86, label %90

86:                                               ; preds = %76
  call void @DebugAssert(ptr noundef @.str.3, i64 noundef 258, ptr noundef @.str.4)
  %87 = load ptr, ptr @HBufferImage, align 8, !tbaa !34
  %88 = getelementptr inbounds %struct._LIST_ENTRY, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !35
  br label %97

90:                                               ; preds = %76, %72
  %91 = load ptr, ptr @HBufferImage, align 8, !tbaa !34
  %92 = getelementptr inbounds %struct._LIST_ENTRY, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !35
  %94 = ptrtoint ptr %93 to i64
  %95 = sub i64 %94, ptrtoint (ptr getelementptr inbounds (%struct._HEFI_EDITOR_LINE, ptr null, i32 0, i32 3) to i64)
  %96 = inttoptr i64 %95 to ptr
  br label %97

97:                                               ; preds = %90, %86
  %98 = phi ptr [ %89, %86 ], [ %96, %90 ]
  store ptr %98, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !39
  br label %107

99:                                               ; preds = %69
  %100 = call ptr @HBufferImageCreateLine()
  store ptr %100, ptr %11, align 8, !tbaa !15
  %101 = load ptr, ptr %11, align 8, !tbaa !15
  %102 = icmp eq ptr %101, null
  br i1 %102, label %103, label %105

103:                                              ; preds = %99
  %104 = call i64 @StatusBarSetStatusString(ptr noundef @.str)
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

105:                                              ; preds = %99
  %106 = load ptr, ptr %11, align 8, !tbaa !15
  store ptr %106, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !39
  br label %107

107:                                              ; preds = %105, %97
  store i8 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 9), align 1, !tbaa !40
  store i8 1, ptr @HBufferImageNeedRefresh, align 1, !tbaa !9
  store i8 0, ptr @HBufferImageOnlyLineNeedRefresh, align 1, !tbaa !9
  store i8 1, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !9
  store i64 0, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %108

108:                                              ; preds = %107, %103, %56, %42, %31, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %109 = load i64, ptr %4, align 8
  ret i64 %109
}

declare ptr @AllocateZeroPool(i64 noundef) #2

declare i64 @StatusBarSetStatusString(ptr noundef) #2

declare void @FreePool(ptr noundef) #2

declare i64 @HBufferImageFree() #2

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

declare ptr @CatSPrint(ptr noundef, ptr noundef, ...) #2

declare zeroext i8 @DebugAssertEnabled() #2

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

declare ptr @HBufferImageCreateLine() #2

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

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

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


; 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_MEM_IMAGE = type { ptr, i64, i64 }
%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 }

@HMemImage = external dso_local local_unnamed_addr global %struct.HEFI_EDITOR_MEM_IMAGE, align 8
@HBufferImage = external local_unnamed_addr global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@.str = external hidden unnamed_addr constant [19 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [32 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [14 x i32], align 4
@HMainEditor = external local_unnamed_addr global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@.str.3 = external hidden unnamed_addr constant [164 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@HBufferImageNeedRefresh = external local_unnamed_addr global i8, align 1
@HBufferImageOnlyLineNeedRefresh = external local_unnamed_addr global i8, align 1
@HBufferImageMouseNeedRefresh = external local_unnamed_addr global i8, align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @HMemImageSetMemOffsetSize(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @HMemImageRead(i64 noundef %0, i64 noundef %1, i8 noundef zeroext %2) local_unnamed_addr #0 {
  store i32 4, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 92), align 4, !tbaa !5
  %4 = tail call ptr @AllocateZeroPool(i64 noundef %1) #3
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %8

6:                                                ; preds = %3
  %7 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str) #3
  br label %46

8:                                                ; preds = %3
  %9 = load ptr, ptr @HMemImage, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %9, i64 24
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = tail call i64 %11(ptr noundef %9, i32 noundef 0, i64 noundef %0, i64 noundef %1, ptr noundef nonnull %4) #3
  %13 = icmp slt i64 %12, 0
  br i1 %13, label %14, label %16

14:                                               ; preds = %8
  tail call void @FreePool(ptr noundef nonnull %4) #3
  %15 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str.1) #3
  br label %46

16:                                               ; preds = %8
  %17 = tail call i64 @HBufferImageFree() #3
  %18 = tail call i64 @HBufferImageBufferToList(ptr noundef nonnull %4, i64 noundef %1) #3
  tail call void @FreePool(ptr noundef nonnull %4) #3
  %19 = icmp slt i64 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %16
  %21 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str) #3
  br label %46

22:                                               ; preds = %16
  %23 = tail call i64 @HMemImageSetMemOffsetSize(i64 noundef %0, i64 noundef %1)
  store i64 2, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 32), align 8, !tbaa !18
  store i64 10, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 40), align 8, !tbaa !19
  store i64 2, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !20
  store i64 10, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !21
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 80), align 8, !tbaa !22
  store i8 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 88), align 8, !tbaa !23
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 64), align 8, !tbaa !24
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 72), align 8, !tbaa !25
  %.not = icmp eq i8 %2, 0
  br i1 %.not, label %24, label %32

24:                                               ; preds = %22
  %25 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 16), align 8, !tbaa !26
  %26 = tail call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef nonnull @.str.2, i64 noundef %25) #3
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %30

28:                                               ; preds = %24
  %29 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str) #3
  br label %46

30:                                               ; preds = %24
  %31 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull %26) #3
  tail call void @FreePool(ptr noundef nonnull %26) #3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @HMainEditor, i64 56), i8 0, i64 16, i1 false)
  br label %32

32:                                               ; preds = %30, %22
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 8), align 8, !tbaa !27
  %.not25 = icmp eq ptr %33, null
  br i1 %.not25, label %41, label %34

34:                                               ; preds = %32
  %35 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not26 = icmp eq i8 %35, 0
  %.pre = load ptr, ptr @HBufferImage, align 8, !tbaa !28
  %.pre28 = load ptr, ptr %.pre, align 8, !tbaa !29
  %.pre29 = ptrtoint ptr %.pre28 to i64
  %.pre30 = add i64 %.pre29, -32
  %.pre32 = inttoptr i64 %.pre30 to ptr
  br i1 %.not26, label %._crit_edge, label %36

36:                                               ; preds = %34
  %37 = load i64, ptr %.pre32, align 8, !tbaa !31
  %.not27 = icmp eq i64 %37, 1819043173
  br i1 %.not27, label %._crit_edge, label %38

38:                                               ; preds = %36
  tail call void @DebugAssert(ptr noundef nonnull @.str.3, i64 noundef 258, ptr noundef nonnull @.str.4) #3
  %39 = load ptr, ptr @HBufferImage, align 8, !tbaa !28
  %40 = load ptr, ptr %39, align 8, !tbaa !29
  br label %._crit_edge

41:                                               ; preds = %32
  %42 = tail call ptr @HBufferImageCreateLine() #3
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %._crit_edge

44:                                               ; preds = %41
  %45 = tail call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str) #3
  br label %46

._crit_edge:                                      ; preds = %34, %36, %41, %38
  %storemerge = phi ptr [ %40, %38 ], [ %42, %41 ], [ %.pre32, %36 ], [ %.pre32, %34 ]
  store ptr %storemerge, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !33
  store i8 0, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 89), align 1, !tbaa !34
  store i8 1, ptr @HBufferImageNeedRefresh, align 1, !tbaa !35
  store i8 0, ptr @HBufferImageOnlyLineNeedRefresh, align 1, !tbaa !35
  store i8 1, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !35
  br label %46

46:                                               ; preds = %._crit_edge, %44, %28, %20, %14, %6
  %.0 = phi i64 [ -9223372036854775799, %6 ], [ -9223372036854775807, %14 ], [ %18, %20 ], [ 0, %._crit_edge ], [ -9223372036854775799, %44 ], [ -9223372036854775799, %28 ]
  ret i64 %.0
}

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

declare i64 @StatusBarSetStatusString(ptr noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare i64 @HBufferImageFree() local_unnamed_addr #1

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

declare ptr @CatSPrint(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare ptr @HBufferImageCreateLine() local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !12, i64 92}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !11, i64 48, !11, i64 64, !10, i64 80, !8, i64 88, !8, i64 89, !12, i64 92, !7, i64 96, !7, i64 104, !7, i64 112}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!"", !10, i64 0, !10, i64 8}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!16, !7, i64 24}
!16 = !{!"_EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL", !7, i64 0, !7, i64 8, !7, i64 16, !17, i64 24, !17, i64 40, !17, i64 56, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !12, i64 144}
!17 = !{!"", !7, i64 0, !7, i64 8}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !10, i64 56}
!22 = !{!6, !10, i64 80}
!23 = !{!6, !8, i64 88}
!24 = !{!6, !10, i64 64}
!25 = !{!6, !10, i64 72}
!26 = !{!6, !10, i64 16}
!27 = !{!6, !7, i64 8}
!28 = !{!6, !7, i64 0}
!29 = !{!30, !7, i64 0}
!30 = !{!"_LIST_ENTRY", !7, i64 0, !7, i64 8}
!31 = !{!32, !10, i64 0}
!32 = !{!"_HEFI_EDITOR_LINE", !10, i64 0, !8, i64 8, !10, i64 24, !30, i64 32}
!33 = !{!6, !7, i64 24}
!34 = !{!6, !8, i64 89}
!35 = !{!8, !8, i64 0}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass