; LLVM IR from ligurio/unreliablefs :: unreliablefs/tests (fsx)

; 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"

@file_size = external dso_local global i64, align 8
@testcalls = external dso_local global i64, align 8
@simulatedopcount = external dso_local global i64, align 8
@debug = external dso_local global i32, align 4
@quiet = external dso_local global i32, align 4
@progressinterval = external dso_local global i64, align 8
@writebdy = external dso_local global i32, align 4
@monitorstart = external dso_local global i64, align 8
@monitorend = external dso_local global i64, align 8
@lite = external dso_local global i32, align 4
@mapped_msync = external dso_local global i32, align 4
@good_buf = external dso_local global ptr, align 8
@fd = external dso_local global i32, align 4
@page_mask = external dso_local global i32, align 4
@.str.53 = external hidden unnamed_addr constant [26 x i8], align 1
@original_buf = external dso_local global ptr, align 8
@.str.54 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @warn(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

; Function Attrs: nounwind uwtable
declare dso_local void @prt(ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
declare dso_local void @prterr(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @log4(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @report_failure(i32 noundef) #0

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @check_eofpage(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #3

; 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) #4

; Function Attrs: nounwind
declare i32 @munmap(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @gendata(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @domapwrite(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = load i32, ptr @writebdy, align 4, !tbaa !5
  %12 = urem i32 %10, %11
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = sub i32 %13, %12
  store i32 %14, ptr %3, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %28

17:                                               ; preds = %2
  %18 = load i32, ptr @quiet, align 4, !tbaa !5
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %25, label %20

20:                                               ; preds = %17
  %21 = load i64, ptr @testcalls, align 8, !tbaa !9
  %22 = load i64, ptr @simulatedopcount, align 8, !tbaa !9
  %23 = icmp ugt i64 %21, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  call void (ptr, ...) @prt(ptr noundef @.str.53)
  br label %25

25:                                               ; preds = %24, %20, %17
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  call void @log4(i32 noundef 7, i32 noundef 6, i32 noundef %26, i32 noundef %27)
  store i32 1, ptr %9, align 4
  br label %168

28:                                               ; preds = %2
  %29 = load i64, ptr @file_size, align 8, !tbaa !9
  store i64 %29, ptr %7, align 8, !tbaa !9
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = load i32, ptr %4, align 4, !tbaa !5
  call void @log4(i32 noundef 6, i32 noundef %30, i32 noundef %31, i32 noundef 0)
  %32 = load ptr, ptr @original_buf, align 8, !tbaa !11
  %33 = load ptr, ptr @good_buf, align 8, !tbaa !11
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  call void @gendata(ptr noundef %32, ptr noundef %33, i32 noundef %34, i32 noundef %35)
  %36 = load i64, ptr @file_size, align 8, !tbaa !9
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = add i32 %37, %38
  %40 = zext i32 %39 to i64
  %41 = icmp slt i64 %36, %40
  br i1 %41, label %42, label %64

42:                                               ; preds = %28
  %43 = load i64, ptr @file_size, align 8, !tbaa !9
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = icmp slt i64 %43, %45
  br i1 %46, label %47, label %55

47:                                               ; preds = %42
  %48 = load ptr, ptr @good_buf, align 8, !tbaa !11
  %49 = load i64, ptr @file_size, align 8, !tbaa !9
  %50 = getelementptr inbounds i8, ptr %48, i64 %49
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = zext i32 %51 to i64
  %53 = load i64, ptr @file_size, align 8, !tbaa !9
  %54 = sub nsw i64 %52, %53
  call void @llvm.memset.p0.i64(ptr align 1 %50, i8 0, i64 %54, i1 false)
  br label %55

55:                                               ; preds = %47, %42
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = add i32 %56, %57
  %59 = zext i32 %58 to i64
  store i64 %59, ptr @file_size, align 8, !tbaa !9
  %60 = load i32, ptr @lite, align 4, !tbaa !5
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %55
  call void (ptr, ...) @warn(ptr noundef @.str.54)
  call void @report_failure(i32 noundef 200)
  br label %63

63:                                               ; preds = %62, %55
  br label %64

64:                                               ; preds = %63, %28
  %65 = load i64, ptr @testcalls, align 8, !tbaa !9
  %66 = load i64, ptr @simulatedopcount, align 8, !tbaa !9
  %67 = icmp ule i64 %65, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  store i32 1, ptr %9, align 4
  br label %168

69:                                               ; preds = %64
  %70 = load i32, ptr @quiet, align 4, !tbaa !5
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %109, label %72

72:                                               ; preds = %69
  %73 = load i64, ptr @progressinterval, align 8, !tbaa !9
  %74 = icmp ne i64 %73, 0
  br i1 %74, label %75, label %80

75:                                               ; preds = %72
  %76 = load i64, ptr @testcalls, align 8, !tbaa !9
  %77 = load i64, ptr @progressinterval, align 8, !tbaa !9
  %78 = urem i64 %76, %77
  %79 = icmp eq i64 %78, 0
  br i1 %79, label %101, label %80

80:                                               ; preds = %75, %72
  %81 = load i32, ptr @debug, align 4, !tbaa !5
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %109

83:                                               ; preds = %80
  %84 = load i64, ptr @monitorstart, align 8, !tbaa !9
  %85 = icmp eq i64 %84, -1
  br i1 %85, label %101, label %86

86:                                               ; preds = %83
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = add i32 %87, %88
  %90 = zext i32 %89 to i64
  %91 = load i64, ptr @monitorstart, align 8, !tbaa !9
  %92 = icmp sgt i64 %90, %91
  br i1 %92, label %93, label %109

93:                                               ; preds = %86
  %94 = load i64, ptr @monitorend, align 8, !tbaa !9
  %95 = icmp eq i64 %94, -1
  br i1 %95, label %101, label %96

96:                                               ; preds = %93
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = zext i32 %97 to i64
  %99 = load i64, ptr @monitorend, align 8, !tbaa !9
  %100 = icmp sle i64 %98, %99
  br i1 %100, label %101, label %109

101:                                              ; preds = %96, %93, %83, %75
  %102 = load i64, ptr @testcalls, align 8, !tbaa !9
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = add i32 %104, %105
  %107 = sub i32 %106, 1
  %108 = load i32, ptr %4, align 4, !tbaa !5
  call void (ptr, ...) @prt(ptr noundef @.str.59, i64 noundef %102, i32 noundef %103, i32 noundef %107, i32 noundef %108)
  br label %109

109:                                              ; preds = %101, %96, %86, %80, %69
  %110 = load i64, ptr @file_size, align 8, !tbaa !9
  %111 = load i64, ptr %7, align 8, !tbaa !9
  %112 = icmp sgt i64 %110, %111
  br i1 %112, label %113, label %120

113:                                              ; preds = %109
  %114 = load i32, ptr @fd, align 4, !tbaa !5
  %115 = load i64, ptr @file_size, align 8, !tbaa !9
  %116 = call i32 @ftruncate(i32 noundef %114, i64 noundef %115) #7
  %117 = icmp eq i32 %116, -1
  br i1 %117, label %118, label %119

118:                                              ; preds = %113
  call void @prterr(ptr noundef @.str.60)
  call void @exit(i32 noundef 201) #8
  unreachable

119:                                              ; preds = %113
  br label %120

120:                                              ; preds = %119, %109
  %121 = load i32, ptr %3, align 4, !tbaa !5
  %122 = load i32, ptr @page_mask, align 4, !tbaa !5
  %123 = and i32 %121, %122
  store i32 %123, ptr %5, align 4, !tbaa !5
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = add i32 %124, %125
  store i32 %126, ptr %6, align 4, !tbaa !5
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = zext i32 %127 to i64
  %129 = load i32, ptr @fd, align 4, !tbaa !5
  %130 = load i32, ptr %3, align 4, !tbaa !5
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sub i32 %130, %131
  %133 = zext i32 %132 to i64
  %134 = call ptr @mmap(ptr noundef null, i64 noundef %128, i32 noundef 3, i32 noundef 1, i32 noundef %129, i64 noundef %133) #7
  store ptr %134, ptr %8, align 8, !tbaa !11
  %135 = icmp eq ptr %134, inttoptr (i64 -1 to ptr)
  br i1 %135, label %136, label %137

136:                                              ; preds = %120
  call void @prterr(ptr noundef @.str.61)
  call void @report_failure(i32 noundef 202)
  br label %137

137:                                              ; preds = %136, %120
  %138 = load ptr, ptr %8, align 8, !tbaa !11
  %139 = load i32, ptr %5, align 4, !tbaa !5
  %140 = zext i32 %139 to i64
  %141 = getelementptr inbounds i8, ptr %138, i64 %140
  %142 = load ptr, ptr @good_buf, align 8, !tbaa !11
  %143 = load i32, ptr %3, align 4, !tbaa !5
  %144 = zext i32 %143 to i64
  %145 = getelementptr inbounds i8, ptr %142, i64 %144
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = zext i32 %146 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %141, ptr align 1 %145, i64 %147, i1 false)
  %148 = load i32, ptr @mapped_msync, align 4, !tbaa !5
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %157

150:                                              ; preds = %137
  %151 = load ptr, ptr %8, align 8, !tbaa !11
  %152 = load i32, ptr %6, align 4, !tbaa !5
  %153 = zext i32 %152 to i64
  %154 = call i32 @msync(ptr noundef %151, i64 noundef %153, i32 noundef 4)
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %157

156:                                              ; preds = %150
  call void @prterr(ptr noundef @.str.62)
  call void @report_failure(i32 noundef 203)
  br label %157

157:                                              ; preds = %156, %150, %137
  %158 = load i32, ptr %3, align 4, !tbaa !5
  %159 = load ptr, ptr %8, align 8, !tbaa !11
  %160 = load i32, ptr %4, align 4, !tbaa !5
  call void @check_eofpage(ptr noundef @.str.63, i32 noundef %158, ptr noundef %159, i32 noundef %160)
  %161 = load ptr, ptr %8, align 8, !tbaa !11
  %162 = load i32, ptr %6, align 4, !tbaa !5
  %163 = zext i32 %162 to i64
  %164 = call i32 @munmap(ptr noundef %161, i64 noundef %163) #7
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %167

166:                                              ; preds = %157
  call void @prterr(ptr noundef @.str.64)
  call void @report_failure(i32 noundef 204)
  br label %167

167:                                              ; preds = %166, %157
  store i32 0, ptr %9, align 4
  br label %168

168:                                              ; preds = %167, %68, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  %169 = load i32, ptr %9, align 4
  switch i32 %169, label %171 [
    i32 0, label %170
    i32 1, label %170
  ]

170:                                              ; preds = %168, %168
  ret void

171:                                              ; preds = %168
  unreachable
}

declare i32 @msync(ptr noundef, i64 noundef, i32 noundef) #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn nounwind "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 "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "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 #7 = { nounwind }
attributes #8 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


; 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"

@file_size = external dso_local local_unnamed_addr global i64, align 8
@testcalls = external dso_local local_unnamed_addr global i64, align 8
@simulatedopcount = external dso_local local_unnamed_addr global i64, align 8
@debug = external dso_local local_unnamed_addr global i32, align 4
@quiet = external dso_local local_unnamed_addr global i32, align 4
@progressinterval = external dso_local local_unnamed_addr global i64, align 8
@writebdy = external dso_local local_unnamed_addr global i32, align 4
@monitorstart = external dso_local local_unnamed_addr global i64, align 8
@monitorend = external dso_local local_unnamed_addr global i64, align 8
@lite = external dso_local local_unnamed_addr global i32, align 4
@mapped_msync = external dso_local local_unnamed_addr global i32, align 4
@good_buf = external dso_local local_unnamed_addr global ptr, align 8
@fd = external dso_local local_unnamed_addr global i32, align 4
@page_mask = external dso_local local_unnamed_addr global i32, align 4
@.str.53 = external hidden unnamed_addr constant [26 x i8], align 1
@original_buf = external dso_local local_unnamed_addr global ptr, align 8
@.str.54 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.61 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.62 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @warn(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @prt(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @prterr(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @log4(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @report_failure(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @check_eofpage(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i32 @munmap(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @gendata(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @domapwrite(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr @writebdy, align 4, !tbaa !5
  %4 = urem i32 %0, %3
  %5 = sub nuw i32 %0, %4
  %6 = icmp eq i32 %1, 0
  br i1 %6, label %7, label %15

7:                                                ; preds = %2
  %8 = load i32, ptr @quiet, align 4, !tbaa !5
  %.not55 = icmp eq i32 %8, 0
  br i1 %.not55, label %9, label %14

9:                                                ; preds = %7
  %10 = load i64, ptr @testcalls, align 8, !tbaa !9
  %11 = load i64, ptr @simulatedopcount, align 8, !tbaa !9
  %12 = icmp ugt i64 %10, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %9
  tail call void (ptr, ...) @prt(ptr noundef nonnull @.str.53)
  br label %14

14:                                               ; preds = %13, %9, %7
  tail call void @log4(i32 noundef 7, i32 noundef 6, i32 noundef %5, i32 noundef 0)
  br label %89

15:                                               ; preds = %2
  %16 = load i64, ptr @file_size, align 8, !tbaa !9
  tail call void @log4(i32 noundef 6, i32 noundef %5, i32 noundef %1, i32 noundef 0)
  %17 = load ptr, ptr @original_buf, align 8, !tbaa !11
  %18 = load ptr, ptr @good_buf, align 8, !tbaa !11
  tail call void @gendata(ptr noundef %17, ptr noundef %18, i32 noundef %5, i32 noundef %1)
  %19 = load i64, ptr @file_size, align 8, !tbaa !9
  %20 = add i32 %5, %1
  %21 = zext i32 %20 to i64
  %22 = icmp slt i64 %19, %21
  br i1 %22, label %23, label %33

23:                                               ; preds = %15
  %24 = zext i32 %5 to i64
  %25 = icmp slt i64 %19, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %23
  %27 = load ptr, ptr @good_buf, align 8, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %27, i64 %19
  %29 = sub nsw i64 %24, %19
  tail call void @llvm.memset.p0.i64(ptr align 1 %28, i8 0, i64 %29, i1 false)
  br label %30

30:                                               ; preds = %26, %23
  store i64 %21, ptr @file_size, align 8, !tbaa !9
  %31 = load i32, ptr @lite, align 4, !tbaa !5
  %.not = icmp eq i32 %31, 0
  br i1 %.not, label %33, label %32

32:                                               ; preds = %30
  tail call void (ptr, ...) @warn(ptr noundef nonnull @.str.54)
  tail call void @report_failure(i32 noundef 200)
  br label %33

33:                                               ; preds = %30, %32, %15
  %34 = load i64, ptr @testcalls, align 8, !tbaa !9
  %35 = load i64, ptr @simulatedopcount, align 8, !tbaa !9
  %.not47 = icmp ugt i64 %34, %35
  br i1 %.not47, label %36, label %89

36:                                               ; preds = %33
  %37 = load i32, ptr @quiet, align 4, !tbaa !5
  %.not48 = icmp eq i32 %37, 0
  br i1 %.not48, label %38, label %56

38:                                               ; preds = %36
  %39 = load i64, ptr @progressinterval, align 8, !tbaa !9
  %.not49 = icmp eq i64 %39, 0
  br i1 %.not49, label %43, label %40

40:                                               ; preds = %38
  %41 = urem i64 %34, %39
  %42 = icmp eq i64 %41, 0
  br i1 %42, label %54, label %43

43:                                               ; preds = %40, %38
  %44 = load i32, ptr @debug, align 4, !tbaa !5
  %.not50 = icmp eq i32 %44, 0
  br i1 %.not50, label %56, label %45

45:                                               ; preds = %43
  %46 = load i64, ptr @monitorstart, align 8, !tbaa !9
  %47 = icmp eq i64 %46, -1
  br i1 %47, label %54, label %48

48:                                               ; preds = %45
  %49 = icmp slt i64 %46, %21
  br i1 %49, label %50, label %56

50:                                               ; preds = %48
  %51 = load i64, ptr @monitorend, align 8, !tbaa !9
  %52 = icmp ne i64 %51, -1
  %53 = zext i32 %5 to i64
  %.not51 = icmp slt i64 %51, %53
  %or.cond = select i1 %52, i1 %.not51, i1 false
  br i1 %or.cond, label %56, label %54

54:                                               ; preds = %50, %45, %40
  %55 = add i32 %20, -1
  tail call void (ptr, ...) @prt(ptr noundef nonnull @.str.59, i64 noundef %34, i32 noundef %5, i32 noundef %55, i32 noundef %1)
  br label %56

56:                                               ; preds = %50, %54, %48, %43, %36
  %57 = load i64, ptr @file_size, align 8, !tbaa !9
  %58 = icmp sgt i64 %57, %16
  br i1 %58, label %59, label %64

59:                                               ; preds = %56
  %60 = load i32, ptr @fd, align 4, !tbaa !5
  %61 = tail call i32 @ftruncate(i32 noundef %60, i64 noundef %57) #6
  %62 = icmp eq i32 %61, -1
  br i1 %62, label %63, label %64

63:                                               ; preds = %59
  tail call void @prterr(ptr noundef nonnull @.str.60)
  tail call void @exit(i32 noundef 201) #7
  unreachable

64:                                               ; preds = %59, %56
  %65 = load i32, ptr @page_mask, align 4, !tbaa !5
  %66 = and i32 %65, %5
  %67 = add i32 %66, %1
  %68 = zext i32 %67 to i64
  %69 = load i32, ptr @fd, align 4, !tbaa !5
  %70 = sub i32 %5, %66
  %71 = zext i32 %70 to i64
  %72 = tail call ptr @mmap(ptr noundef null, i64 noundef %68, i32 noundef 3, i32 noundef 1, i32 noundef %69, i64 noundef %71) #6
  %73 = icmp eq ptr %72, inttoptr (i64 -1 to ptr)
  br i1 %73, label %74, label %75

74:                                               ; preds = %64
  tail call void @prterr(ptr noundef nonnull @.str.61)
  tail call void @report_failure(i32 noundef 202)
  br label %75

75:                                               ; preds = %74, %64
  %76 = zext i32 %66 to i64
  %77 = getelementptr inbounds i8, ptr %72, i64 %76
  %78 = load ptr, ptr @good_buf, align 8, !tbaa !11
  %79 = zext i32 %5 to i64
  %80 = getelementptr inbounds i8, ptr %78, i64 %79
  %81 = zext i32 %1 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %77, ptr align 1 %80, i64 %81, i1 false)
  %82 = load i32, ptr @mapped_msync, align 4, !tbaa !5
  %.not52 = icmp eq i32 %82, 0
  br i1 %.not52, label %86, label %83

83:                                               ; preds = %75
  %84 = tail call i32 @msync(ptr noundef %72, i64 noundef %68, i32 noundef 4) #6
  %.not53 = icmp eq i32 %84, 0
  br i1 %.not53, label %86, label %85

85:                                               ; preds = %83
  tail call void @prterr(ptr noundef nonnull @.str.62)
  tail call void @report_failure(i32 noundef 203)
  br label %86

86:                                               ; preds = %85, %83, %75
  tail call void @check_eofpage(ptr noundef nonnull @.str.63, i32 noundef %5, ptr noundef %72, i32 noundef %1)
  %87 = tail call i32 @munmap(ptr noundef %72, i64 noundef %68) #6
  %.not54 = icmp eq i32 %87, 0
  br i1 %.not54, label %89, label %88

88:                                               ; preds = %86
  tail call void @prterr(ptr noundef nonnull @.str.64)
  tail call void @report_failure(i32 noundef 204)
  br label %89

89:                                               ; preds = %86, %88, %33, %14
  ret void
}

declare i32 @msync(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #5

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 = { noreturn nounwind "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 "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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 #6 = { nounwind }
attributes #7 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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