; LLVM IR from erthink/libmdbx :: src (mvcc-readers)

; 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.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.meta_ptr = type { i64, %union.anon.19, i64 }
%union.anon.19 = type { ptr }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.1, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.2, %struct.anon.6, i8, ptr, ptr, ptr, %struct.anon.7, %union.pthread_mutex_t, i32, i32, ptr, %struct.osal_ioring, %union.pthread_mutex_t, [71 x %union.mdbx_atomic_uint64_t] }
%struct.osal_mmap = type { %union.anon, i32, i64, i64, i64 }
%union.anon = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.1 = type { ptr, ptr, ptr, ptr }
%struct.anon.2 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.3, %union.anon.4 }
%struct.anon.3 = type { i16, i16, i16, i16 }
%union.anon.4 = type { i32 }
%struct.anon.6 = type { i64, i64, i64, i64, i64 }
%struct.anon.7 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.13 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.11, %union.anon.12 }
%union.anon.11 = type { i32 }
%union.anon.12 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.13 = type { %struct.anon.15 }
%struct.anon.15 = type { %struct.troika, ptr, %struct.anon.16, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.17 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.16 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.17 = type { %struct.anon.18 }
%struct.anon.18 = type { i64, ptr }
%struct.shared_lck = type { i64, i32, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, [2 x %union.mdbx_atomic_uint32_t], [16 x i8], %struct.pgops, [16 x i8], %union.pthread_mutex_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, i32, %struct.anon.10, %union.pthread_mutex_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, [16 x i8], [0 x %struct.reader_slot] }
%struct.pgops = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %struct.anon.8 }
%struct.anon.8 = type { %struct.gc_prof_stat, %struct.gc_prof_stat, i32, i32, i32, i32, i32 }
%struct.gc_prof_stat = type { i64, i64, i32, i32, i32, i32, %struct.anon.9 }
%struct.anon.9 = type { i64, i64, i32 }
%struct.anon.10 = type { [4 x i32], [4 x i64] }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }
%struct.meta = type { [2 x i32], %union.anon.20, i16, i8, i8, %struct.geo, %union.anon.21, %struct.MDBX_canary, %union.anon.24, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.20 = type { i64 }
%union.anon.21 = type { %struct.anon.22 }
%struct.anon.22 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%union.anon.24 = type { i64 }

@globals = external global %struct.libmdbx_globals, align 8
@__func__.mvcc_kick_laggards = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #0

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 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: alwaysinline nounwind uwtable
declare hidden i32 @atomic_load32(ptr noundef, i32 noundef) #3

; Function Attrs: cold nounwind optsize uwtable
declare dso_local i32 @mvcc_cleanup_dead(ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @atomic_store32(ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @safe64_reset(ptr noundef, i1 noundef zeroext) #3

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

; Function Attrs: hot nounwind uwtable
declare dso_local i64 @mvcc_shapshot_oldest(ptr noundef, i64 noundef) #5

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_load64(ptr noundef, i32 noundef) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @safe64_read(ptr noundef) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @safe64_reset_compare(ptr noundef, i64 noundef) #3

declare void @debug_log(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #6

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_store64(ptr noundef, i64 noundef, i32 noundef) #3

; Function Attrs: cold nounwind optsize uwtable
define dso_local zeroext i1 @mvcc_kick_laggards(ptr noundef %0, i64 noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i8, align 1
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = alloca %struct.meta_ptr, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %2
  %29 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !11
  %30 = zext i8 %29 to i32
  %31 = icmp sle i32 5, %30
  %32 = xor i1 %31, true
  %33 = xor i1 %32, true
  %34 = zext i1 %33 to i32
  %35 = sext i32 %34 to i64
  %36 = call i64 @llvm.expect.i64(i64 %35, i64 0)
  %37 = icmp ne i64 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %28
  %39 = load i64, ptr %4, align 8, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 304, ptr noundef @.str.13, i64 noundef %39)
  br label %40

40:                                               ; preds = %38, %28
  br label %41

41:                                               ; preds = %40
  fence acquire
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MDBX_env, ptr %42, i32 0, i32 32
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  store ptr %44, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #9
  store i8 0, ptr %7, align 1, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 0, ptr %8, align 4, !tbaa !26
  br label %45

45:                                               ; preds = %434, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.MDBX_env, ptr %46, i32 0, i32 39
  %48 = load ptr, ptr %47, align 8, !tbaa !27
  %49 = getelementptr inbounds %struct.MDBX_txn, ptr %48, i32 0, i32 17
  %50 = getelementptr inbounds %struct.anon.15, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.troika, ptr %50, i32 0, i32 5
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MDBX_env, ptr %52, i32 0, i32 39
  %54 = load ptr, ptr %53, align 8, !tbaa !27
  %55 = getelementptr inbounds %struct.MDBX_txn, ptr %54, i32 0, i32 17
  %56 = getelementptr inbounds %struct.anon.15, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.troika, ptr %56, i32 0, i32 2
  %58 = load i8, ptr %57, align 2, !tbaa !28
  %59 = zext i8 %58 to i64
  %60 = getelementptr inbounds [3 x i64], ptr %51, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !28
  store i64 %61, ptr %9, align 8, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.MDBX_env, ptr %62, i32 0, i32 7
  %64 = load ptr, ptr %63, align 8, !tbaa !29
  %65 = getelementptr inbounds %struct.shared_lck, ptr %64, i32 0, i32 21
  store volatile i32 1, ptr %65, align 4, !tbaa !28
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load i64, ptr %9, align 8, !tbaa !9
  %68 = call i64 @mvcc_shapshot_oldest(ptr noundef %66, i64 noundef %67) #10
  store i64 %68, ptr %6, align 8, !tbaa !9
  br label %69

69:                                               ; preds = %45
  %70 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !30
  %71 = zext i8 %70 to i32
  %72 = and i32 %71, 1
  %73 = icmp ne i32 %72, 0
  %74 = xor i1 %73, true
  %75 = xor i1 %74, true
  %76 = zext i1 %75 to i32
  %77 = sext i32 %76 to i64
  %78 = call i64 @llvm.expect.i64(i64 %77, i64 1)
  %79 = icmp ne i64 %78, 0
  br i1 %79, label %80, label %101

80:                                               ; preds = %69
  br label %81

81:                                               ; preds = %80
  %82 = load i64, ptr %6, align 8, !tbaa !9
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.MDBX_env, ptr %83, i32 0, i32 24
  %85 = load ptr, ptr %84, align 8, !tbaa !31
  %86 = getelementptr inbounds %struct.MDBX_txn, ptr %85, i32 0, i32 7
  %87 = load i64, ptr %86, align 8, !tbaa !32
  %88 = icmp ult i64 %82, %87
  %89 = xor i1 %88, true
  %90 = xor i1 %89, true
  %91 = xor i1 %90, true
  %92 = zext i1 %91 to i32
  %93 = sext i32 %92 to i64
  %94 = call i64 @llvm.expect.i64(i64 %93, i64 0)
  %95 = icmp ne i64 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %81
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %97, ptr noundef @.str.14, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 314) #11
  unreachable

98:                                               ; preds = %81
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100, %69
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  %105 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !30
  %106 = zext i8 %105 to i32
  %107 = and i32 %106, 1
  %108 = icmp ne i32 %107, 0
  %109 = xor i1 %108, true
  %110 = xor i1 %109, true
  %111 = zext i1 %110 to i32
  %112 = sext i32 %111 to i64
  %113 = call i64 @llvm.expect.i64(i64 %112, i64 1)
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %132

115:                                              ; preds = %104
  br label %116

116:                                              ; preds = %115
  %117 = load i64, ptr %6, align 8, !tbaa !9
  %118 = load i64, ptr %4, align 8, !tbaa !9
  %119 = icmp uge i64 %117, %118
  %120 = xor i1 %119, true
  %121 = xor i1 %120, true
  %122 = xor i1 %121, true
  %123 = zext i1 %122 to i32
  %124 = sext i32 %123 to i64
  %125 = call i64 @llvm.expect.i64(i64 %124, i64 0)
  %126 = icmp ne i64 %125, 0
  br i1 %126, label %127, label %129

127:                                              ; preds = %116
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %128, ptr noundef @.str.15, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 315) #11
  unreachable

129:                                              ; preds = %116
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131, %104
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !30
  %137 = zext i8 %136 to i32
  %138 = and i32 %137, 1
  %139 = icmp ne i32 %138, 0
  %140 = xor i1 %139, true
  %141 = xor i1 %140, true
  %142 = zext i1 %141 to i32
  %143 = sext i32 %142 to i64
  %144 = call i64 @llvm.expect.i64(i64 %143, i64 1)
  %145 = icmp ne i64 %144, 0
  br i1 %145, label %146, label %167

146:                                              ; preds = %135
  br label %147

147:                                              ; preds = %146
  %148 = load i64, ptr %6, align 8, !tbaa !9
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.MDBX_env, ptr %149, i32 0, i32 7
  %151 = load ptr, ptr %150, align 8, !tbaa !29
  %152 = getelementptr inbounds %struct.shared_lck, ptr %151, i32 0, i32 12
  %153 = load volatile i64, ptr %152, align 8, !tbaa !28
  %154 = icmp uge i64 %148, %153
  %155 = xor i1 %154, true
  %156 = xor i1 %155, true
  %157 = xor i1 %156, true
  %158 = zext i1 %157 to i32
  %159 = sext i32 %158 to i64
  %160 = call i64 @llvm.expect.i64(i64 %159, i64 0)
  %161 = icmp ne i64 %160, 0
  br i1 %161, label %162, label %164

162:                                              ; preds = %147
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %163, ptr noundef @.str.16, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 316) #11
  unreachable

164:                                              ; preds = %147
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166, %135
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.MDBX_env, ptr %170, i32 0, i32 6
  %172 = getelementptr inbounds %struct.osal_mmap, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !28
  store ptr %173, ptr %10, align 8, !tbaa !5
  %174 = load i64, ptr %6, align 8, !tbaa !9
  %175 = load i64, ptr %9, align 8, !tbaa !9
  %176 = icmp eq i64 %174, %175
  br i1 %176, label %184, label %177

177:                                              ; preds = %169
  %178 = load i64, ptr %6, align 8, !tbaa !9
  %179 = load i64, ptr %4, align 8, !tbaa !9
  %180 = icmp ugt i64 %178, %179
  br i1 %180, label %184, label %181

181:                                              ; preds = %177
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = icmp ne ptr %182, null
  br i1 %183, label %185, label %184

184:                                              ; preds = %181, %177, %169
  store i32 4, ptr %11, align 4
  br label %431

185:                                              ; preds = %181
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = call i32 @mvcc_cleanup_dead(ptr noundef %186, i32 noundef 0, ptr noundef null) #12
  %188 = icmp ne i32 %187, -1
  br i1 %188, label %189, label %194

189:                                              ; preds = %185
  %190 = load ptr, ptr %3, align 8, !tbaa !5
  %191 = call i32 @mvcc_cleanup_dead(ptr noundef %190, i32 noundef 0, ptr noundef null) #12
  %192 = icmp ne i32 %191, 0
  br i1 %192, label %193, label %194

193:                                              ; preds = %189
  store i32 4, ptr %11, align 4
  br label %431

194:                                              ; preds = %189, %185
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  store i64 0, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %195

195:                                              ; preds = %324, %194
  %196 = load i64, ptr %14, align 8, !tbaa !9
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.shared_lck, ptr %197, i32 0, i32 20
  %199 = load volatile i32, ptr %198, align 8, !tbaa !28
  %200 = zext i32 %199 to i64
  %201 = icmp ult i64 %196, %200
  br i1 %201, label %203, label %202

202:                                              ; preds = %195
  store i32 18, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %327

203:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %204 = load ptr, ptr %10, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.shared_lck, ptr %204, i32 0, i32 23
  %206 = load i64, ptr %14, align 8, !tbaa !9
  %207 = getelementptr inbounds [0 x %struct.reader_slot], ptr %205, i64 0, i64 %206
  store ptr %207, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %208 = load ptr, ptr %16, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.reader_slot, ptr %208, i32 0, i32 0
  %210 = call i64 @safe64_read(ptr noundef %209)
  store i64 %210, ptr %17, align 8, !tbaa !9
  br label %211

211:                                              ; preds = %317, %203
  %212 = load i64, ptr %17, align 8, !tbaa !9
  %213 = load i64, ptr %4, align 8, !tbaa !9
  %214 = icmp eq i64 %212, %213
  br i1 %214, label %215, label %320

215:                                              ; preds = %211
  %216 = load ptr, ptr %16, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.reader_slot, ptr %216, i32 0, i32 2
  %218 = call i32 @atomic_load32(ptr noundef %217, i32 noundef 1)
  store i32 %218, ptr %15, align 4, !tbaa !26
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %320

220:                                              ; preds = %215
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %221 = load ptr, ptr %16, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.reader_slot, ptr %221, i32 0, i32 1
  %223 = call i64 @safe64_read(ptr noundef %222)
  store i64 %223, ptr %18, align 8, !tbaa !9
  %224 = load i64, ptr %18, align 8, !tbaa !9
  %225 = icmp eq i64 %224, -1
  br i1 %225, label %226, label %309

226:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #9
  %227 = load ptr, ptr %16, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.reader_slot, ptr %227, i32 0, i32 1
  %229 = call zeroext i1 @atomic_cas64(ptr noundef %228, i64 noundef -1, i64 noundef -2)
  %230 = zext i1 %229 to i8
  store i8 %230, ptr %19, align 1, !tbaa !25
  %231 = load i8, ptr %19, align 1, !tbaa !25, !range !36, !noundef !37
  %232 = trunc i8 %231 to i1
  %233 = xor i1 %232, true
  %234 = xor i1 %233, true
  %235 = zext i1 %234 to i32
  %236 = sext i32 %235 to i64
  %237 = call i64 @llvm.expect.i64(i64 %236, i64 1)
  %238 = icmp ne i64 %237, 0
  br i1 %238, label %239, label %304

239:                                              ; preds = %226
  %240 = load ptr, ptr %16, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.reader_slot, ptr %240, i32 0, i32 0
  %242 = load i64, ptr %17, align 8, !tbaa !9
  %243 = call zeroext i1 @safe64_reset_compare(ptr noundef %241, i64 noundef %242)
  %244 = zext i1 %243 to i8
  store i8 %244, ptr %19, align 1, !tbaa !25
  br label %245

245:                                              ; preds = %239
  %246 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !11
  %247 = zext i8 %246 to i32
  %248 = icmp sle i32 3, %247
  %249 = xor i1 %248, true
  %250 = xor i1 %249, true
  %251 = zext i1 %250 to i32
  %252 = sext i32 %251 to i64
  %253 = call i64 @llvm.expect.i64(i64 %252, i64 0)
  %254 = icmp ne i64 %253, 0
  br i1 %254, label %255, label %263

255:                                              ; preds = %245
  %256 = load i8, ptr %19, align 1, !tbaa !25, !range !36, !noundef !37
  %257 = trunc i8 %256 to i1
  %258 = zext i1 %257 to i64
  %259 = select i1 %257, ptr @.str.18, ptr @.str.19
  %260 = load i64, ptr %17, align 8, !tbaa !9
  %261 = load i32, ptr %15, align 4, !tbaa !26
  %262 = load i64, ptr %18, align 8, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 357, ptr noundef @.str.17, ptr noundef %259, i64 noundef %260, i32 noundef %261, i64 noundef %262)
  br label %263

263:                                              ; preds = %255, %245
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264
  br label %266

266:                                              ; preds = %265
  %267 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !30
  %268 = zext i8 %267 to i32
  %269 = and i32 %268, 1
  %270 = icmp ne i32 %269, 0
  %271 = xor i1 %270, true
  %272 = xor i1 %271, true
  %273 = zext i1 %272 to i32
  %274 = sext i32 %273 to i64
  %275 = call i64 @llvm.expect.i64(i64 %274, i64 1)
  %276 = icmp ne i64 %275, 0
  br i1 %276, label %277, label %301

277:                                              ; preds = %266
  br label %278

278:                                              ; preds = %277
  %279 = load i8, ptr %19, align 1, !tbaa !25, !range !36, !noundef !37
  %280 = trunc i8 %279 to i1
  br i1 %280, label %287, label %281

281:                                              ; preds = %278
  %282 = load ptr, ptr %16, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.reader_slot, ptr %282, i32 0, i32 0
  %284 = call i64 @safe64_read(ptr noundef %283)
  %285 = load i64, ptr %4, align 8, !tbaa !9
  %286 = icmp ugt i64 %284, %285
  br label %287

287:                                              ; preds = %281, %278
  %288 = phi i1 [ true, %278 ], [ %286, %281 ]
  %289 = xor i1 %288, true
  %290 = xor i1 %289, true
  %291 = xor i1 %290, true
  %292 = zext i1 %291 to i32
  %293 = sext i32 %292 to i64
  %294 = call i64 @llvm.expect.i64(i64 %293, i64 0)
  %295 = icmp ne i64 %294, 0
  br i1 %295, label %296, label %298

296:                                              ; preds = %287
  %297 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %297, ptr noundef @.str.20, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 358) #11
  unreachable

298:                                              ; preds = %287
  br label %299

299:                                              ; preds = %298
  br label %300

300:                                              ; preds = %299
  br label %301

301:                                              ; preds = %300, %266
  br label %302

302:                                              ; preds = %301
  br label %303

303:                                              ; preds = %302
  store i32 20, ptr %11, align 4
  br label %308

304:                                              ; preds = %226
  %305 = load ptr, ptr %16, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct.reader_slot, ptr %305, i32 0, i32 0
  %307 = call i64 @safe64_read(ptr noundef %306)
  store i64 %307, ptr %17, align 8, !tbaa !9
  store i32 21, ptr %11, align 4
  br label %308

308:                                              ; preds = %304, %303
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #9
  br label %317

309:                                              ; preds = %220
  %310 = load ptr, ptr %10, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.shared_lck, ptr %310, i32 0, i32 23
  %312 = load i64, ptr %14, align 8, !tbaa !9
  %313 = getelementptr inbounds [0 x %struct.reader_slot], ptr %311, i64 0, i64 %312
  %314 = getelementptr inbounds %struct.reader_slot, ptr %313, i32 0, i32 4
  %315 = call i64 @atomic_load64(ptr noundef %314, i32 noundef 0)
  store i64 %315, ptr %13, align 8, !tbaa !9
  %316 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %316, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %11, align 4
  br label %317

317:                                              ; preds = %309, %308
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  %318 = load i32, ptr %11, align 4
  switch i32 %318, label %321 [
    i32 0, label %319
    i32 21, label %211
  ]

319:                                              ; preds = %317
  br label %320

320:                                              ; preds = %319, %215, %211
  store i32 0, ptr %11, align 4
  br label %321

321:                                              ; preds = %320, %317
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  %322 = load i32, ptr %11, align 4
  switch i32 %322, label %487 [
    i32 0, label %323
    i32 20, label %324
  ]

323:                                              ; preds = %321
  br label %324

324:                                              ; preds = %323, %321
  %325 = load i64, ptr %14, align 8, !tbaa !9
  %326 = add i64 %325, 1
  store i64 %326, ptr %14, align 8, !tbaa !9
  br label %195, !llvm.loop !38

327:                                              ; preds = %202
  %328 = load ptr, ptr %5, align 8, !tbaa !5
  %329 = icmp ne ptr %328, null
  br i1 %329, label %330, label %333

330:                                              ; preds = %327
  %331 = load ptr, ptr %12, align 8, !tbaa !5
  %332 = icmp ne ptr %331, null
  br i1 %332, label %334, label %333

333:                                              ; preds = %330, %327
  store i32 4, ptr %11, align 4
  br label %430

334:                                              ; preds = %330
  %335 = load ptr, ptr %12, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.reader_slot, ptr %335, i32 0, i32 2
  %337 = call i32 @atomic_load32(ptr noundef %336, i32 noundef 1)
  store i32 %337, ptr %20, align 4, !tbaa !26
  %338 = load ptr, ptr %12, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.reader_slot, ptr %338, i32 0, i32 1
  %340 = call i64 @safe64_read(ptr noundef %339)
  store i64 %340, ptr %21, align 8, !tbaa !9
  %341 = load ptr, ptr %12, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.reader_slot, ptr %341, i32 0, i32 0
  %343 = call i64 @safe64_read(ptr noundef %342)
  %344 = load i64, ptr %4, align 8, !tbaa !9
  %345 = icmp ne i64 %343, %344
  br i1 %345, label %349, label %346

346:                                              ; preds = %334
  %347 = load i32, ptr %20, align 4, !tbaa !26
  %348 = icmp ne i32 %347, 0
  br i1 %348, label %350, label %349

349:                                              ; preds = %346, %334
  store i32 5, ptr %11, align 4
  br label %430

350:                                              ; preds = %346
  %351 = load ptr, ptr %3, align 8, !tbaa !5
  %352 = load ptr, ptr %3, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.MDBX_env, ptr %352, i32 0, i32 39
  %354 = load ptr, ptr %353, align 8, !tbaa !27
  %355 = getelementptr inbounds %struct.MDBX_txn, ptr %354, i32 0, i32 17
  %356 = getelementptr inbounds %struct.anon.15, ptr %355, i32 0, i32 0
  call void @meta_recent(ptr dead_on_unwind writable sret(%struct.meta_ptr) align 8 %22, ptr noundef %351, ptr noundef %356)
  %357 = getelementptr inbounds %struct.meta_ptr, ptr %22, i32 0, i32 0
  %358 = load i64, ptr %357, align 8, !tbaa !40
  %359 = load i64, ptr %4, align 8, !tbaa !9
  %360 = sub i64 %358, %359
  %361 = udiv i64 %360, 1
  store i64 %361, ptr %23, align 8, !tbaa !9
  %362 = getelementptr inbounds %struct.meta_ptr, ptr %22, i32 0, i32 1
  %363 = load ptr, ptr %362, align 8, !tbaa !28
  %364 = getelementptr inbounds %struct.meta, ptr %363, i32 0, i32 10
  %365 = getelementptr inbounds [2 x i32], ptr %364, i64 0, i64 0
  %366 = call i64 @unaligned_peek_u64(i64 noundef 4, ptr noundef %365) #13
  store i64 %366, ptr %24, align 8, !tbaa !9
  %367 = load i64, ptr %24, align 8, !tbaa !9
  %368 = load i64, ptr %13, align 8, !tbaa !9
  %369 = icmp ugt i64 %367, %368
  br i1 %369, label %370, label %378

370:                                              ; preds = %350
  %371 = load ptr, ptr %3, align 8, !tbaa !5
  %372 = load i64, ptr %24, align 8, !tbaa !9
  %373 = load i64, ptr %13, align 8, !tbaa !9
  %374 = sub i64 %372, %373
  %375 = trunc i64 %374 to i32
  %376 = zext i32 %375 to i64
  %377 = call i64 @pgno2bytes(ptr noundef %371, i64 noundef %376) #13
  br label %379

378:                                              ; preds = %350
  br label %379

379:                                              ; preds = %378, %370
  %380 = phi i64 [ %377, %370 ], [ 0, %378 ]
  store i64 %380, ptr %25, align 8, !tbaa !9
  %381 = load ptr, ptr %5, align 8, !tbaa !5
  %382 = load ptr, ptr %3, align 8, !tbaa !5
  %383 = load ptr, ptr %3, align 8, !tbaa !5
  %384 = getelementptr inbounds %struct.MDBX_env, ptr %383, i32 0, i32 39
  %385 = load ptr, ptr %384, align 8, !tbaa !27
  %386 = load i32, ptr %20, align 4, !tbaa !26
  %387 = load i64, ptr %21, align 8, !tbaa !9
  %388 = load i64, ptr %4, align 8, !tbaa !9
  %389 = load i64, ptr %23, align 8, !tbaa !9
  %390 = icmp ult i64 %389, 4294967295
  br i1 %390, label %391, label %394

391:                                              ; preds = %379
  %392 = load i64, ptr %23, align 8, !tbaa !9
  %393 = trunc i64 %392 to i32
  br label %395

394:                                              ; preds = %379
  br label %395

395:                                              ; preds = %394, %391
  %396 = phi i32 [ %393, %391 ], [ -1, %394 ]
  %397 = load i64, ptr %25, align 8, !tbaa !9
  %398 = load i32, ptr %8, align 4, !tbaa !26
  %399 = call i32 %381(ptr noundef %382, ptr noundef %385, i32 noundef %386, i64 noundef %387, i64 noundef %388, i32 noundef %396, i64 noundef %397, i32 noundef %398)
  store i32 %399, ptr %26, align 4, !tbaa !26
  %400 = load i32, ptr %26, align 4, !tbaa !26
  %401 = icmp slt i32 %400, 0
  br i1 %401, label %402, label %403

402:                                              ; preds = %395
  store i32 4, ptr %11, align 4
  br label %430

403:                                              ; preds = %395
  %404 = load i32, ptr %26, align 4, !tbaa !26
  %405 = icmp sgt i32 %404, 0
  br i1 %405, label %406, label %424

406:                                              ; preds = %403
  %407 = load i32, ptr %26, align 4, !tbaa !26
  %408 = icmp eq i32 %407, 1
  br i1 %408, label %409, label %414

409:                                              ; preds = %406
  %410 = load ptr, ptr %12, align 8, !tbaa !5
  %411 = getelementptr inbounds %struct.reader_slot, ptr %410, i32 0, i32 0
  %412 = load i64, ptr %4, align 8, !tbaa !9
  %413 = call zeroext i1 @safe64_reset_compare(ptr noundef %411, i64 noundef %412)
  br label %423

414:                                              ; preds = %406
  %415 = load ptr, ptr %12, align 8, !tbaa !5
  %416 = getelementptr inbounds %struct.reader_slot, ptr %415, i32 0, i32 0
  call void @safe64_reset(ptr noundef %416, i1 noundef zeroext true)
  %417 = load ptr, ptr %12, align 8, !tbaa !5
  %418 = getelementptr inbounds %struct.reader_slot, ptr %417, i32 0, i32 1
  %419 = call i64 @atomic_store64(ptr noundef %418, i64 noundef 0, i32 noundef 0)
  %420 = load ptr, ptr %12, align 8, !tbaa !5
  %421 = getelementptr inbounds %struct.reader_slot, ptr %420, i32 0, i32 2
  %422 = call i32 @atomic_store32(ptr noundef %421, i32 noundef 0, i32 noundef 1)
  br label %423

423:                                              ; preds = %414, %409
  br label %429

424:                                              ; preds = %403
  %425 = load i8, ptr %7, align 1, !tbaa !25, !range !36, !noundef !37
  %426 = trunc i8 %425 to i1
  br i1 %426, label %428, label %427

427:                                              ; preds = %424
  store i8 1, ptr %7, align 1, !tbaa !25
  br label %428

428:                                              ; preds = %427, %424
  br label %429

429:                                              ; preds = %428, %423
  store i32 0, ptr %11, align 4
  br label %430

430:                                              ; preds = %429, %402, %349, %333
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  br label %431

431:                                              ; preds = %430, %193, %184
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  %432 = load i32, ptr %11, align 4
  switch i32 %432, label %487 [
    i32 0, label %433
    i32 4, label %438
    i32 5, label %434
  ]

433:                                              ; preds = %431
  br label %434

434:                                              ; preds = %433, %431
  %435 = load i32, ptr %8, align 4, !tbaa !26
  %436 = add nsw i32 %435, 1
  store i32 %436, ptr %8, align 4, !tbaa !26
  %437 = icmp slt i32 %436, 2147483647
  br i1 %437, label %45, label %438, !llvm.loop !42

438:                                              ; preds = %434, %431
  %439 = load i8, ptr %7, align 1, !tbaa !25, !range !36, !noundef !37
  %440 = trunc i8 %439 to i1
  br i1 %440, label %441, label %483

441:                                              ; preds = %438
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #9
  %442 = load i64, ptr %6, align 8, !tbaa !9
  %443 = load i64, ptr %4, align 8, !tbaa !9
  %444 = sub i64 %442, %443
  store i64 %444, ptr %27, align 8, !tbaa !9
  %445 = load i64, ptr %27, align 8, !tbaa !9
  %446 = icmp ne i64 %445, 0
  br i1 %446, label %447, label %465

447:                                              ; preds = %441
  br label %448

448:                                              ; preds = %447
  %449 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !11
  %450 = zext i8 %449 to i32
  %451 = icmp sle i32 3, %450
  %452 = xor i1 %451, true
  %453 = xor i1 %452, true
  %454 = zext i1 %453 to i32
  %455 = sext i32 %454 to i64
  %456 = call i64 @llvm.expect.i64(i64 %455, i64 0)
  %457 = icmp ne i64 %456, 0
  br i1 %457, label %458, label %462

458:                                              ; preds = %448
  %459 = load i64, ptr %4, align 8, !tbaa !9
  %460 = load i64, ptr %6, align 8, !tbaa !9
  %461 = load i64, ptr %27, align 8, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef @__func__.mvcc_kick_laggards, i32 noundef 410, ptr noundef @.str.21, i64 noundef %459, i64 noundef %460, i64 noundef %461)
  br label %462

462:                                              ; preds = %458, %448
  br label %463

463:                                              ; preds = %462
  br label %464

464:                                              ; preds = %463
  br label %465

465:                                              ; preds = %464, %441
  %466 = load ptr, ptr %5, align 8, !tbaa !5
  %467 = load ptr, ptr %3, align 8, !tbaa !5
  %468 = load ptr, ptr %3, align 8, !tbaa !5
  %469 = getelementptr inbounds %struct.MDBX_env, ptr %468, i32 0, i32 39
  %470 = load ptr, ptr %469, align 8, !tbaa !27
  %471 = load i64, ptr %4, align 8, !tbaa !9
  %472 = load i64, ptr %27, align 8, !tbaa !9
  %473 = icmp ult i64 %472, 4294967295
  br i1 %473, label %474, label %477

474:                                              ; preds = %465
  %475 = load i64, ptr %27, align 8, !tbaa !9
  %476 = trunc i64 %475 to i32
  br label %478

477:                                              ; preds = %465
  br label %478

478:                                              ; preds = %477, %474
  %479 = phi i32 [ %476, %474 ], [ -1, %477 ]
  %480 = load i32, ptr %8, align 4, !tbaa !26
  %481 = sub nsw i32 0, %480
  %482 = call i32 %466(ptr noundef %467, ptr noundef %470, i32 noundef 0, i64 noundef 0, i64 noundef %471, i32 noundef %479, i64 noundef 0, i32 noundef %481)
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  br label %483

483:                                              ; preds = %478, %438
  %484 = load i64, ptr %6, align 8, !tbaa !9
  %485 = load i64, ptr %4, align 8, !tbaa !9
  %486 = icmp ugt i64 %484, %485
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  ret i1 %486

487:                                              ; preds = %431, %321
  unreachable
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @atomic_cas64(ptr noundef, i64 noundef, i64 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) #7

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @unaligned_peek_u64(i64 noundef, ptr noalias noundef) #8

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @pgno2bytes(ptr noundef, i64 noundef) #8

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { alwaysinline 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 #4 = { cold nounwind optsize 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 = { hot 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 #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 = { 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 #8 = { inlinehint nounwind willreturn memory(read) 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 #9 = { nounwind }
attributes #10 = { hot }
attributes #11 = { noreturn }
attributes #12 = { cold }
attributes #13 = { nounwind willreturn memory(read) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !7, i64 26}
!12 = !{!"libmdbx_globals", !7, i64 0, !13, i64 16, !13, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !14, i64 27, !13, i64 28, !7, i64 32, !7, i64 40, !10, i64 80, !6, i64 88}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !6, i64 248}
!16 = !{!"MDBX_env", !7, i64 0, !13, i64 4, !13, i64 8, !17, i64 16, !13, i64 56, !13, i64 60, !17, i64 64, !6, i64 104, !18, i64 112, !18, i64 114, !18, i64 116, !18, i64 118, !18, i64 120, !18, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !18, i64 130, !13, i64 132, !13, i64 136, !13, i64 140, !13, i64 144, !19, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !13, i64 224, !13, i64 228, !13, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !20, i64 264, !22, i64 320, !14, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !23, i64 392, !7, i64 400, !13, i64 440, !13, i64 444, !6, i64 448, !24, i64 456, !7, i64 496, !7, i64 536}
!17 = !{!"osal_mmap", !7, i64 0, !13, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !10, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !13, i64 28, !13, i64 32, !14, i64 36, !14, i64 37, !14, i64 38, !21, i64 40, !7, i64 48}
!21 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !18, i64 6}
!22 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!23 = !{!"", !10, i64 0}
!24 = !{!"osal_ioring", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!25 = !{!14, !14, i64 0}
!26 = !{!13, !13, i64 0}
!27 = !{!16, !6, i64 384}
!28 = !{!7, !7, i64 0}
!29 = !{!16, !6, i64 104}
!30 = !{!12, !7, i64 25}
!31 = !{!16, !6, i64 192}
!32 = !{!33, !10, i64 64}
!33 = !{!"MDBX_txn", !13, i64 0, !13, i64 4, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !34, i64 40, !10, i64 64, !10, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !35, i64 128, !6, i64 160, !7, i64 168}
!34 = !{!"geo", !18, i64 0, !18, i64 2, !13, i64 4, !13, i64 8, !7, i64 12, !7, i64 16}
!35 = !{!"MDBX_canary", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!36 = !{i8 0, i8 2}
!37 = !{}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!41, !10, i64 0}
!41 = !{!"meta_ptr", !10, i64 0, !7, i64 8, !10, i64 16}
!42 = distinct !{!42, !39}


; 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.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.meta_ptr = type { i64, %union.anon.19, i64 }
%union.anon.19 = type { ptr }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }
%union.mdbx_atomic_uint32_t = type { i32 }
%union.mdbx_atomic_uint64_t = type { i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@__func__.mvcc_kick_laggards = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @atomic_load32(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: cold nounwind optsize uwtable
declare dso_local i32 @mvcc_cleanup_dead(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @atomic_store32(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @safe64_reset(ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: hot nounwind uwtable
declare dso_local i64 @mvcc_shapshot_oldest(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_load64(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @safe64_read(ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @safe64_reset_compare(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @debug_log(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_store64(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: cold nounwind optsize uwtable
define dso_local zeroext i1 @mvcc_kick_laggards(ptr noundef %0, i64 noundef %1) local_unnamed_addr #2 {
  %3 = alloca %struct.meta_ptr, align 8
  %4 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !5
  %5 = icmp ugt i8 %4, 4
  br i1 %5, label %6, label %7, !prof !13

6:                                                ; preds = %2
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 304, ptr noundef nonnull @.str.13, i64 noundef %1) #8
  br label %7

7:                                                ; preds = %2, %6
  fence acquire
  %8 = getelementptr inbounds i8, ptr %0, i64 248
  %9 = load ptr, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 384
  %11 = getelementptr inbounds i8, ptr %0, i64 104
  %12 = getelementptr inbounds i8, ptr %0, i64 192
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  %14 = icmp ne ptr %9, null
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  br label %16

16:                                               ; preds = %126, %7
  %.0108 = phi i32 [ 0, %7 ], [ %127, %126 ]
  %.0 = phi i8 [ 0, %7 ], [ %.3, %126 ]
  %17 = load ptr, ptr %10, align 8, !tbaa !24
  %18 = getelementptr inbounds i8, ptr %17, i64 176
  %19 = getelementptr inbounds i8, ptr %17, i64 170
  %20 = load i8, ptr %19, align 2, !tbaa !25
  %21 = zext i8 %20 to i64
  %22 = getelementptr inbounds [3 x i64], ptr %18, i64 0, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !25
  %24 = load ptr, ptr %11, align 8, !tbaa !26
  %25 = getelementptr inbounds i8, ptr %24, i64 492
  store volatile i32 1, ptr %25, align 4, !tbaa !25
  %26 = call i64 @mvcc_shapshot_oldest(ptr noundef %0, i64 noundef %23) #9
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !27
  %28 = and i8 %27, 1
  %.not = icmp eq i8 %28, 0
  br i1 %.not, label %.thread157, label %29, !prof !13

29:                                               ; preds = %16
  %30 = load ptr, ptr %12, align 8, !tbaa !28
  %31 = getelementptr inbounds i8, ptr %30, i64 64
  %32 = load i64, ptr %31, align 8, !tbaa !29
  %.not139 = icmp ult i64 %26, %32
  br i1 %.not139, label %34, label %33, !prof !33

33:                                               ; preds = %29
  call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.14, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 314) #10
  unreachable

34:                                               ; preds = %29
  %.not141 = icmp ult i64 %26, %1
  br i1 %.not141, label %35, label %36, !prof !34

35:                                               ; preds = %34
  call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.15, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 315) #10
  unreachable

36:                                               ; preds = %34
  %37 = load ptr, ptr %11, align 8, !tbaa !26
  %38 = getelementptr inbounds i8, ptr %37, i64 360
  %39 = load volatile i64, ptr %38, align 8, !tbaa !25
  %.not143 = icmp ult i64 %26, %39
  br i1 %.not143, label %40, label %.thread157, !prof !13

40:                                               ; preds = %36
  call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.16, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 316) #10
  unreachable

.thread157:                                       ; preds = %16, %36
  %41 = load ptr, ptr %13, align 8, !tbaa !25
  %42 = icmp eq i64 %26, %23
  br i1 %42, label %.thread163, label %43

43:                                               ; preds = %.thread157
  %44 = icmp ule i64 %26, %1
  %45 = icmp ne ptr %41, null
  %or.cond = select i1 %44, i1 %45, i1 false
  br i1 %or.cond, label %46, label %.thread163

46:                                               ; preds = %43
  %47 = call i32 @mvcc_cleanup_dead(ptr noundef nonnull %0, i32 noundef 0, ptr noundef null) #11
  %.not144 = icmp eq i32 %47, -1
  br i1 %.not144, label %50, label %48

48:                                               ; preds = %46
  %49 = call i32 @mvcc_cleanup_dead(ptr noundef nonnull %0, i32 noundef 0, ptr noundef null) #11
  %.not145 = icmp eq i32 %49, 0
  br i1 %.not145, label %50, label %.thread163

50:                                               ; preds = %48, %46
  %51 = getelementptr inbounds i8, ptr %41, i64 488
  %52 = load volatile i32, ptr %51, align 8, !tbaa !25
  %.not190 = icmp eq i32 %52, 0
  br i1 %.not190, label %.thread163, label %.lr.ph188

.lr.ph188:                                        ; preds = %50
  %53 = getelementptr inbounds i8, ptr %41, i64 512
  br label %55

._crit_edge:                                      ; preds = %.critedge.thread
  %54 = icmp ne ptr %.4, null
  %or.cond3 = select i1 %14, i1 %54, i1 false
  br i1 %or.cond3, label %90, label %.thread163

55:                                               ; preds = %.lr.ph188, %.critedge.thread
  %.0114187 = phi ptr [ null, %.lr.ph188 ], [ %.4, %.critedge.thread ]
  %.0118186 = phi i64 [ 0, %.lr.ph188 ], [ %.4122, %.critedge.thread ]
  %.0123185 = phi i64 [ 0, %.lr.ph188 ], [ %86, %.critedge.thread ]
  %56 = getelementptr inbounds [0 x %struct.reader_slot], ptr %53, i64 0, i64 %.0123185
  %57 = call i64 @safe64_read(ptr noundef nonnull %56)
  %58 = icmp eq i64 %57, %1
  br i1 %58, label %.lr.ph, label %.critedge.thread

.lr.ph:                                           ; preds = %55
  %59 = getelementptr inbounds i8, ptr %56, i64 16
  %60 = getelementptr inbounds i8, ptr %56, i64 8
  br label %61

61:                                               ; preds = %.lr.ph, %.critedge
  %62 = call i32 @atomic_load32(ptr noundef nonnull %59, i32 noundef 1)
  %.not147 = icmp eq i32 %62, 0
  br i1 %.not147, label %.critedge.thread, label %63

63:                                               ; preds = %61
  %64 = call i64 @safe64_read(ptr noundef nonnull %60)
  %65 = icmp eq i64 %64, -1
  br i1 %65, label %66, label %81

66:                                               ; preds = %63
  %67 = call zeroext i1 @atomic_cas64(ptr noundef nonnull %60, i64 noundef -1, i64 noundef -2)
  br i1 %67, label %68, label %.critedge, !prof !33

68:                                               ; preds = %66
  %69 = call zeroext i1 @safe64_reset_compare(ptr noundef nonnull %56, i64 noundef %1)
  %70 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !5
  %71 = icmp ugt i8 %70, 2
  br i1 %71, label %72, label %74, !prof !13

72:                                               ; preds = %68
  %73 = select i1 %69, ptr @.str.18, ptr @.str.19
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 357, ptr noundef nonnull @.str.17, ptr noundef nonnull %73, i64 noundef %1, i32 noundef %62, i64 noundef -1) #8
  br label %74

74:                                               ; preds = %68, %72
  %75 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !27
  %76 = and i8 %75, 1
  %.not148 = icmp eq i8 %76, 0
  %brmerge = select i1 %.not148, i1 true, i1 %69
  br i1 %brmerge, label %.critedge.thread, label %77, !prof !35

77:                                               ; preds = %74
  %78 = call i64 @safe64_read(ptr noundef nonnull %56)
  %79 = icmp ugt i64 %78, %1
  br i1 %79, label %.critedge.thread, label %80, !prof !33

80:                                               ; preds = %77
  call void @mdbx_assert_fail(ptr noundef %0, ptr noundef nonnull @.str.20, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 358) #10
  unreachable

81:                                               ; preds = %63
  %82 = getelementptr inbounds i8, ptr %56, i64 24
  %83 = call i64 @atomic_load64(ptr noundef nonnull %82, i32 noundef 0)
  br label %.critedge.thread

.critedge:                                        ; preds = %66
  %84 = call i64 @safe64_read(ptr noundef nonnull %56)
  %85 = icmp eq i64 %84, %1
  br i1 %85, label %61, label %.critedge.thread

.critedge.thread:                                 ; preds = %61, %.critedge, %55, %74, %77, %81
  %.4122 = phi i64 [ %.0118186, %77 ], [ %.0118186, %74 ], [ %83, %81 ], [ %.0118186, %55 ], [ %.0118186, %.critedge ], [ %.0118186, %61 ]
  %.4 = phi ptr [ %.0114187, %77 ], [ %.0114187, %74 ], [ %56, %81 ], [ %.0114187, %55 ], [ %.0114187, %.critedge ], [ %.0114187, %61 ]
  %86 = add nuw nsw i64 %.0123185, 1
  %87 = load volatile i32, ptr %51, align 8, !tbaa !25
  %88 = zext i32 %87 to i64
  %89 = icmp ult i64 %86, %88
  br i1 %89, label %55, label %._crit_edge, !llvm.loop !36

90:                                               ; preds = %._crit_edge
  %91 = getelementptr inbounds i8, ptr %.4, i64 16
  %92 = call i32 @atomic_load32(ptr noundef nonnull %91, i32 noundef 1)
  %93 = getelementptr inbounds i8, ptr %.4, i64 8
  %94 = call i64 @safe64_read(ptr noundef nonnull %93)
  %95 = call i64 @safe64_read(ptr noundef nonnull %.4)
  %96 = icmp eq i64 %95, %1
  %97 = icmp ne i32 %92, 0
  %or.cond5 = select i1 %96, i1 %97, i1 false
  br i1 %or.cond5, label %98, label %126

98:                                               ; preds = %90
  %99 = load ptr, ptr %10, align 8, !tbaa !24
  %100 = getelementptr inbounds i8, ptr %99, i64 168
  call void @meta_recent(ptr dead_on_unwind nonnull writable sret(%struct.meta_ptr) align 8 %3, ptr noundef %0, ptr noundef nonnull %100)
  %101 = load i64, ptr %3, align 8, !tbaa !38
  %102 = sub i64 %101, %1
  %103 = load ptr, ptr %15, align 8, !tbaa !25
  %104 = getelementptr inbounds i8, ptr %103, i64 184
  %105 = call i64 @unaligned_peek_u64(i64 noundef 4, ptr noundef nonnull %104) #12
  %106 = icmp ugt i64 %105, %.4122
  br i1 %106, label %107, label %111

107:                                              ; preds = %98
  %108 = sub i64 %105, %.4122
  %109 = and i64 %108, 4294967295
  %110 = call i64 @pgno2bytes(ptr noundef nonnull %0, i64 noundef %109) #12
  br label %111

111:                                              ; preds = %98, %107
  %112 = phi i64 [ %110, %107 ], [ 0, %98 ]
  %113 = load ptr, ptr %10, align 8, !tbaa !24
  %114 = call i64 @llvm.umin.i64(i64 %102, i64 4294967295)
  %115 = trunc nuw i64 %114 to i32
  %116 = call i32 %9(ptr noundef nonnull %0, ptr noundef %113, i32 noundef %92, i64 noundef %94, i64 noundef %1, i32 noundef %115, i64 noundef %112, i32 noundef %.0108) #8
  %117 = icmp slt i32 %116, 0
  br i1 %117, label %.thread163, label %118

118:                                              ; preds = %111
  switch i32 %116, label %121 [
    i32 0, label %124
    i32 1, label %119
  ]

119:                                              ; preds = %118
  %120 = call zeroext i1 @safe64_reset_compare(ptr noundef nonnull %.4, i64 noundef %1)
  br label %126

121:                                              ; preds = %118
  call void @safe64_reset(ptr noundef nonnull %.4, i1 noundef zeroext true)
  %122 = call i64 @atomic_store64(ptr noundef nonnull %93, i64 noundef 0, i32 noundef 0)
  %123 = call i32 @atomic_store32(ptr noundef nonnull %91, i32 noundef 0, i32 noundef 1)
  br label %126

124:                                              ; preds = %118
  %125 = trunc nuw i8 %.0 to i1
  %spec.store.select = select i1 %125, i8 %.0, i8 1
  br label %126

126:                                              ; preds = %124, %121, %119, %90
  %.3 = phi i8 [ %.0, %90 ], [ %.0, %119 ], [ %.0, %121 ], [ %spec.store.select, %124 ]
  %127 = add nuw nsw i32 %.0108, 1
  %.not149 = icmp eq i32 %127, 2147483647
  br i1 %.not149, label %.thread163, label %16, !llvm.loop !40

.thread163:                                       ; preds = %50, %111, %._crit_edge, %48, %.thread157, %43, %126
  %.lcssa197 = phi i64 [ %26, %111 ], [ %26, %._crit_edge ], [ %26, %48 ], [ %23, %.thread157 ], [ %26, %43 ], [ %26, %126 ], [ %26, %50 ]
  %.3168 = phi i8 [ %.0, %111 ], [ %.0, %._crit_edge ], [ %.0, %48 ], [ %.0, %.thread157 ], [ %.0, %43 ], [ %.3, %126 ], [ %.0, %50 ]
  %.1109 = phi i32 [ %.0108, %111 ], [ %.0108, %._crit_edge ], [ %.0108, %48 ], [ %.0108, %.thread157 ], [ %.0108, %43 ], [ 2147483647, %126 ], [ %.0108, %50 ]
  %128 = trunc nuw i8 %.3168 to i1
  br i1 %128, label %129, label %140

129:                                              ; preds = %.thread163
  %130 = sub i64 %.lcssa197, %1
  %.not150 = icmp ne i64 %.lcssa197, %1
  %131 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2
  %132 = icmp ugt i8 %131, 2
  %or.cond153 = select i1 %.not150, i1 %132, i1 false
  br i1 %or.cond153, label %133, label %134, !prof !41

133:                                              ; preds = %129
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef nonnull @__func__.mvcc_kick_laggards, i32 noundef 410, ptr noundef nonnull @.str.21, i64 noundef %1, i64 noundef %.lcssa197, i64 noundef %130) #8
  br label %134

134:                                              ; preds = %133, %129
  %135 = load ptr, ptr %10, align 8, !tbaa !24
  %136 = call i64 @llvm.umin.i64(i64 %130, i64 4294967295)
  %137 = trunc nuw i64 %136 to i32
  %138 = sub nsw i32 0, %.1109
  %139 = call i32 %9(ptr noundef %0, ptr noundef %135, i32 noundef 0, i64 noundef 0, i64 noundef %1, i32 noundef %137, i64 noundef 0, i32 noundef %138) #8
  br label %140

140:                                              ; preds = %134, %.thread163
  %141 = icmp ugt i64 %.lcssa197, %1
  ret i1 %141
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @atomic_cas64(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @unaligned_peek_u64(i64 noundef, ptr noalias noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @pgno2bytes(ptr noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #7

attributes #0 = { 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 #1 = { alwaysinline 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 = { cold nounwind optsize 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 = { hot 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 #4 = { "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 = { 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 #6 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { hot }
attributes #10 = { noreturn nounwind }
attributes #11 = { cold }
attributes #12 = { nounwind willreturn memory(read) }

!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, !7, i64 26}
!6 = !{!"libmdbx_globals", !7, i64 0, !9, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !9, i64 28, !7, i64 32, !7, i64 40, !11, i64 80, !12, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!14 = !{!15, !12, i64 248}
!15 = !{!"MDBX_env", !7, i64 0, !9, i64 4, !9, i64 8, !16, i64 16, !9, i64 56, !9, i64 60, !16, i64 64, !12, i64 104, !17, i64 112, !17, i64 114, !17, i64 116, !17, i64 118, !17, i64 120, !17, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !17, i64 130, !9, i64 132, !9, i64 136, !9, i64 140, !9, i64 144, !18, i64 152, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !9, i64 224, !9, i64 228, !9, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !19, i64 264, !21, i64 320, !10, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !22, i64 392, !7, i64 400, !9, i64 440, !9, i64 444, !12, i64 448, !23, i64 456, !7, i64 496, !7, i64 536}
!16 = !{!"osal_mmap", !7, i64 0, !9, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!17 = !{!"short", !7, i64 0}
!18 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!19 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !11, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !9, i64 28, !9, i64 32, !10, i64 36, !10, i64 37, !10, i64 38, !20, i64 40, !7, i64 48}
!20 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6}
!21 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!22 = !{!"", !11, i64 0}
!23 = !{!"osal_ioring", !9, i64 0, !9, i64 4, !9, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!24 = !{!15, !12, i64 384}
!25 = !{!7, !7, i64 0}
!26 = !{!15, !12, i64 104}
!27 = !{!6, !7, i64 25}
!28 = !{!15, !12, i64 192}
!29 = !{!30, !11, i64 64}
!30 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !31, i64 40, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !32, i64 128, !12, i64 160, !7, i64 168}
!31 = !{!"geo", !17, i64 0, !17, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!32 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!33 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!34 = !{!"branch_weights", i32 1073205, i32 2146410443}
!35 = !{!"branch_weights", i32 2002, i32 2000}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!39, !11, i64 0}
!39 = !{!"meta_ptr", !11, i64 0, !7, i64 8, !11, i64 16}
!40 = distinct !{!40, !37}
!41 = !{!"branch_weights", i32 1, i32 4001}


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