; LLVM IR from travisdowns/uarch-bench :: page-info (get_info_for_range)

; 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.page_info = type { i64, i8, i8, i8, i8, i8, i8, i64 }
%struct.page_info_array = type { i64, ptr }

@.str.37 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [41 x i8], align 1
@__PRETTY_FUNCTION__.get_info_for_range = external hidden unnamed_addr constant [51 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @extract_info(ptr dead_on_unwind noalias writable sret(%struct.page_info) align 8, i64 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; 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
define dso_local { i64, ptr } @get_info_for_range(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca %struct.page_info_array, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca %struct.page_info, align 8
  %20 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  %21 = call i32 @get_page_size()
  store i32 %21, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = call ptr @pagedown(ptr noundef %22, i32 noundef %23)
  store ptr %24, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 -1
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = call ptr @pagedown(ptr noundef %26, i32 noundef %27)
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds i8, ptr %28, i64 %30
  store ptr %31, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = icmp ult ptr %32, %33
  br i1 %34, label %35, label %44

35:                                               ; preds = %2
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = ptrtoint ptr %36 to i64
  %39 = ptrtoint ptr %37 to i64
  %40 = sub i64 %38, %39
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = sdiv i64 %40, %42
  br label %45

44:                                               ; preds = %2
  br label %45

45:                                               ; preds = %44, %35
  %46 = phi i64 [ %43, %35 ], [ 0, %44 ]
  store i64 %46, ptr %9, align 8, !tbaa !11
  %47 = load i64, ptr %9, align 8, !tbaa !11
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %53, label %49

49:                                               ; preds = %45
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = icmp ult ptr %50, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %49, %45
  br label %55

54:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.38, ptr noundef @.str.37, i32 noundef 264, ptr noundef @__PRETTY_FUNCTION__.get_info_for_range) #10
  unreachable

55:                                               ; preds = %53
  %56 = load i64, ptr %9, align 8, !tbaa !11
  %57 = icmp eq i64 %56, 0
  br i1 %57, label %58, label %61

58:                                               ; preds = %55
  %59 = getelementptr inbounds %struct.page_info_array, ptr %3, i32 0, i32 0
  store i64 0, ptr %59, align 8, !tbaa !13
  %60 = getelementptr inbounds %struct.page_info_array, ptr %3, i32 0, i32 1
  store ptr null, ptr %60, align 8, !tbaa !15
  store i32 1, ptr %10, align 4
  br label %166

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %62 = load i64, ptr %9, align 8, !tbaa !11
  %63 = add i64 %62, 1
  %64 = mul i64 %63, 24
  %65 = call noalias ptr @malloc(i64 noundef %64) #11
  store ptr %65, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %66 = call noalias ptr @fopen(ptr noundef @.str.39, ptr noundef @.str.40)
  store ptr %66, ptr %12, align 8, !tbaa !5
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %70, label %69

69:                                               ; preds = %61
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.41) #12
  unreachable

70:                                               ; preds = %61
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = ptrtoint ptr %72 to i64
  %74 = load i32, ptr %6, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  %76 = udiv i64 %73, %75
  %77 = mul i64 %76, 8
  %78 = call i32 @fseek(ptr noundef %71, i64 noundef %77, i32 noundef 0)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %70
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.42) #12
  unreachable

81:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %82 = load i64, ptr %9, align 8, !tbaa !11
  %83 = mul i64 %82, 8
  store i64 %83, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %84 = load i64, ptr %13, align 8, !tbaa !11
  %85 = call noalias ptr @malloc(i64 noundef %84) #11
  store ptr %85, ptr %14, align 8, !tbaa !5
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  br label %90

89:                                               ; preds = %81
  call void @__assert_fail(ptr noundef @.str.43, ptr noundef @.str.37, i32 noundef 281, ptr noundef @__PRETTY_FUNCTION__.get_info_for_range) #10
  unreachable

90:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = load i64, ptr %13, align 8, !tbaa !11
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = call i64 @fread(ptr noundef %91, i64 noundef %92, i64 noundef 1, ptr noundef %93)
  store i64 %94, ptr %15, align 8, !tbaa !11
  %95 = load i64, ptr %15, align 8, !tbaa !11
  %96 = icmp ne i64 %95, 1
  br i1 %96, label %97, label %99

97:                                               ; preds = %90
  %98 = load i64, ptr %15, align 8, !tbaa !11
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.44, i64 noundef %98) #12
  unreachable

99:                                               ; preds = %90
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = call i32 @fclose(ptr noundef %100)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  store i64 0, ptr %18, align 8, !tbaa !11
  br label %102

102:                                              ; preds = %151, %99
  %103 = load i64, ptr %18, align 8, !tbaa !11
  %104 = load i64, ptr %9, align 8, !tbaa !11
  %105 = icmp ult i64 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %154

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #9
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load i64, ptr %18, align 8, !tbaa !11
  %110 = getelementptr inbounds i64, ptr %108, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !11
  call void @extract_info(ptr dead_on_unwind writable sret(%struct.page_info) align 8 %19, i64 noundef %111)
  %112 = getelementptr inbounds %struct.page_info, ptr %19, i32 0, i32 0
  %113 = load i64, ptr %112, align 8, !tbaa !16
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %147

115:                                              ; preds = %107
  %116 = load i32, ptr %17, align 4, !tbaa !9
  %117 = icmp eq i32 %116, 0
  br i1 %117, label %118, label %125

118:                                              ; preds = %115
  %119 = call noalias ptr @fopen(ptr noundef @.str.45, ptr noundef @.str.40)
  store ptr %119, ptr %16, align 8, !tbaa !5
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = icmp ne ptr %120, null
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  call void (ptr, ...) @warn(ptr noundef @.str.46)
  store i32 2, ptr %17, align 4, !tbaa !9
  br label %124

123:                                              ; preds = %118
  store i32 1, ptr %17, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %123, %122
  br label %125

125:                                              ; preds = %124, %115
  %126 = load i32, ptr %17, align 4, !tbaa !9
  %127 = icmp eq i32 %126, 1
  br i1 %127, label %128, label %146

128:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #9
  %129 = load ptr, ptr %16, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.page_info, ptr %19, i32 0, i32 0
  %131 = load i64, ptr %130, align 8, !tbaa !16
  %132 = mul i64 %131, 8
  %133 = call i32 @fseek(ptr noundef %129, i64 noundef %132, i32 noundef 0)
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %128
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.47) #12
  unreachable

136:                                              ; preds = %128
  %137 = load ptr, ptr %16, align 8, !tbaa !5
  %138 = call i64 @fread(ptr noundef %20, i64 noundef 8, i64 noundef 1, ptr noundef %137)
  store i64 %138, ptr %15, align 8, !tbaa !11
  %139 = icmp ne i64 %138, 1
  br i1 %139, label %140, label %142

140:                                              ; preds = %136
  %141 = load i64, ptr %15, align 8, !tbaa !11
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.48, i64 noundef %141) #12
  unreachable

142:                                              ; preds = %136
  %143 = getelementptr inbounds %struct.page_info, ptr %19, i32 0, i32 6
  store i8 1, ptr %143, align 1, !tbaa !19
  %144 = load i64, ptr %20, align 8, !tbaa !11
  %145 = getelementptr inbounds %struct.page_info, ptr %19, i32 0, i32 7
  store i64 %144, ptr %145, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #9
  br label %146

146:                                              ; preds = %142, %125
  br label %147

147:                                              ; preds = %146, %107
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  %149 = load i64, ptr %18, align 8, !tbaa !11
  %150 = getelementptr inbounds %struct.page_info, ptr %148, i64 %149
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %150, ptr align 8 %19, i64 24, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #9
  br label %151

151:                                              ; preds = %147
  %152 = load i64, ptr %18, align 8, !tbaa !11
  %153 = add i64 %152, 1
  store i64 %153, ptr %18, align 8, !tbaa !11
  br label %102, !llvm.loop !23

154:                                              ; preds = %106
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = icmp ne ptr %155, null
  br i1 %156, label %157, label %160

157:                                              ; preds = %154
  %158 = load ptr, ptr %16, align 8, !tbaa !5
  %159 = call i32 @fclose(ptr noundef %158)
  br label %160

160:                                              ; preds = %157, %154
  %161 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %161) #9
  %162 = getelementptr inbounds %struct.page_info_array, ptr %3, i32 0, i32 0
  %163 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %163, ptr %162, align 8, !tbaa !13
  %164 = getelementptr inbounds %struct.page_info_array, ptr %3, i32 0, i32 1
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %165, ptr %164, align 8, !tbaa !15
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %166

166:                                              ; preds = %160, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  %167 = load { i64, ptr }, ptr %3, align 8
  ret { i64, ptr } %167
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @pagedown(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

declare noalias ptr @fopen(ptr noundef, ptr noundef) #6

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #7

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #6

declare i32 @fclose(ptr noundef) #6

declare void @warn(ptr noundef, ...) #6

; Function Attrs: nounwind
declare void @free(ptr noundef) #8

; Function Attrs: nounwind uwtable
declare hidden i32 @get_page_size() #0

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint 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 #5 = { nounwind allocsize(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 #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 = { noreturn "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 #8 = { 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 #9 = { nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { noreturn }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !6, i64 8}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !12, i64 0}
!17 = !{!"", !12, i64 0, !18, i64 8, !18, i64 9, !18, i64 10, !18, i64 11, !18, i64 12, !18, i64 13, !12, i64 16}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!17, !18, i64 13}
!20 = !{!17, !12, i64 16}
!21 = !{i64 0, i64 8, !11, i64 8, i64 1, !22, i64 9, i64 1, !22, i64 10, i64 1, !22, i64 11, i64 1, !22, i64 12, i64 1, !22, i64 13, i64 1, !22, i64 16, i64 8, !11}
!22 = !{!18, !18, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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.page_info = type { i64, i8, i8, i8, i8, i8, i8, i64 }

@.str.37 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [41 x i8], align 1
@__PRETTY_FUNCTION__.get_info_for_range = external hidden unnamed_addr constant [51 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @extract_info(ptr dead_on_unwind noalias writable sret(%struct.page_info) align 8, i64 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local { i64, ptr } @get_info_for_range(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.page_info, align 8
  %4 = alloca i64, align 8
  %5 = tail call i32 @get_page_size()
  %6 = tail call ptr @pagedown(ptr noundef %0, i32 noundef %5)
  %7 = getelementptr inbounds i8, ptr %1, i64 -1
  %8 = tail call ptr @pagedown(ptr noundef nonnull %7, i32 noundef %5)
  %9 = zext i32 %5 to i64
  %10 = icmp ult ptr %0, %1
  br i1 %10, label %11, label %.thread65

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %8, i64 %9
  %13 = ptrtoint ptr %12 to i64
  %14 = ptrtoint ptr %6 to i64
  %15 = sub i64 %13, %14
  %16 = sdiv i64 %15, %9
  %17 = icmp eq i64 %16, 0
  %18 = icmp ult ptr %6, %12
  %or.cond = select i1 %17, i1 true, i1 %18
  br i1 %or.cond, label %20, label %19

19:                                               ; preds = %11
  tail call void @__assert_fail(ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.37, i32 noundef 264, ptr noundef nonnull @__PRETTY_FUNCTION__.get_info_for_range) #10
  unreachable

20:                                               ; preds = %11
  br i1 %17, label %.thread65, label %21

21:                                               ; preds = %20
  %22 = mul i64 %16, 24
  %23 = add i64 %22, 24
  %24 = tail call noalias ptr @malloc(i64 noundef %23) #11
  %25 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.40)
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %26, label %27

26:                                               ; preds = %21
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.41) #10
  unreachable

27:                                               ; preds = %21
  %28 = udiv i64 %14, %9
  %29 = shl i64 %28, 3
  %30 = tail call i32 @fseek(ptr noundef nonnull %25, i64 noundef %29, i32 noundef 0)
  %.not56 = icmp eq i32 %30, 0
  br i1 %.not56, label %32, label %31

31:                                               ; preds = %27
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.42) #10
  unreachable

32:                                               ; preds = %27
  %33 = shl i64 %16, 3
  %34 = tail call noalias ptr @malloc(i64 noundef %33) #11
  %.not57 = icmp eq ptr %34, null
  br i1 %.not57, label %35, label %36

35:                                               ; preds = %32
  tail call void @__assert_fail(ptr noundef nonnull @.str.43, ptr noundef nonnull @.str.37, i32 noundef 281, ptr noundef nonnull @__PRETTY_FUNCTION__.get_info_for_range) #10
  unreachable

36:                                               ; preds = %32
  %37 = tail call i64 @fread(ptr noundef nonnull %34, i64 noundef %33, i64 noundef 1, ptr noundef nonnull %25)
  %.not58 = icmp eq i64 %37, 1
  br i1 %.not58, label %39, label %38

38:                                               ; preds = %36
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.44, i64 noundef %37) #10
  unreachable

39:                                               ; preds = %36
  %40 = tail call i32 @fclose(ptr noundef nonnull %25)
  %41 = getelementptr inbounds i8, ptr %3, i64 13
  %42 = getelementptr inbounds i8, ptr %3, i64 16
  br label %.backedge

43:                                               ; preds = %59
  %.not59 = icmp eq ptr %.248, null
  br i1 %.not59, label %.thread82, label %64

.backedge:                                        ; preds = %.backedge.backedge, %39
  %.077 = phi i64 [ 0, %39 ], [ %.077.be, %.backedge.backedge ]
  %.04576 = phi i32 [ 0, %39 ], [ %.04576.be, %.backedge.backedge ]
  %.04675 = phi ptr [ null, %39 ], [ %.04675.be, %.backedge.backedge ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #12
  %44 = getelementptr inbounds i64, ptr %34, i64 %.077
  %45 = load i64, ptr %44, align 8, !tbaa !5
  call void @extract_info(ptr dead_on_unwind nonnull writable sret(%struct.page_info) align 8 %3, i64 noundef %45)
  %46 = load i64, ptr %3, align 8, !tbaa !9
  %.not60 = icmp eq i64 %46, 0
  br i1 %.not60, label %59, label %47

47:                                               ; preds = %.backedge
  switch i32 %.04576, label %59 [
    i32 0, label %48
    i32 1, label %.thread66
  ]

48:                                               ; preds = %47
  %49 = call noalias ptr @fopen(ptr noundef nonnull @.str.45, ptr noundef nonnull @.str.40)
  %.not61 = icmp eq ptr %49, null
  br i1 %.not61, label %.thread, label %..thread66_crit_edge

..thread66_crit_edge:                             ; preds = %48
  %.pre = load i64, ptr %3, align 8, !tbaa !9
  br label %.thread66

.thread66:                                        ; preds = %..thread66_crit_edge, %47
  %50 = phi i64 [ %.pre, %..thread66_crit_edge ], [ %46, %47 ]
  %.14769 = phi ptr [ %49, %..thread66_crit_edge ], [ %.04675, %47 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #12
  %51 = shl i64 %50, 3
  %52 = call i32 @fseek(ptr noundef %.14769, i64 noundef %51, i32 noundef 0)
  %.not62 = icmp eq i32 %52, 0
  br i1 %.not62, label %54, label %53

53:                                               ; preds = %.thread66
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.47) #10
  unreachable

54:                                               ; preds = %.thread66
  %55 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 8, i64 noundef 1, ptr noundef %.14769)
  %.not63 = icmp eq i64 %55, 1
  br i1 %.not63, label %57, label %56

56:                                               ; preds = %54
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.48, i64 noundef %55) #10
  unreachable

57:                                               ; preds = %54
  store i8 1, ptr %41, align 1, !tbaa !12
  %58 = load i64, ptr %4, align 8, !tbaa !5
  store i64 %58, ptr %42, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #12
  br label %59

59:                                               ; preds = %47, %57, %.backedge
  %.248 = phi ptr [ %.14769, %57 ], [ %.04675, %.backedge ], [ %.04675, %47 ]
  %.2 = phi i32 [ 1, %57 ], [ %.04576, %.backedge ], [ 2, %47 ]
  %60 = getelementptr inbounds %struct.page_info, ptr %24, i64 %.077
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 8 dereferenceable(24) %3, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #12
  %61 = add nuw i64 %.077, 1
  %exitcond.not = icmp eq i64 %61, %16
  br i1 %exitcond.not, label %43, label %.backedge.backedge

.backedge.backedge:                               ; preds = %59, %.thread
  %.077.be = phi i64 [ %61, %59 ], [ %63, %.thread ]
  %.04576.be = phi i32 [ %.2, %59 ], [ 2, %.thread ]
  %.04675.be = phi ptr [ %.248, %59 ], [ null, %.thread ]
  br label %.backedge, !llvm.loop !16

.thread:                                          ; preds = %48
  call void (ptr, ...) @warn(ptr noundef nonnull @.str.46) #12
  %62 = getelementptr inbounds %struct.page_info, ptr %24, i64 %.077
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 8 dereferenceable(24) %3, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #12
  %63 = add nuw i64 %.077, 1
  %exitcond.not80 = icmp eq i64 %63, %16
  br i1 %exitcond.not80, label %.thread82, label %.backedge.backedge

64:                                               ; preds = %43
  %65 = call i32 @fclose(ptr noundef nonnull %.248)
  br label %.thread82

.thread82:                                        ; preds = %.thread, %64, %43
  call void @free(ptr noundef nonnull %34) #12
  br label %.thread65

.thread65:                                        ; preds = %2, %20, %.thread82
  %.sroa.0.0 = phi i64 [ %16, %.thread82 ], [ 0, %20 ], [ 0, %2 ]
  %.sroa.3.0 = phi ptr [ %24, %.thread82 ], [ null, %20 ], [ null, %2 ]
  %.fca.0.insert = insertvalue { i64, ptr } poison, i64 %.sroa.0.0, 0
  %.fca.1.insert = insertvalue { i64, ptr } %.fca.0.insert, ptr %.sroa.3.0, 1
  ret { i64, ptr } %.fca.1.insert
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @pagedown(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #6

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #6

declare void @warn(ptr noundef, ...) local_unnamed_addr #8

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #9

; Function Attrs: nounwind uwtable
declare hidden i32 @get_page_size() local_unnamed_addr #0

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint 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 #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nofree 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 #7 = { noreturn "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 #8 = { "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 #9 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !11, i64 12, !11, i64 13, !6, i64 16}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!10, !11, i64 13}
!13 = !{!10, !6, i64 16}
!14 = !{i64 0, i64 8, !5, i64 8, i64 1, !15, i64 9, i64 1, !15, i64 10, i64 1, !15, i64 11, i64 1, !15, i64 12, i64 1, !15, i64 13, i64 1, !15, i64 16, i64 8, !5}
!15 = !{!11, !11, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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