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

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

@HFileImage = external dso_local global %struct.HEFI_EDITOR_FILE_IMAGE, align 8
@.str.1 = external hidden unnamed_addr constant [26 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [20 x i32], align 4
@HBufferImage = external global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@.str.3 = external hidden unnamed_addr constant [14 x i32], align 4
@HMainEditor = external global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@.str.4 = external hidden unnamed_addr constant [165 x i8], align 1
@.str.5 = 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

declare void @FreePool(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @HFileImageSetFileName(ptr noundef) #1

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

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

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

15:                                               ; preds = %2
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %40

18:                                               ; preds = %15
  %19 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_FILE_IMAGE, ptr @HFileImage, i32 0, i32 1), align 8, !tbaa !12
  %20 = icmp ne i64 %19, 0
  br i1 %20, label %21, label %40

21:                                               ; preds = %18, %2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !10
  %24 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef @.str.1, ptr noundef %22, i64 noundef %23)
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %36

27:                                               ; preds = %21
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %33

31:                                               ; preds = %28
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %32)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %31, %28
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

36:                                               ; preds = %21
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = call i64 @StatusBarSetStatusString(ptr noundef %37)
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %39)
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

40:                                               ; preds = %18, %15
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = call i64 @HFileImageSetFileName(ptr noundef %41)
  %43 = call i64 @HBufferImageFree()
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_FILE_IMAGE, ptr @HFileImage, i32 0, i32 1), align 8, !tbaa !12
  %46 = call i64 @HBufferImageBufferToList(ptr noundef %44, i64 noundef %45)
  store i64 %46, ptr %9, align 8, !tbaa !10
  br label %47

47:                                               ; preds = %40
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %52

50:                                               ; preds = %47
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %51)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %50, %47
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  %55 = load i64, ptr %9, align 8, !tbaa !10
  %56 = icmp slt i64 %55, 0
  br i1 %56, label %57, label %60

57:                                               ; preds = %54
  %58 = call i64 @StatusBarSetStatusString(ptr noundef @.str.2)
  %59 = load i64, ptr %9, align 8, !tbaa !10
  store i64 %59, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

60:                                               ; preds = %54
  store i64 2, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 4), align 8, !tbaa !14
  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 !18
  store i64 2, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 5), align 8, !tbaa !19
  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 !20
  store i64 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 7), align 8, !tbaa !21
  store i8 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 8), align 8, !tbaa !22
  store i64 1, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 6), align 8, !tbaa !23
  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 !24
  store i32 5, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 10), align 4, !tbaa !25
  %61 = load i8, ptr %5, align 1, !tbaa !9
  %62 = icmp ne i8 %61, 0
  br i1 %62, label %81, label %63

63:                                               ; preds = %60
  %64 = load i64, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 2), align 8, !tbaa !26
  %65 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef @.str.3, i64 noundef %64)
  store ptr %65, ptr %8, align 8, !tbaa !5
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %77

68:                                               ; preds = %63
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %74

72:                                               ; preds = %69
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %73)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %72, %69
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

77:                                               ; preds = %63
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = call i64 @StatusBarSetStatusString(ptr noundef %78)
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %80)
  store i64 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 7), align 8, !tbaa !27
  store i64 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_GLOBAL_EDITOR, ptr @HMainEditor, i32 0, i32 8), align 8, !tbaa !29
  br label %81

81:                                               ; preds = %77, %60
  %82 = load ptr, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 1), align 8, !tbaa !30
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %111

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

88:                                               ; preds = %84
  %89 = load ptr, ptr @HBufferImage, align 8, !tbaa !31
  %90 = getelementptr inbounds %struct._LIST_ENTRY, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !32
  %92 = ptrtoint ptr %91 to i64
  %93 = sub i64 %92, ptrtoint (ptr getelementptr inbounds (%struct._HEFI_EDITOR_LINE, ptr null, i32 0, i32 3) to i64)
  %94 = inttoptr i64 %93 to ptr
  %95 = getelementptr inbounds %struct._HEFI_EDITOR_LINE, ptr %94, i32 0, i32 0
  %96 = load i64, ptr %95, align 8, !tbaa !34
  %97 = icmp ne i64 %96, 1819043173
  br i1 %97, label %98, label %102

98:                                               ; preds = %88
  call void @DebugAssert(ptr noundef @.str.4, i64 noundef 229, ptr noundef @.str.5)
  %99 = load ptr, ptr @HBufferImage, align 8, !tbaa !31
  %100 = getelementptr inbounds %struct._LIST_ENTRY, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !32
  br label %109

102:                                              ; preds = %88, %84
  %103 = load ptr, ptr @HBufferImage, align 8, !tbaa !31
  %104 = getelementptr inbounds %struct._LIST_ENTRY, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !32
  %106 = ptrtoint ptr %105 to i64
  %107 = sub i64 %106, ptrtoint (ptr getelementptr inbounds (%struct._HEFI_EDITOR_LINE, ptr null, i32 0, i32 3) to i64)
  %108 = inttoptr i64 %107 to ptr
  br label %109

109:                                              ; preds = %102, %98
  %110 = phi ptr [ %101, %98 ], [ %108, %102 ]
  store ptr %110, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !36
  br label %126

111:                                              ; preds = %81
  %112 = call ptr @HBufferImageCreateLine()
  store ptr %112, ptr %6, align 8, !tbaa !5
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = icmp eq ptr %113, null
  br i1 %114, label %115, label %124

115:                                              ; preds = %111
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %120)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %119, %116
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

124:                                              ; preds = %111
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %125, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 3), align 8, !tbaa !36
  br label %126

126:                                              ; preds = %124, %109
  store i8 0, ptr getelementptr inbounds (%struct.HEFI_EDITOR_BUFFER_IMAGE, ptr @HBufferImage, i32 0, i32 9), align 1, !tbaa !37
  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 %3, align 8
  store i32 1, ptr %10, align 4
  br label %127

127:                                              ; preds = %126, %123, %76, %57, %36, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %128 = load i64, ptr %3, align 8
  ret i64 %128
}

declare i64 @ReadFileIntoBuffer(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare i64 @StatusBarSetStatusString(ptr noundef) #0

declare i64 @HBufferImageFree() #0

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

declare zeroext i8 @DebugAssertEnabled() #0

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

declare ptr @HBufferImageCreateLine() #0

attributes #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"", !6, i64 0, !11, i64 8, !7, i64 16}
!14 = !{!15, !11, i64 32}
!15 = !{!"", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !16, i64 32, !16, i64 48, !16, i64 64, !11, i64 80, !7, i64 88, !7, i64 89, !17, i64 92, !6, i64 96, !6, i64 104, !6, i64 112}
!16 = !{!"", !11, i64 0, !11, i64 8}
!17 = !{!"int", !7, i64 0}
!18 = !{!15, !11, i64 40}
!19 = !{!15, !11, i64 48}
!20 = !{!15, !11, i64 56}
!21 = !{!15, !11, i64 80}
!22 = !{!15, !7, i64 88}
!23 = !{!15, !11, i64 64}
!24 = !{!15, !11, i64 72}
!25 = !{!15, !17, i64 92}
!26 = !{!15, !11, i64 16}
!27 = !{!28, !11, i64 56}
!28 = !{!"", !6, i64 0, !7, i64 8, !16, i64 16, !7, i64 32, !6, i64 40, !17, i64 48, !17, i64 52, !11, i64 56, !11, i64 64}
!29 = !{!28, !11, i64 64}
!30 = !{!15, !6, i64 8}
!31 = !{!15, !6, i64 0}
!32 = !{!33, !6, i64 0}
!33 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!34 = !{!35, !11, i64 0}
!35 = !{!"_HEFI_EDITOR_LINE", !11, i64 0, !7, i64 8, !11, i64 24, !33, i64 32}
!36 = !{!15, !6, i64 24}
!37 = !{!15, !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_FILE_IMAGE = type { ptr, i64, i8 }
%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 }

@HFileImage = external dso_local global %struct.HEFI_EDITOR_FILE_IMAGE, align 8
@.str.1 = external hidden unnamed_addr constant [26 x i32], align 4
@.str.2 = external hidden unnamed_addr constant [20 x i32], align 4
@HBufferImage = external local_unnamed_addr global %struct.HEFI_EDITOR_BUFFER_IMAGE, align 8
@.str.3 = external hidden unnamed_addr constant [14 x i32], align 4
@HMainEditor = external local_unnamed_addr global %struct.HEFI_EDITOR_GLOBAL_EDITOR, align 8
@.str.4 = external hidden unnamed_addr constant [165 x i8], align 1
@.str.5 = 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

declare void @FreePool(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @HFileImageSetFileName(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @HFileImageRead(ptr noundef %0, i8 noundef zeroext %1) local_unnamed_addr #1 {
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %4 = call i64 @ReadFileIntoBuffer(ptr noundef %0, ptr noundef nonnull %3, ptr noundef nonnull getelementptr inbounds (i8, ptr @HFileImage, i64 8), ptr noundef nonnull getelementptr inbounds (i8, ptr @HFileImage, i64 16)) #4
  %5 = icmp slt i64 %4, 0
  br i1 %5, label %11, label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  %9 = load i64, ptr getelementptr inbounds (i8, ptr @HFileImage, i64 8), align 8
  %10 = icmp ne i64 %9, 0
  %or.cond = select i1 %8, i1 %10, i1 false
  br i1 %or.cond, label %11, label %19

11:                                               ; preds = %6, %2
  %12 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef nonnull @.str.1, ptr noundef %0, i64 noundef %4) #4
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %17

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

16:                                               ; preds = %14
  call void @FreePool(ptr noundef nonnull %15) #4
  br label %56

17:                                               ; preds = %11
  %18 = call i64 @StatusBarSetStatusString(ptr noundef nonnull %12) #4
  call void @FreePool(ptr noundef nonnull %12) #4
  br label %56

19:                                               ; preds = %6
  %20 = call i64 @HFileImageSetFileName(ptr noundef %0)
  %21 = call i64 @HBufferImageFree() #4
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @HFileImage, i64 8), align 8, !tbaa !9
  %24 = call i64 @HBufferImageBufferToList(ptr noundef %22, i64 noundef %23) #4
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %27, label %26

26:                                               ; preds = %19
  call void @FreePool(ptr noundef nonnull %25) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %26, %19
  %28 = icmp slt i64 %24, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %27
  %30 = call i64 @StatusBarSetStatusString(ptr noundef nonnull @.str.2) #4
  br label %56

31:                                               ; preds = %27
  store i64 2, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 32), align 8, !tbaa !12
  store i64 10, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 40), align 8, !tbaa !16
  store i64 2, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 48), align 8, !tbaa !17
  store i64 10, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 56), align 8, !tbaa !18
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 80), align 8, !tbaa !19
  store i8 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 88), align 8, !tbaa !20
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 64), align 8, !tbaa !21
  store i64 1, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 72), align 8, !tbaa !22
  store i32 5, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 92), align 4, !tbaa !23
  %.not25 = icmp eq i8 %1, 0
  br i1 %.not25, label %32, label %41

32:                                               ; preds = %31
  %33 = load i64, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 16), align 8, !tbaa !24
  %34 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef nonnull @.str.3, i64 noundef %33) #4
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %.not26 = icmp eq ptr %37, null
  br i1 %.not26, label %56, label %38

38:                                               ; preds = %36
  call void @FreePool(ptr noundef nonnull %37) #4
  br label %56

39:                                               ; preds = %32
  %40 = call i64 @StatusBarSetStatusString(ptr noundef nonnull %34) #4
  call void @FreePool(ptr noundef nonnull %34) #4
  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 %41

41:                                               ; preds = %39, %31
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 8), align 8, !tbaa !25
  %.not27 = icmp eq ptr %42, null
  br i1 %.not27, label %50, label %43

43:                                               ; preds = %41
  %44 = call zeroext i8 @DebugAssertEnabled() #4
  %.not29 = icmp eq i8 %44, 0
  %.pre = load ptr, ptr @HBufferImage, align 8, !tbaa !26
  %.pre32 = load ptr, ptr %.pre, align 8, !tbaa !27
  %.pre33 = ptrtoint ptr %.pre32 to i64
  %.pre34 = add i64 %.pre33, -32
  %.pre36 = inttoptr i64 %.pre34 to ptr
  br i1 %.not29, label %._crit_edge, label %45

45:                                               ; preds = %43
  %46 = load i64, ptr %.pre36, align 8, !tbaa !29
  %.not30 = icmp eq i64 %46, 1819043173
  br i1 %.not30, label %._crit_edge, label %47

47:                                               ; preds = %45
  call void @DebugAssert(ptr noundef nonnull @.str.4, i64 noundef 229, ptr noundef nonnull @.str.5) #4
  %48 = load ptr, ptr @HBufferImage, align 8, !tbaa !26
  %49 = load ptr, ptr %48, align 8, !tbaa !27
  br label %._crit_edge

50:                                               ; preds = %41
  %51 = call ptr @HBufferImageCreateLine() #4
  %52 = icmp eq ptr %51, null
  br i1 %52, label %53, label %._crit_edge

53:                                               ; preds = %50
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %.not28 = icmp eq ptr %54, null
  br i1 %.not28, label %56, label %55

55:                                               ; preds = %53
  call void @FreePool(ptr noundef nonnull %54) #4
  br label %56

._crit_edge:                                      ; preds = %43, %45, %50, %47
  %storemerge = phi ptr [ %49, %47 ], [ %51, %50 ], [ %.pre36, %45 ], [ %.pre36, %43 ]
  store ptr %storemerge, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 24), align 8, !tbaa !31
  store i8 0, ptr getelementptr inbounds (i8, ptr @HBufferImage, i64 89), align 1, !tbaa !32
  store i8 1, ptr @HBufferImageNeedRefresh, align 1, !tbaa !33
  store i8 0, ptr @HBufferImageOnlyLineNeedRefresh, align 1, !tbaa !33
  store i8 1, ptr @HBufferImageMouseNeedRefresh, align 1, !tbaa !33
  br label %56

56:                                               ; preds = %53, %55, %36, %38, %14, %16, %._crit_edge, %29, %17
  %.0 = phi i64 [ -9223372036854775799, %17 ], [ %24, %29 ], [ 0, %._crit_edge ], [ -9223372036854775799, %16 ], [ -9223372036854775799, %14 ], [ -9223372036854775799, %38 ], [ -9223372036854775799, %36 ], [ -9223372036854775799, %55 ], [ -9223372036854775799, %53 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  ret i64 %.0
}

declare i64 @ReadFileIntoBuffer(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i64 @StatusBarSetStatusString(ptr noundef) local_unnamed_addr #0

declare i64 @HBufferImageFree() local_unnamed_addr #0

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

declare ptr @HBufferImageCreateLine() local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }

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

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


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