; 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.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 }

@globals = external global %struct.libmdbx_globals, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@__func__.mvcc_shapshot_oldest = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: hot nounwind uwtable
define dso_local i64 @mvcc_shapshot_oldest(ptr noundef %0, i64 noundef %1) #4 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %15 = load i8, ptr @.str.4, align 1, !tbaa !11
  %16 = sext i8 %15 to i32
  %17 = shl i32 %16, 24
  %18 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @.str.4, i64 0, i64 1), align 1, !tbaa !11
  %19 = sext i8 %18 to i32
  %20 = shl i32 %19, 16
  %21 = or i32 %17, %20
  %22 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @.str.4, i64 0, i64 2), align 1, !tbaa !11
  %23 = sext i8 %22 to i32
  %24 = shl i32 %23, 8
  %25 = or i32 %21, %24
  %26 = load i8, ptr getelementptr inbounds ([5 x i8], ptr @.str.4, i64 0, i64 3), align 1, !tbaa !11
  %27 = sext i8 %26 to i32
  %28 = or i32 %25, %27
  store i32 %28, ptr %6, align 4, !tbaa !12
  br label %29

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

40:                                               ; preds = %29
  br label %41

41:                                               ; preds = %40
  %42 = load i64, ptr %5, align 8, !tbaa !9
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MDBX_env, ptr %43, i32 0, i32 24
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  %46 = getelementptr inbounds %struct.MDBX_txn, ptr %45, i32 0, i32 7
  %47 = load i64, ptr %46, align 8, !tbaa !27
  %48 = icmp ule i64 %42, %47
  %49 = xor i1 %48, true
  %50 = xor i1 %49, true
  %51 = xor i1 %50, true
  %52 = zext i1 %51 to i32
  %53 = sext i32 %52 to i64
  %54 = call i64 @llvm.expect.i64(i64 %53, i64 0)
  %55 = icmp ne i64 %54, 0
  br i1 %55, label %56, label %58

56:                                               ; preds = %41
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %57, ptr noundef @.str.5, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 76) #9
  unreachable

58:                                               ; preds = %41
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60, %29
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.MDBX_env, ptr %64, i32 0, i32 6
  %66 = getelementptr inbounds %struct.osal_mmap, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !11
  store ptr %67, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = icmp eq ptr %68, null
  %70 = xor i1 %69, true
  %71 = xor i1 %70, true
  %72 = zext i1 %71 to i32
  %73 = sext i32 %72 to i64
  %74 = call i64 @llvm.expect.i64(i64 %73, i64 0)
  %75 = icmp ne i64 %74, 0
  br i1 %75, label %76, label %120

76:                                               ; preds = %63
  br label %77

77:                                               ; preds = %76
  %78 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !14
  %79 = zext i8 %78 to i32
  %80 = and i32 %79, 1
  %81 = icmp ne i32 %80, 0
  %82 = xor i1 %81, true
  %83 = xor i1 %82, true
  %84 = zext i1 %83 to i32
  %85 = sext i32 %84 to i64
  %86 = call i64 @llvm.expect.i64(i64 %85, i64 1)
  %87 = icmp ne i64 %86, 0
  br i1 %87, label %88, label %108

88:                                               ; preds = %77
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.MDBX_env, ptr %90, i32 0, i32 7
  %92 = load ptr, ptr %91, align 8, !tbaa !31
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = call ptr @lckless_stub(ptr noundef %93) #10
  %95 = icmp eq ptr %92, %94
  %96 = xor i1 %95, true
  %97 = xor i1 %96, true
  %98 = xor i1 %97, true
  %99 = zext i1 %98 to i32
  %100 = sext i32 %99 to i64
  %101 = call i64 @llvm.expect.i64(i64 %100, i64 0)
  %102 = icmp ne i64 %101, 0
  br i1 %102, label %103, label %105

103:                                              ; preds = %89
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %104, ptr noundef @.str.6, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 80) #9
  unreachable

105:                                              ; preds = %89
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107, %77
  br label %109

109:                                              ; preds = %108
  br label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MDBX_env, ptr %111, i32 0, i32 7
  %113 = load ptr, ptr %112, align 8, !tbaa !31
  %114 = getelementptr inbounds %struct.shared_lck, ptr %113, i32 0, i32 21
  store volatile i32 1315925605, ptr %114, align 4, !tbaa !11
  %115 = load i64, ptr %5, align 8, !tbaa !9
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.MDBX_env, ptr %116, i32 0, i32 7
  %118 = load ptr, ptr %117, align 8, !tbaa !31
  %119 = getelementptr inbounds %struct.shared_lck, ptr %118, i32 0, i32 12
  store volatile i64 %115, ptr %119, align 8, !tbaa !11
  store i64 %115, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %316

120:                                              ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.shared_lck, ptr %121, i32 0, i32 12
  %123 = call i64 @atomic_load64(ptr noundef %122, i32 noundef 1)
  store i64 %123, ptr %9, align 8, !tbaa !9
  br label %124

124:                                              ; preds = %120
  %125 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !14
  %126 = zext i8 %125 to i32
  %127 = and i32 %126, 1
  %128 = icmp ne i32 %127, 0
  %129 = xor i1 %128, true
  %130 = xor i1 %129, true
  %131 = zext i1 %130 to i32
  %132 = sext i32 %131 to i64
  %133 = call i64 @llvm.expect.i64(i64 %132, i64 1)
  %134 = icmp ne i64 %133, 0
  br i1 %134, label %135, label %152

135:                                              ; preds = %124
  br label %136

136:                                              ; preds = %135
  %137 = load i64, ptr %5, align 8, !tbaa !9
  %138 = load i64, ptr %9, align 8, !tbaa !9
  %139 = icmp uge i64 %137, %138
  %140 = xor i1 %139, true
  %141 = xor i1 %140, true
  %142 = xor i1 %141, true
  %143 = zext i1 %142 to i32
  %144 = sext i32 %143 to i64
  %145 = call i64 @llvm.expect.i64(i64 %144, i64 0)
  %146 = icmp ne i64 %145, 0
  br i1 %146, label %147, label %149

147:                                              ; preds = %136
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %148, ptr noundef @.str.7, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 86) #9
  unreachable

149:                                              ; preds = %136
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  br label %152

152:                                              ; preds = %151, %124
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %155 = load i64, ptr %9, align 8, !tbaa !9
  store i64 %155, ptr %10, align 8, !tbaa !9
  br label %156

156:                                              ; preds = %255, %154
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.shared_lck, ptr %157, i32 0, i32 21
  %159 = call i32 @atomic_load32(ptr noundef %158, i32 noundef 1)
  %160 = icmp ne i32 1315925605, %159
  br i1 %160, label %161, label %256

161:                                              ; preds = %156
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.shared_lck, ptr %162, i32 0, i32 21
  store volatile i32 1315925605, ptr %163, align 4, !tbaa !11
  call void @jitter4testing(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.shared_lck, ptr %164, i32 0, i32 20
  %166 = call i32 @atomic_load32(ptr noundef %165, i32 noundef 1)
  %167 = zext i32 %166 to i64
  store i64 %167, ptr %11, align 8, !tbaa !9
  %168 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %168, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %169

169:                                              ; preds = %252, %161
  %170 = load i64, ptr %12, align 8, !tbaa !9
  %171 = load i64, ptr %11, align 8, !tbaa !9
  %172 = icmp ult i64 %170, %171
  br i1 %172, label %174, label %173

173:                                              ; preds = %169
  store i32 16, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %255

174:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.shared_lck, ptr %175, i32 0, i32 23
  %177 = load i64, ptr %12, align 8, !tbaa !9
  %178 = getelementptr inbounds [0 x %struct.reader_slot], ptr %176, i64 0, i64 %177
  %179 = getelementptr inbounds %struct.reader_slot, ptr %178, i32 0, i32 2
  %180 = call i32 @atomic_load32(ptr noundef %179, i32 noundef 1)
  store i32 %180, ptr %13, align 4, !tbaa !12
  %181 = load i32, ptr %13, align 4, !tbaa !12
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %184, label %183

183:                                              ; preds = %174
  store i32 18, ptr %8, align 4
  br label %249

184:                                              ; preds = %174
  call void @jitter4testing(i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.shared_lck, ptr %185, i32 0, i32 23
  %187 = load i64, ptr %12, align 8, !tbaa !9
  %188 = getelementptr inbounds [0 x %struct.reader_slot], ptr %186, i64 0, i64 %187
  %189 = getelementptr inbounds %struct.reader_slot, ptr %188, i32 0, i32 0
  %190 = call i64 @safe64_read(ptr noundef %189)
  store i64 %190, ptr %14, align 8, !tbaa !9
  %191 = load i64, ptr %14, align 8, !tbaa !9
  %192 = load i64, ptr %9, align 8, !tbaa !9
  %193 = icmp ult i64 %191, %192
  %194 = xor i1 %193, true
  %195 = xor i1 %194, true
  %196 = zext i1 %195 to i32
  %197 = sext i32 %196 to i64
  %198 = call i64 @llvm.expect.i64(i64 %197, i64 0)
  %199 = icmp ne i64 %198, 0
  br i1 %199, label %200, label %241

200:                                              ; preds = %184
  %201 = load ptr, ptr %7, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.shared_lck, ptr %201, i32 0, i32 21
  %203 = call i32 @atomic_load32(ptr noundef %202, i32 noundef 1)
  %204 = icmp eq i32 1315925605, %203
  %205 = xor i1 %204, true
  %206 = xor i1 %205, true
  %207 = zext i1 %206 to i32
  %208 = sext i32 %207 to i64
  %209 = call i64 @llvm.expect.i64(i64 %208, i64 0)
  %210 = icmp ne i64 %209, 0
  br i1 %210, label %211, label %240

211:                                              ; preds = %200
  %212 = load ptr, ptr %7, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.shared_lck, ptr %212, i32 0, i32 23
  %214 = load i64, ptr %12, align 8, !tbaa !9
  %215 = getelementptr inbounds [0 x %struct.reader_slot], ptr %213, i64 0, i64 %214
  %216 = getelementptr inbounds %struct.reader_slot, ptr %215, i32 0, i32 0
  %217 = load i64, ptr %14, align 8, !tbaa !9
  %218 = call zeroext i1 @safe64_reset_compare(ptr noundef %216, i64 noundef %217)
  br i1 %218, label %219, label %240

219:                                              ; preds = %211
  br label %220

220:                                              ; preds = %219
  %221 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !32
  %222 = zext i8 %221 to i32
  %223 = icmp sle i32 3, %222
  %224 = xor i1 %223, true
  %225 = xor i1 %224, true
  %226 = zext i1 %225 to i32
  %227 = sext i32 %226 to i64
  %228 = call i64 @llvm.expect.i64(i64 %227, i64 0)
  %229 = icmp ne i64 %228, 0
  br i1 %229, label %230, label %237

230:                                              ; preds = %220
  %231 = load i64, ptr %12, align 8, !tbaa !9
  %232 = load i64, ptr %11, align 8, !tbaa !9
  %233 = load i32, ptr %13, align 4, !tbaa !12
  %234 = load i64, ptr %14, align 8, !tbaa !9
  %235 = load i64, ptr %9, align 8, !tbaa !9
  %236 = load i64, ptr %5, align 8, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 106, ptr noundef @.str.8, i64 noundef %231, i64 noundef %232, i32 noundef %233, i64 noundef %234, i64 noundef %235, i64 noundef %236)
  br label %237

237:                                              ; preds = %230, %220
  br label %238

238:                                              ; preds = %237
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239, %211, %200
  store i32 18, ptr %8, align 4
  br label %248

241:                                              ; preds = %184
  %242 = load i64, ptr %14, align 8, !tbaa !9
  %243 = load i64, ptr %10, align 8, !tbaa !9
  %244 = icmp ult i64 %242, %243
  br i1 %244, label %245, label %247

245:                                              ; preds = %241
  %246 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %246, ptr %10, align 8, !tbaa !9
  br label %247

247:                                              ; preds = %245, %241
  store i32 0, ptr %8, align 4
  br label %248

248:                                              ; preds = %247, %240
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %249

249:                                              ; preds = %248, %183
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  %250 = load i32, ptr %8, align 4
  switch i32 %250, label %318 [
    i32 0, label %251
    i32 18, label %252
  ]

251:                                              ; preds = %249
  br label %252

252:                                              ; preds = %251, %249
  %253 = load i64, ptr %12, align 8, !tbaa !9
  %254 = add i64 %253, 1
  store i64 %254, ptr %12, align 8, !tbaa !9
  br label %169, !llvm.loop !33

255:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %156, !llvm.loop !35

256:                                              ; preds = %156
  %257 = load i64, ptr %10, align 8, !tbaa !9
  %258 = load i64, ptr %9, align 8, !tbaa !9
  %259 = icmp ne i64 %257, %258
  br i1 %259, label %260, label %314

260:                                              ; preds = %256
  br label %261

261:                                              ; preds = %260
  %262 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !32
  %263 = zext i8 %262 to i32
  %264 = icmp sle i32 4, %263
  %265 = xor i1 %264, true
  %266 = xor i1 %265, true
  %267 = zext i1 %266 to i32
  %268 = sext i32 %267 to i64
  %269 = call i64 @llvm.expect.i64(i64 %268, i64 0)
  %270 = icmp ne i64 %269, 0
  br i1 %270, label %271, label %274

271:                                              ; preds = %261
  %272 = load i64, ptr %9, align 8, !tbaa !9
  %273 = load i64, ptr %10, align 8, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 4, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 120, ptr noundef @.str.9, i64 noundef %272, i64 noundef %273)
  br label %274

274:                                              ; preds = %271, %261
  br label %275

275:                                              ; preds = %274
  br label %276

276:                                              ; preds = %275
  br label %277

277:                                              ; preds = %276
  %278 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !14
  %279 = zext i8 %278 to i32
  %280 = and i32 %279, 1
  %281 = icmp ne i32 %280, 0
  %282 = xor i1 %281, true
  %283 = xor i1 %282, true
  %284 = zext i1 %283 to i32
  %285 = sext i32 %284 to i64
  %286 = call i64 @llvm.expect.i64(i64 %285, i64 1)
  %287 = icmp ne i64 %286, 0
  br i1 %287, label %288, label %307

288:                                              ; preds = %277
  br label %289

289:                                              ; preds = %288
  %290 = load i64, ptr %10, align 8, !tbaa !9
  %291 = load ptr, ptr %7, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.shared_lck, ptr %291, i32 0, i32 12
  %293 = load volatile i64, ptr %292, align 8, !tbaa !11
  %294 = icmp uge i64 %290, %293
  %295 = xor i1 %294, true
  %296 = xor i1 %295, true
  %297 = xor i1 %296, true
  %298 = zext i1 %297 to i32
  %299 = sext i32 %298 to i64
  %300 = call i64 @llvm.expect.i64(i64 %299, i64 0)
  %301 = icmp ne i64 %300, 0
  br i1 %301, label %302, label %304

302:                                              ; preds = %289
  %303 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %303, ptr noundef @.str.10, ptr noundef @__func__.mvcc_shapshot_oldest, i32 noundef 121) #9
  unreachable

304:                                              ; preds = %289
  br label %305

305:                                              ; preds = %304
  br label %306

306:                                              ; preds = %305
  br label %307

307:                                              ; preds = %306, %277
  br label %308

308:                                              ; preds = %307
  br label %309

309:                                              ; preds = %308
  %310 = load ptr, ptr %7, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.shared_lck, ptr %310, i32 0, i32 12
  %312 = load i64, ptr %10, align 8, !tbaa !9
  %313 = call i64 @atomic_store64(ptr noundef %311, i64 noundef %312, i32 noundef 0)
  br label %314

314:                                              ; preds = %309, %256
  %315 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %315, ptr %3, align 8
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %316

316:                                              ; preds = %314, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %317 = load i64, ptr %3, align 8
  ret i64 %317

318:                                              ; preds = %249
  unreachable
}

; Function Attrs: inlinehint nounwind willreturn memory(none) uwtable
declare hidden ptr @lckless_stub(ptr noundef) #5

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @jitter4testing(i1 noundef zeroext) #6

; 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, ...) #7

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

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 = { 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 #5 = { inlinehint nounwind willreturn memory(none) 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 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 #7 = { "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 }
attributes #9 = { noreturn }
attributes #10 = { nounwind willreturn memory(none) }

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


; 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.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
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@__func__.mvcc_shapshot_oldest = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 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: hot nounwind uwtable
define dso_local i64 @mvcc_shapshot_oldest(ptr noundef %0, i64 noundef %1) local_unnamed_addr #2 {
  %3 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %4 = and i8 %3, 1
  %.not = icmp eq i8 %4, 0
  br i1 %.not, label %11, label %5, !prof !13

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %7, i64 64
  %9 = load i64, ptr %8, align 8, !tbaa !24
  %.not62 = icmp ult i64 %9, %1
  br i1 %.not62, label %10, label %.thread, !prof !13

10:                                               ; preds = %5
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.5, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 76) #7
  unreachable

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = load ptr, ptr %12, align 8, !tbaa !28
  %14 = icmp eq ptr %13, null
  br i1 %14, label %._crit_edge81, label %29, !prof !13

._crit_edge81:                                    ; preds = %11
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 104
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !29
  br label %23

.thread:                                          ; preds = %5
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  %16 = load ptr, ptr %15, align 8, !tbaa !28
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %29, !prof !13

18:                                               ; preds = %.thread
  %19 = getelementptr inbounds i8, ptr %0, i64 104
  %20 = load ptr, ptr %19, align 8, !tbaa !29
  %21 = tail call ptr @lckless_stub(ptr noundef nonnull %0) #8
  %.not71 = icmp eq ptr %20, %21
  br i1 %.not71, label %23, label %22, !prof !30

22:                                               ; preds = %18
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.6, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 80) #7
  unreachable

23:                                               ; preds = %._crit_edge81, %18
  %24 = phi ptr [ %.pre, %._crit_edge81 ], [ %20, %18 ]
  %25 = getelementptr inbounds i8, ptr %0, i64 104
  %26 = getelementptr inbounds i8, ptr %24, i64 492
  store volatile i32 1315925605, ptr %26, align 4, !tbaa !28
  %27 = load ptr, ptr %25, align 8, !tbaa !29
  %28 = getelementptr inbounds i8, ptr %27, i64 360
  store volatile i64 %1, ptr %28, align 8, !tbaa !28
  br label %._crit_edge.thread

29:                                               ; preds = %.thread, %11
  %30 = phi ptr [ %16, %.thread ], [ %13, %11 ]
  %31 = getelementptr inbounds i8, ptr %30, i64 360
  %32 = tail call i64 @atomic_load64(ptr noundef nonnull %31, i32 noundef 1)
  %33 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %34 = and i8 %33, 1
  %.not63 = icmp ne i8 %34, 0
  %.not64 = icmp ugt i64 %32, %1
  %or.cond = select i1 %.not63, i1 %.not64, i1 false
  br i1 %or.cond, label %39, label %.preheader, !prof !31

.preheader:                                       ; preds = %29
  %35 = getelementptr inbounds i8, ptr %30, i64 492
  %36 = tail call i32 @atomic_load32(ptr noundef nonnull %35, i32 noundef 1)
  %.not6577 = icmp eq i32 %36, 1315925605
  br i1 %.not6577, label %._crit_edge.thread, label %.lr.ph78

.lr.ph78:                                         ; preds = %.preheader
  %37 = getelementptr inbounds i8, ptr %30, i64 488
  %38 = getelementptr inbounds i8, ptr %30, i64 512
  br label %41

39:                                               ; preds = %29
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 86) #7
  unreachable

.loopexit:                                        ; preds = %59, %41
  %.1.lcssa = phi i64 [ %1, %41 ], [ %.4, %59 ]
  %40 = tail call i32 @atomic_load32(ptr noundef nonnull %35, i32 noundef 1)
  %.not65 = icmp eq i32 %40, 1315925605
  br i1 %.not65, label %._crit_edge, label %41, !llvm.loop !32

41:                                               ; preds = %.lr.ph78, %.loopexit
  store volatile i32 1315925605, ptr %35, align 4, !tbaa !28
  tail call void @jitter4testing(i1 noundef zeroext false)
  %42 = tail call i32 @atomic_load32(ptr noundef nonnull %37, i32 noundef 1)
  %43 = zext i32 %42 to i64
  %.not80 = icmp eq i32 %42, 0
  br i1 %.not80, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %41, %59
  %.05376 = phi i64 [ %60, %59 ], [ 0, %41 ]
  %.175 = phi i64 [ %.4, %59 ], [ %1, %41 ]
  %44 = getelementptr inbounds [0 x %struct.reader_slot], ptr %38, i64 0, i64 %.05376
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = tail call i32 @atomic_load32(ptr noundef nonnull %45, i32 noundef 1)
  %.not69 = icmp eq i32 %46, 0
  br i1 %.not69, label %59, label %47

47:                                               ; preds = %.lr.ph
  tail call void @jitter4testing(i1 noundef zeroext true)
  %48 = tail call i64 @safe64_read(ptr noundef nonnull %44)
  %49 = icmp ult i64 %48, %32
  br i1 %49, label %50, label %58, !prof !13

50:                                               ; preds = %47
  %51 = tail call i32 @atomic_load32(ptr noundef nonnull %35, i32 noundef 1)
  %52 = icmp eq i32 %51, 1315925605
  br i1 %52, label %53, label %59, !prof !13

53:                                               ; preds = %50
  %54 = tail call zeroext i1 @safe64_reset_compare(ptr noundef nonnull %44, i64 noundef %48)
  %55 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2
  %56 = icmp ugt i8 %55, 2
  %or.cond73 = select i1 %54, i1 %56, i1 false
  br i1 %or.cond73, label %57, label %59, !prof !34

57:                                               ; preds = %53
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 3, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 106, ptr noundef nonnull @.str.8, i64 noundef %.05376, i64 noundef %43, i32 noundef %46, i64 noundef %48, i64 noundef %32, i64 noundef %1) #9
  br label %59

58:                                               ; preds = %47
  %spec.select = tail call i64 @llvm.umin.i64(i64 %48, i64 %.175)
  br label %59

59:                                               ; preds = %58, %57, %53, %50, %.lr.ph
  %.4 = phi i64 [ %.175, %.lr.ph ], [ %spec.select, %58 ], [ %.175, %57 ], [ %.175, %53 ], [ %.175, %50 ]
  %60 = add nuw nsw i64 %.05376, 1
  %exitcond.not = icmp eq i64 %60, %43
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !35

._crit_edge:                                      ; preds = %.loopexit
  %.not66 = icmp eq i64 %.1.lcssa, %32
  br i1 %.not66, label %._crit_edge.thread, label %61

61:                                               ; preds = %._crit_edge
  %62 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !36
  %63 = icmp ugt i8 %62, 3
  br i1 %63, label %64, label %65, !prof !13

64:                                               ; preds = %61
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 4, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 120, ptr noundef nonnull @.str.9, i64 noundef %32, i64 noundef %.1.lcssa) #9
  br label %65

65:                                               ; preds = %61, %64
  %66 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %67 = and i8 %66, 1
  %.not67 = icmp eq i8 %67, 0
  br i1 %.not67, label %71, label %68, !prof !13

68:                                               ; preds = %65
  %69 = load volatile i64, ptr %31, align 8, !tbaa !28
  %.not68 = icmp ult i64 %.1.lcssa, %69
  br i1 %.not68, label %70, label %71, !prof !13

70:                                               ; preds = %68
  tail call void @mdbx_assert_fail(ptr noundef %0, ptr noundef nonnull @.str.10, ptr noundef nonnull @__func__.mvcc_shapshot_oldest, i32 noundef 121) #7
  unreachable

71:                                               ; preds = %68, %65
  %72 = tail call i64 @atomic_store64(ptr noundef nonnull %31, i64 noundef %.1.lcssa, i32 noundef 0)
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge, %71, %23
  %.0 = phi i64 [ %1, %23 ], [ %.1.lcssa, %71 ], [ %32, %._crit_edge ], [ %32, %.preheader ]
  ret i64 %.0
}

; Function Attrs: inlinehint mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare hidden ptr @lckless_stub(ptr 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: inlinehint nounwind uwtable
declare hidden void @jitter4testing(i1 noundef zeroext) local_unnamed_addr #4

; 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 #5

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

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

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 = { 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 #3 = { inlinehint mustprogress nofree nosync nounwind willreturn memory(none) 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 = { 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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { 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, !7, i64 25}
!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 192}
!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 = !{!25, !11, i64 64}
!25 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !26, 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, !27, i64 128, !12, i64 160, !7, i64 168}
!26 = !{!"geo", !17, i64 0, !17, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!27 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!28 = !{!7, !7, i64 0}
!29 = !{!15, !12, i64 104}
!30 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!31 = !{!"branch_weights", i32 2000, i32 4002001}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!"branch_weights", i32 1, i32 4001}
!35 = distinct !{!35, !33}
!36 = !{!6, !7, i64 26}


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