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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.EFI_EDITOR_FILE_BUFFER = type { ptr, i32, ptr, ptr, i64, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, i8, i8, i8, ptr }
%struct.EFI_EDITOR_POSITION = type { i64, i64 }
%struct._EFI_EDITOR_LINE = type { i64, ptr, i64, i64, i32, %struct._LIST_ENTRY }
%struct._LIST_ENTRY = type { ptr, ptr }

@FileBuffer = external dso_local global %struct.EFI_EDITOR_FILE_BUFFER, align 8
@FileBufferNeedRefresh = external dso_local global i8, align 1
@FileBufferOnlyLineNeedRefresh = external dso_local global i8, align 1
@.str.10 = external hidden unnamed_addr constant [2 x i32], align 4

declare ptr @AllocateZeroPool(i64 noundef) #0

declare void @FreePool(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @FileBufferMovePosition(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @FileBufferDoReturn() #2 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  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
  store i8 1, ptr @FileBufferNeedRefresh, align 1, !tbaa !5
  store i8 0, ptr @FileBufferOnlyLineNeedRefresh, align 1, !tbaa !5
  %10 = load ptr, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 12), align 8, !tbaa !8
  store ptr %10, ptr %2, align 8, !tbaa !14
  %11 = load i64, ptr getelementptr inbounds (%struct.EFI_EDITOR_POSITION, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 6), i32 0, i32 1), align 8, !tbaa !15
  store i64 %11, ptr %4, align 8, !tbaa !16
  %12 = call ptr @AllocateZeroPool(i64 noundef 56)
  store ptr %12, ptr %3, align 8, !tbaa !14
  %13 = load ptr, ptr %3, align 8, !tbaa !14
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %0
  store i64 -9223372036854775799, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %145

16:                                               ; preds = %0
  %17 = load ptr, ptr %3, align 8, !tbaa !14
  %18 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %17, i32 0, i32 0
  store i64 1819043173, ptr %18, align 8, !tbaa !17
  %19 = load ptr, ptr %2, align 8, !tbaa !14
  %20 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %19, i32 0, i32 2
  %21 = load i64, ptr %20, align 8, !tbaa !20
  %22 = load i64, ptr %4, align 8, !tbaa !16
  %23 = sub i64 %21, %22
  %24 = add i64 %23, 1
  %25 = load ptr, ptr %3, align 8, !tbaa !14
  %26 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %25, i32 0, i32 2
  store i64 %24, ptr %26, align 8, !tbaa !20
  %27 = load ptr, ptr %3, align 8, !tbaa !14
  %28 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %27, i32 0, i32 2
  %29 = load i64, ptr %28, align 8, !tbaa !20
  %30 = load ptr, ptr %3, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %30, i32 0, i32 3
  store i64 %29, ptr %31, align 8, !tbaa !21
  %32 = call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef @.str.10)
  %33 = load ptr, ptr %3, align 8, !tbaa !14
  %34 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %33, i32 0, i32 1
  store ptr %32, ptr %34, align 8, !tbaa !22
  %35 = load ptr, ptr %3, align 8, !tbaa !14
  %36 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %16
  store i64 -9223372036854775799, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %145

40:                                               ; preds = %16
  %41 = load ptr, ptr %3, align 8, !tbaa !14
  %42 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %41, i32 0, i32 4
  store i32 0, ptr %42, align 8, !tbaa !23
  %43 = load ptr, ptr %3, align 8, !tbaa !14
  %44 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %43, i32 0, i32 2
  %45 = load i64, ptr %44, align 8, !tbaa !20
  %46 = icmp ugt i64 %45, 0
  br i1 %46, label %47, label %110

47:                                               ; preds = %40
  %48 = load ptr, ptr %3, align 8, !tbaa !14
  %49 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %48, i32 0, i32 2
  %50 = load i64, ptr %49, align 8, !tbaa !20
  %51 = add i64 %50, 1
  %52 = mul i64 2, %51
  %53 = call ptr @AllocateZeroPool(i64 noundef %52)
  store ptr %53, ptr %6, align 8, !tbaa !14
  %54 = load ptr, ptr %6, align 8, !tbaa !14
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %61

56:                                               ; preds = %47
  %57 = load ptr, ptr %3, align 8, !tbaa !14
  %58 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  call void @FreePool(ptr noundef %59)
  %60 = load ptr, ptr %3, align 8, !tbaa !14
  call void @FreePool(ptr noundef %60)
  store i64 -9223372036854775799, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %145

61:                                               ; preds = %47
  %62 = load ptr, ptr %3, align 8, !tbaa !14
  %63 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !22
  call void @FreePool(ptr noundef %64)
  %65 = load ptr, ptr %6, align 8, !tbaa !14
  %66 = load ptr, ptr %3, align 8, !tbaa !14
  %67 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %66, i32 0, i32 1
  store ptr %65, ptr %67, align 8, !tbaa !22
  store i64 0, ptr %5, align 8, !tbaa !16
  br label %68

68:                                               ; preds = %89, %61
  %69 = load i64, ptr %5, align 8, !tbaa !16
  %70 = load ptr, ptr %3, align 8, !tbaa !14
  %71 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !20
  %73 = icmp ult i64 %69, %72
  br i1 %73, label %74, label %92

74:                                               ; preds = %68
  %75 = load ptr, ptr %2, align 8, !tbaa !14
  %76 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !22
  %78 = load i64, ptr %5, align 8, !tbaa !16
  %79 = load i64, ptr %4, align 8, !tbaa !16
  %80 = add i64 %78, %79
  %81 = sub i64 %80, 1
  %82 = getelementptr inbounds i16, ptr %77, i64 %81
  %83 = load i16, ptr %82, align 2, !tbaa !24
  %84 = load ptr, ptr %3, align 8, !tbaa !14
  %85 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !22
  %87 = load i64, ptr %5, align 8, !tbaa !16
  %88 = getelementptr inbounds i16, ptr %86, i64 %87
  store i16 %83, ptr %88, align 2, !tbaa !24
  br label %89

89:                                               ; preds = %74
  %90 = load i64, ptr %5, align 8, !tbaa !16
  %91 = add i64 %90, 1
  store i64 %91, ptr %5, align 8, !tbaa !16
  br label %68, !llvm.loop !26

92:                                               ; preds = %68
  %93 = load ptr, ptr %3, align 8, !tbaa !14
  %94 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  %96 = load ptr, ptr %3, align 8, !tbaa !14
  %97 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %96, i32 0, i32 2
  %98 = load i64, ptr %97, align 8, !tbaa !20
  %99 = getelementptr inbounds i16, ptr %95, i64 %98
  store i16 0, ptr %99, align 2, !tbaa !24
  %100 = load ptr, ptr %2, align 8, !tbaa !14
  %101 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !22
  %103 = load i64, ptr %4, align 8, !tbaa !16
  %104 = sub i64 %103, 1
  %105 = getelementptr inbounds i16, ptr %102, i64 %104
  store i16 0, ptr %105, align 2, !tbaa !24
  %106 = load i64, ptr %4, align 8, !tbaa !16
  %107 = sub i64 %106, 1
  %108 = load ptr, ptr %2, align 8, !tbaa !14
  %109 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %108, i32 0, i32 2
  store i64 %107, ptr %109, align 8, !tbaa !20
  br label %110

110:                                              ; preds = %92, %40
  %111 = load i64, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 4), align 8, !tbaa !28
  %112 = add i64 %111, 1
  store i64 %112, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 4), align 8, !tbaa !28
  %113 = load ptr, ptr %2, align 8, !tbaa !14
  %114 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %113, i32 0, i32 5
  %115 = load ptr, ptr %3, align 8, !tbaa !14
  %116 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %115, i32 0, i32 5
  %117 = getelementptr inbounds %struct._LIST_ENTRY, ptr %116, i32 0, i32 1
  store ptr %114, ptr %117, align 8, !tbaa !29
  %118 = load ptr, ptr %2, align 8, !tbaa !14
  %119 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %118, i32 0, i32 5
  %120 = getelementptr inbounds %struct._LIST_ENTRY, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !30
  %122 = load ptr, ptr %3, align 8, !tbaa !14
  %123 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %122, i32 0, i32 5
  %124 = getelementptr inbounds %struct._LIST_ENTRY, ptr %123, i32 0, i32 0
  store ptr %121, ptr %124, align 8, !tbaa !30
  %125 = load ptr, ptr %3, align 8, !tbaa !14
  %126 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %2, align 8, !tbaa !14
  %128 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %127, i32 0, i32 5
  %129 = getelementptr inbounds %struct._LIST_ENTRY, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !30
  %131 = getelementptr inbounds %struct._LIST_ENTRY, ptr %130, i32 0, i32 1
  store ptr %126, ptr %131, align 8, !tbaa !31
  %132 = load ptr, ptr %3, align 8, !tbaa !14
  %133 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %132, i32 0, i32 5
  %134 = load ptr, ptr %2, align 8, !tbaa !14
  %135 = getelementptr inbounds %struct._EFI_EDITOR_LINE, ptr %134, i32 0, i32 5
  %136 = getelementptr inbounds %struct._LIST_ENTRY, ptr %135, i32 0, i32 0
  store ptr %133, ptr %136, align 8, !tbaa !30
  %137 = load i64, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 6), align 8, !tbaa !32
  %138 = add i64 %137, 1
  store i64 %138, ptr %7, align 8, !tbaa !16
  store i64 1, ptr %8, align 8, !tbaa !16
  %139 = load i64, ptr %7, align 8, !tbaa !16
  %140 = load i64, ptr %8, align 8, !tbaa !16
  call void @FileBufferMovePosition(i64 noundef %139, i64 noundef %140)
  %141 = load i8, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 9), align 8, !tbaa !33
  %142 = icmp ne i8 %141, 0
  br i1 %142, label %144, label %143

143:                                              ; preds = %110
  store i8 1, ptr getelementptr inbounds (%struct.EFI_EDITOR_FILE_BUFFER, ptr @FileBuffer, i32 0, i32 9), align 8, !tbaa !33
  br label %144

144:                                              ; preds = %143, %110
  store i64 0, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %145

145:                                              ; preds = %144, %56, %39, %15
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %146 = load i64, ptr %1, align 8
  ret i64 %146
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 112}
!9 = !{!"", !10, i64 0, !11, i64 8, !10, i64 16, !10, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !13, i64 72, !13, i64 88, !6, i64 104, !6, i64 105, !6, i64 106, !10, i64 112}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!"long long", !6, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 8}
!14 = !{!10, !10, i64 0}
!15 = !{!9, !12, i64 64}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"_EFI_EDITOR_LINE", !12, i64 0, !10, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !19, i64 40}
!19 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!20 = !{!18, !12, i64 16}
!21 = !{!18, !12, i64 24}
!22 = !{!18, !10, i64 8}
!23 = !{!18, !11, i64 32}
!24 = !{!25, !25, i64 0}
!25 = !{!"short", !6, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!9, !12, i64 32}
!29 = !{!18, !10, i64 48}
!30 = !{!18, !10, i64 40}
!31 = !{!19, !10, i64 8}
!32 = !{!9, !12, i64 56}
!33 = !{!9, !6, i64 104}


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

%struct.EFI_EDITOR_FILE_BUFFER = type { ptr, i32, ptr, ptr, i64, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, %struct.EFI_EDITOR_POSITION, i8, i8, i8, ptr }
%struct.EFI_EDITOR_POSITION = type { i64, i64 }

@FileBuffer = external dso_local local_unnamed_addr global %struct.EFI_EDITOR_FILE_BUFFER, align 8
@FileBufferNeedRefresh = external dso_local local_unnamed_addr global i8, align 1
@FileBufferOnlyLineNeedRefresh = external dso_local local_unnamed_addr global i8, align 1
@.str.10 = external hidden unnamed_addr constant [2 x i32], align 4

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #0

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 void @FileBufferMovePosition(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775799, 1) i64 @FileBufferDoReturn() local_unnamed_addr #1 {
  store i8 1, ptr @FileBufferNeedRefresh, align 1, !tbaa !5
  store i8 0, ptr @FileBufferOnlyLineNeedRefresh, align 1, !tbaa !5
  %1 = load ptr, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 112), align 8, !tbaa !8
  %2 = load i64, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 64), align 8, !tbaa !14
  %3 = tail call ptr @AllocateZeroPool(i64 noundef 56) #2
  %4 = icmp eq ptr %3, null
  br i1 %4, label %67, label %5

5:                                                ; preds = %0
  store i64 1819043173, ptr %3, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load i64, ptr %6, align 8, !tbaa !18
  %8 = sub i64 %7, %2
  %9 = add i64 %8, 1
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  store i64 %9, ptr %10, align 8, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %3, i64 24
  store i64 %9, ptr %11, align 8, !tbaa !19
  %12 = tail call ptr (ptr, ptr, ...) @CatSPrint(ptr noundef null, ptr noundef nonnull @.str.10) #2
  %13 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %12, ptr %13, align 8, !tbaa !20
  %14 = icmp eq ptr %12, null
  br i1 %14, label %67, label %15

15:                                               ; preds = %5
  %16 = getelementptr inbounds i8, ptr %3, i64 32
  store i32 0, ptr %16, align 8, !tbaa !21
  %17 = load i64, ptr %10, align 8, !tbaa !18
  %.not = icmp eq i64 %17, 0
  br i1 %.not, label %55, label %18

18:                                               ; preds = %15
  %19 = shl i64 %17, 1
  %20 = add i64 %19, 2
  %21 = tail call ptr @AllocateZeroPool(i64 noundef %20) #2
  %22 = ptrtoint ptr %21 to i64
  %23 = icmp eq ptr %21, null
  %24 = load ptr, ptr %13, align 8, !tbaa !20
  tail call void @FreePool(ptr noundef %24) #2
  br i1 %23, label %25, label %26

25:                                               ; preds = %18
  tail call void @FreePool(ptr noundef nonnull %3) #2
  br label %67

26:                                               ; preds = %18
  store ptr %21, ptr %13, align 8, !tbaa !20
  %27 = load i64, ptr %10, align 8, !tbaa !18
  %.not51 = icmp eq i64 %27, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 8
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !20
  %.pre52 = ptrtoint ptr %.pre to i64
  br i1 %.not51, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %26
  %invariant.gep = getelementptr i16, ptr %.pre, i64 %2
  %invariant.gep49 = getelementptr i8, ptr %invariant.gep, i64 -2
  %min.iters.check = icmp ult i64 %27, 16
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph
  %28 = add i64 %22, 2
  %29 = shl i64 %2, 1
  %30 = add i64 %29, %.pre52
  %31 = sub i64 %28, %30
  %diff.check = icmp ult i64 %31, 32
  br i1 %diff.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %27, -16
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %32 = getelementptr i16, ptr %invariant.gep49, i64 %index
  %33 = getelementptr i8, ptr %32, i64 16
  %wide.load = load <8 x i16>, ptr %32, align 2, !tbaa !22
  %wide.load53 = load <8 x i16>, ptr %33, align 2, !tbaa !22
  %34 = getelementptr inbounds i16, ptr %21, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  store <8 x i16> %wide.load, ptr %34, align 2, !tbaa !22
  store <8 x i16> %wide.load53, ptr %35, align 2, !tbaa !22
  %index.next = add nuw i64 %index, 16
  %36 = icmp eq i64 %index.next, %n.vec
  br i1 %36, label %middle.block, label %vector.body, !llvm.loop !24

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %27, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph
  %.04248.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %27, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.04248.prol = phi i64 [ %39, %scalar.ph.prol ], [ %.04248.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %gep50.prol = getelementptr i16, ptr %invariant.gep49, i64 %.04248.prol
  %37 = load i16, ptr %gep50.prol, align 2, !tbaa !22
  %38 = getelementptr inbounds i16, ptr %21, i64 %.04248.prol
  store i16 %37, ptr %38, align 2, !tbaa !22
  %39 = add nuw i64 %.04248.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !28

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.04248.unr = phi i64 [ %.04248.ph, %scalar.ph.preheader ], [ %39, %scalar.ph.prol ]
  %40 = sub i64 %.04248.ph, %27
  %41 = icmp ugt i64 %40, -4
  br i1 %41, label %._crit_edge, label %scalar.ph.preheader.new

scalar.ph.preheader.new:                          ; preds = %scalar.ph.prol.loopexit
  %invariant.gep54 = getelementptr i8, ptr %21, i64 2
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph, %scalar.ph.preheader.new
  %.04248 = phi i64 [ %.04248.unr, %scalar.ph.preheader.new ], [ %51, %scalar.ph ]
  %gep50 = getelementptr i16, ptr %invariant.gep49, i64 %.04248
  %42 = load i16, ptr %gep50, align 2, !tbaa !22
  %43 = getelementptr inbounds i16, ptr %21, i64 %.04248
  store i16 %42, ptr %43, align 2, !tbaa !22
  %gep50.1 = getelementptr i16, ptr %invariant.gep, i64 %.04248
  %44 = load i16, ptr %gep50.1, align 2, !tbaa !22
  %gep = getelementptr i16, ptr %invariant.gep54, i64 %.04248
  store i16 %44, ptr %gep, align 2, !tbaa !22
  %45 = add nuw i64 %.04248, 2
  %gep50.2 = getelementptr i16, ptr %invariant.gep49, i64 %45
  %46 = load i16, ptr %gep50.2, align 2, !tbaa !22
  %47 = getelementptr inbounds i16, ptr %21, i64 %45
  store i16 %46, ptr %47, align 2, !tbaa !22
  %48 = add nuw i64 %.04248, 3
  %gep50.3 = getelementptr i16, ptr %invariant.gep49, i64 %48
  %49 = load i16, ptr %gep50.3, align 2, !tbaa !22
  %50 = getelementptr inbounds i16, ptr %21, i64 %48
  store i16 %49, ptr %50, align 2, !tbaa !22
  %51 = add nuw i64 %.04248, 4
  %exitcond.not.3 = icmp eq i64 %51, %27
  br i1 %exitcond.not.3, label %._crit_edge, label %scalar.ph, !llvm.loop !30

._crit_edge:                                      ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %26
  %52 = getelementptr inbounds i16, ptr %21, i64 %27
  store i16 0, ptr %52, align 2, !tbaa !22
  %53 = add i64 %2, -1
  %54 = getelementptr inbounds i16, ptr %.pre, i64 %53
  store i16 0, ptr %54, align 2, !tbaa !22
  store i64 %53, ptr %6, align 8, !tbaa !18
  br label %55

55:                                               ; preds = %._crit_edge, %15
  %56 = load i64, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 32), align 8, !tbaa !31
  %57 = add i64 %56, 1
  store i64 %57, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 32), align 8, !tbaa !31
  %58 = getelementptr inbounds i8, ptr %1, i64 40
  %59 = getelementptr inbounds i8, ptr %3, i64 40
  %60 = getelementptr inbounds i8, ptr %3, i64 48
  store ptr %58, ptr %60, align 8, !tbaa !32
  %61 = load ptr, ptr %58, align 8, !tbaa !33
  store ptr %61, ptr %59, align 8, !tbaa !33
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  store ptr %59, ptr %62, align 8, !tbaa !34
  store ptr %59, ptr %58, align 8, !tbaa !33
  %63 = load i64, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 56), align 8, !tbaa !35
  %64 = add i64 %63, 1
  tail call void @FileBufferMovePosition(i64 noundef %64, i64 noundef 1)
  %65 = load i8, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 104), align 8, !tbaa !36
  %.not47 = icmp eq i8 %65, 0
  br i1 %.not47, label %66, label %67

66:                                               ; preds = %55
  store i8 1, ptr getelementptr inbounds (i8, ptr @FileBuffer, i64 104), align 8, !tbaa !36
  br label %67

67:                                               ; preds = %55, %66, %5, %0, %25
  %.0 = phi i64 [ -9223372036854775799, %25 ], [ -9223372036854775799, %0 ], [ -9223372036854775799, %5 ], [ 0, %66 ], [ 0, %55 ]
  ret i64 %.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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 112}
!9 = !{!"", !10, i64 0, !11, i64 8, !10, i64 16, !10, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !13, i64 72, !13, i64 88, !6, i64 104, !6, i64 105, !6, i64 106, !10, i64 112}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!"long long", !6, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 8}
!14 = !{!9, !12, i64 64}
!15 = !{!16, !12, i64 0}
!16 = !{!"_EFI_EDITOR_LINE", !12, i64 0, !10, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !17, i64 40}
!17 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!18 = !{!16, !12, i64 16}
!19 = !{!16, !12, i64 24}
!20 = !{!16, !10, i64 8}
!21 = !{!16, !11, i64 32}
!22 = !{!23, !23, i64 0}
!23 = !{!"short", !6, i64 0}
!24 = distinct !{!24, !25, !26, !27}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!"llvm.loop.isvectorized", i32 1}
!27 = !{!"llvm.loop.unroll.runtime.disable"}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.unroll.disable"}
!30 = distinct !{!30, !25, !26}
!31 = !{!9, !12, i64 32}
!32 = !{!16, !10, i64 48}
!33 = !{!16, !10, i64 40}
!34 = !{!17, !10, i64 8}
!35 = !{!9, !12, i64 56}
!36 = !{!9, !6, i64 104}


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