; LLVM IR from erthink/libmdbx :: src (txn-ro)

; 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.6 }
%struct.anon.6 = 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_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.1 }
%struct.geo = type { i16, i16, i32, i32, %union.anon, %union.anon.0 }
%union.anon = type { i32 }
%union.anon.0 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.1 = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.troika, ptr, %struct.anon.3, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.4 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.3 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.4 = type { %struct.anon.5 }
%struct.anon.5 = type { i64, ptr }
%struct.anon = 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 }
%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.9, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.10, %struct.anon.14, i8, ptr, ptr, ptr, %struct.anon.15, %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.8, i32, i64, i64, i64 }
%union.anon.8 = type { ptr }
%struct.anon.9 = type { ptr, ptr, ptr, ptr }
%struct.anon.10 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.11, %union.anon.12 }
%struct.anon.11 = type { i16, i16, i16, i16 }
%union.anon.12 = type { i32 }
%struct.anon.14 = type { i64, i64, i64, i64, i64 }
%struct.anon.15 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@__func__.txn_ro_start = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @txn_ro_start(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.MDBX_txn, ptr %10, i32 0, i32 9
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  store ptr %12, ptr %6, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %2
  %14 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %15 = zext i8 %14 to i32
  %16 = and i32 %15, 1
  %17 = icmp ne i32 %16, 0
  %18 = xor i1 %17, true
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i32
  %21 = sext i32 %20 to i64
  %22 = call i64 @llvm.expect.i64(i64 %21, i64 1)
  %23 = icmp ne i64 %22, 0
  br i1 %23, label %24, label %41

24:                                               ; preds = %13
  br label %25

25:                                               ; preds = %24
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = and i32 %26, 131072
  %28 = icmp ne i32 %27, 0
  %29 = xor i1 %28, true
  %30 = xor i1 %29, true
  %31 = xor i1 %30, true
  %32 = zext i1 %31 to i32
  %33 = sext i32 %32 to i64
  %34 = call i64 @llvm.expect.i64(i64 %33, i64 0)
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %25
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %37, ptr noundef @.str, ptr noundef @__func__.txn_ro_start, i32 noundef 111) #8
  unreachable

38:                                               ; preds = %25
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40, %13
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %46 = zext i8 %45 to i32
  %47 = and i32 %46, 1
  %48 = icmp ne i32 %47, 0
  %49 = xor i1 %48, true
  %50 = xor i1 %49, true
  %51 = zext i1 %50 to i32
  %52 = sext i32 %51 to i64
  %53 = call i64 @llvm.expect.i64(i64 %52, i64 1)
  %54 = icmp ne i64 %53, 0
  br i1 %54, label %55, label %72

55:                                               ; preds = %44
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %5, align 4, !tbaa !9
  %58 = and i32 %57, -19529729
  %59 = icmp eq i32 %58, 0
  %60 = xor i1 %59, true
  %61 = xor i1 %60, true
  %62 = xor i1 %61, true
  %63 = zext i1 %62 to i32
  %64 = sext i32 %63 to i64
  %65 = call i64 @llvm.expect.i64(i64 %64, i64 0)
  %66 = icmp ne i64 %65, 0
  br i1 %66, label %67, label %69

67:                                               ; preds = %56
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %68, ptr noundef @.str.1, ptr noundef @__func__.txn_ro_start, i32 noundef 112) #8
  unreachable

69:                                               ; preds = %56
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71, %44
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %5, align 4, !tbaa !9
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MDBX_txn, ptr %76, i32 0, i32 1
  store i32 %75, ptr %77, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = call i32 @txn_ro_rslot(ptr noundef %78)
  store i32 %79, ptr %7, align 4, !tbaa !9
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %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 0)
  %87 = icmp ne i64 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %74
  br label %379

89:                                               ; preds = %74
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.MDBX_txn, ptr %90, i32 0, i32 17
  %92 = getelementptr inbounds %struct.anon, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  store ptr %93, ptr %8, align 8, !tbaa !5
  %94 = load i32, ptr %5, align 4, !tbaa !9
  %95 = and i32 %94, 16777216
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %273

97:                                               ; preds = %89
  br label %98

98:                                               ; preds = %97
  %99 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %100 = zext i8 %99 to i32
  %101 = and i32 %100, 1
  %102 = icmp ne i32 %101, 0
  %103 = xor i1 %102, true
  %104 = xor i1 %103, true
  %105 = zext i1 %104 to i32
  %106 = sext i32 %105 to i64
  %107 = call i64 @llvm.expect.i64(i64 %106, i64 1)
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %109, label %127

109:                                              ; preds = %98
  br label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MDBX_txn, ptr %111, i32 0, i32 7
  %113 = load i64, ptr %112, align 8, !tbaa !22
  %114 = icmp eq i64 %113, 0
  %115 = xor i1 %114, true
  %116 = xor i1 %115, true
  %117 = xor i1 %116, true
  %118 = zext i1 %117 to i32
  %119 = sext i32 %118 to i64
  %120 = call i64 @llvm.expect.i64(i64 %119, i64 0)
  %121 = icmp ne i64 %120, 0
  br i1 %121, label %122, label %124

122:                                              ; preds = %110
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %123, ptr noundef @.str.2, ptr noundef @__func__.txn_ro_start, i32 noundef 122) #8
  unreachable

124:                                              ; preds = %110
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126, %98
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  %131 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %132 = zext i8 %131 to i32
  %133 = and i32 %132, 1
  %134 = icmp ne i32 %133, 0
  %135 = xor i1 %134, true
  %136 = xor i1 %135, true
  %137 = zext i1 %136 to i32
  %138 = sext i32 %137 to i64
  %139 = call i64 @llvm.expect.i64(i64 %138, i64 1)
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %141, label %159

141:                                              ; preds = %130
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MDBX_txn, ptr %143, i32 0, i32 3
  %145 = load i64, ptr %144, align 8, !tbaa !23
  %146 = icmp eq i64 %145, 0
  %147 = xor i1 %146, true
  %148 = xor i1 %147, true
  %149 = xor i1 %148, true
  %150 = zext i1 %149 to i32
  %151 = sext i32 %150 to i64
  %152 = call i64 @llvm.expect.i64(i64 %151, i64 0)
  %153 = icmp ne i64 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %142
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %155, ptr noundef @.str.3, ptr noundef @__func__.txn_ro_start, i32 noundef 123) #8
  unreachable

156:                                              ; preds = %142
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158, %130
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %164 = zext i8 %163 to i32
  %165 = and i32 %164, 1
  %166 = icmp ne i32 %165, 0
  %167 = xor i1 %166, true
  %168 = xor i1 %167, true
  %169 = zext i1 %168 to i32
  %170 = sext i32 %169 to i64
  %171 = call i64 @llvm.expect.i64(i64 %170, i64 1)
  %172 = icmp ne i64 %171, 0
  br i1 %172, label %173, label %191

173:                                              ; preds = %162
  br label %174

174:                                              ; preds = %173
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.MDBX_txn, ptr %175, i32 0, i32 2
  %177 = load i64, ptr %176, align 8, !tbaa !24
  %178 = icmp eq i64 %177, 0
  %179 = xor i1 %178, true
  %180 = xor i1 %179, true
  %181 = xor i1 %180, true
  %182 = zext i1 %181 to i32
  %183 = sext i32 %182 to i64
  %184 = call i64 @llvm.expect.i64(i64 %183, i64 0)
  %185 = icmp ne i64 %184, 0
  br i1 %185, label %186, label %188

186:                                              ; preds = %174
  %187 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %187, ptr noundef @.str.4, ptr noundef @__func__.txn_ro_start, i32 noundef 124) #8
  unreachable

188:                                              ; preds = %174
  br label %189

189:                                              ; preds = %188
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190, %162
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %8, align 8, !tbaa !5
  %195 = icmp ne ptr %194, null
  %196 = xor i1 %195, true
  %197 = xor i1 %196, true
  %198 = zext i1 %197 to i32
  %199 = sext i32 %198 to i64
  %200 = call i64 @llvm.expect.i64(i64 %199, i64 1)
  %201 = icmp ne i64 %200, 0
  br i1 %201, label %202, label %270

202:                                              ; preds = %193
  br label %203

203:                                              ; preds = %202
  %204 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %205 = zext i8 %204 to i32
  %206 = and i32 %205, 1
  %207 = icmp ne i32 %206, 0
  %208 = xor i1 %207, true
  %209 = xor i1 %208, true
  %210 = zext i1 %209 to i32
  %211 = sext i32 %210 to i64
  %212 = call i64 @llvm.expect.i64(i64 %211, i64 1)
  %213 = icmp ne i64 %212, 0
  br i1 %213, label %214, label %232

214:                                              ; preds = %203
  br label %215

215:                                              ; preds = %214
  %216 = load ptr, ptr %8, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.reader_slot, ptr %216, i32 0, i32 3
  %218 = load volatile i32, ptr %217, align 4, !tbaa !21
  %219 = icmp eq i32 %218, 0
  %220 = xor i1 %219, true
  %221 = xor i1 %220, true
  %222 = xor i1 %221, true
  %223 = zext i1 %222 to i32
  %224 = sext i32 %223 to i64
  %225 = call i64 @llvm.expect.i64(i64 %224, i64 0)
  %226 = icmp ne i64 %225, 0
  br i1 %226, label %227, label %229

227:                                              ; preds = %215
  %228 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %228, ptr noundef @.str.5, ptr noundef @__func__.txn_ro_start, i32 noundef 126) #8
  unreachable

229:                                              ; preds = %215
  br label %230

230:                                              ; preds = %229
  br label %231

231:                                              ; preds = %230
  br label %232

232:                                              ; preds = %231, %203
  br label %233

233:                                              ; preds = %232
  br label %234

234:                                              ; preds = %233
  br label %235

235:                                              ; preds = %234
  %236 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %237 = zext i8 %236 to i32
  %238 = and i32 %237, 1
  %239 = icmp ne i32 %238, 0
  %240 = xor i1 %239, true
  %241 = xor i1 %240, true
  %242 = zext i1 %241 to i32
  %243 = sext i32 %242 to i64
  %244 = call i64 @llvm.expect.i64(i64 %243, i64 1)
  %245 = icmp ne i64 %244, 0
  br i1 %245, label %246, label %264

246:                                              ; preds = %235
  br label %247

247:                                              ; preds = %246
  %248 = load ptr, ptr %8, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.reader_slot, ptr %248, i32 0, i32 0
  %250 = load volatile i64, ptr %249, align 8, !tbaa !21
  %251 = icmp uge i64 %250, -4294967296
  %252 = xor i1 %251, true
  %253 = xor i1 %252, true
  %254 = xor i1 %253, true
  %255 = zext i1 %254 to i32
  %256 = sext i32 %255 to i64
  %257 = call i64 @llvm.expect.i64(i64 %256, i64 0)
  %258 = icmp ne i64 %257, 0
  br i1 %258, label %259, label %261

259:                                              ; preds = %247
  %260 = load ptr, ptr %6, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %260, ptr noundef @.str.6, ptr noundef @__func__.txn_ro_start, i32 noundef 127) #8
  unreachable

261:                                              ; preds = %247
  br label %262

262:                                              ; preds = %261
  br label %263

263:                                              ; preds = %262
  br label %264

264:                                              ; preds = %263, %235
  br label %265

265:                                              ; preds = %264
  br label %266

266:                                              ; preds = %265
  %267 = load ptr, ptr %8, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.reader_slot, ptr %267, i32 0, i32 3
  %269 = call i32 @atomic_store32(ptr noundef %268, i32 noundef 0, i32 noundef 0)
  br label %270

270:                                              ; preds = %266, %193
  %271 = load ptr, ptr %4, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.MDBX_txn, ptr %271, i32 0, i32 1
  store i32 131073, ptr %272, align 4, !tbaa !20
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %433

273:                                              ; preds = %89
  %274 = load ptr, ptr %8, align 8, !tbaa !5
  %275 = icmp ne ptr %274, null
  %276 = xor i1 %275, true
  %277 = xor i1 %276, true
  %278 = zext i1 %277 to i32
  %279 = sext i32 %278 to i64
  %280 = call i64 @llvm.expect.i64(i64 %279, i64 1)
  %281 = icmp ne i64 %280, 0
  br i1 %281, label %282, label %286

282:                                              ; preds = %273
  %283 = load ptr, ptr %8, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.reader_slot, ptr %283, i32 0, i32 1
  %285 = load volatile i64, ptr %284, align 8, !tbaa !21
  br label %297

286:                                              ; preds = %273
  %287 = load ptr, ptr %6, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.MDBX_env, ptr %287, i32 0, i32 1
  %289 = load i32, ptr %288, align 4, !tbaa !25
  %290 = and i32 %289, 2097152
  %291 = icmp ne i32 %290, 0
  br i1 %291, label %292, label %293

292:                                              ; preds = %286
  br label %295

293:                                              ; preds = %286
  %294 = call i64 @osal_thread_self()
  br label %295

295:                                              ; preds = %293, %292
  %296 = phi i64 [ 0, %292 ], [ %294, %293 ]
  br label %297

297:                                              ; preds = %295, %282
  %298 = phi i64 [ %285, %282 ], [ %296, %295 ]
  %299 = load ptr, ptr %4, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.MDBX_txn, ptr %299, i32 0, i32 3
  store i64 %298, ptr %300, align 8, !tbaa !23
  %301 = load ptr, ptr %6, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.MDBX_env, ptr %301, i32 0, i32 1
  %303 = load i32, ptr %302, align 4, !tbaa !25
  %304 = and i32 %303, 2097152
  %305 = icmp eq i32 %304, 0
  br i1 %305, label %306, label %333

306:                                              ; preds = %297
  %307 = load ptr, ptr %6, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.MDBX_env, ptr %307, i32 0, i32 39
  %309 = load ptr, ptr %308, align 8, !tbaa !34
  %310 = icmp ne ptr %309, null
  br i1 %310, label %311, label %333

311:                                              ; preds = %306
  %312 = load ptr, ptr %6, align 8, !tbaa !5
  %313 = getelementptr inbounds %struct.MDBX_env, ptr %312, i32 0, i32 24
  %314 = load ptr, ptr %313, align 8, !tbaa !35
  %315 = getelementptr inbounds %struct.MDBX_txn, ptr %314, i32 0, i32 3
  %316 = load i64, ptr %315, align 8, !tbaa !23
  %317 = load ptr, ptr %4, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct.MDBX_txn, ptr %317, i32 0, i32 3
  %319 = load i64, ptr %318, align 8, !tbaa !23
  %320 = icmp eq i64 %316, %319
  %321 = xor i1 %320, true
  %322 = xor i1 %321, true
  %323 = zext i1 %322 to i32
  %324 = sext i32 %323 to i64
  %325 = call i64 @llvm.expect.i64(i64 %324, i64 0)
  %326 = icmp ne i64 %325, 0
  br i1 %326, label %327, label %333

327:                                              ; preds = %311
  %328 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %329 = zext i8 %328 to i32
  %330 = and i32 %329, 32
  %331 = icmp eq i32 %330, 0
  br i1 %331, label %332, label %333

332:                                              ; preds = %327
  store i32 -30415, ptr %7, align 4, !tbaa !9
  br label %379

333:                                              ; preds = %327, %311, %306, %297
  %334 = load ptr, ptr %4, align 8, !tbaa !5
  %335 = call i32 @txn_ro_seize(ptr noundef %334)
  store i32 %335, ptr %7, align 4, !tbaa !9
  %336 = load i32, ptr %7, align 4, !tbaa !9
  %337 = icmp ne i32 %336, 0
  %338 = xor i1 %337, true
  %339 = xor i1 %338, true
  %340 = zext i1 %339 to i32
  %341 = sext i32 %340 to i64
  %342 = call i64 @llvm.expect.i64(i64 %341, i64 0)
  %343 = icmp ne i64 %342, 0
  br i1 %343, label %344, label %345

344:                                              ; preds = %333
  br label %379

345:                                              ; preds = %333
  %346 = load ptr, ptr %4, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct.MDBX_txn, ptr %346, i32 0, i32 7
  %348 = load i64, ptr %347, align 8, !tbaa !22
  %349 = icmp ult i64 %348, 1
  br i1 %349, label %355, label %350

350:                                              ; preds = %345
  %351 = load ptr, ptr %4, align 8, !tbaa !5
  %352 = getelementptr inbounds %struct.MDBX_txn, ptr %351, i32 0, i32 7
  %353 = load i64, ptr %352, align 8, !tbaa !22
  %354 = icmp ugt i64 %353, -4294967297
  br label %355

355:                                              ; preds = %350, %345
  %356 = phi i1 [ true, %345 ], [ %354, %350 ]
  %357 = xor i1 %356, true
  %358 = xor i1 %357, true
  %359 = zext i1 %358 to i32
  %360 = sext i32 %359 to i64
  %361 = call i64 @llvm.expect.i64(i64 %360, i64 0)
  %362 = icmp ne i64 %361, 0
  br i1 %362, label %363, label %378

363:                                              ; preds = %355
  br label %364

364:                                              ; preds = %363
  %365 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !36
  %366 = zext i8 %365 to i32
  %367 = icmp sle i32 1, %366
  %368 = xor i1 %367, true
  %369 = xor i1 %368, true
  %370 = zext i1 %369 to i32
  %371 = sext i32 %370 to i64
  %372 = call i64 @llvm.expect.i64(i64 %371, i64 0)
  %373 = icmp ne i64 %372, 0
  br i1 %373, label %374, label %375

374:                                              ; preds = %364
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.txn_ro_start, i32 noundef 146, ptr noundef @.str.7, ptr noundef @.str.8)
  br label %375

375:                                              ; preds = %374, %364
  br label %376

376:                                              ; preds = %375
  br label %377

377:                                              ; preds = %376
  store i32 -30796, ptr %7, align 4, !tbaa !9
  br label %379

378:                                              ; preds = %355
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %433

379:                                              ; preds = %377, %344, %332, %88
  br label %380

380:                                              ; preds = %379
  %381 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %382 = zext i8 %381 to i32
  %383 = and i32 %382, 1
  %384 = icmp ne i32 %383, 0
  %385 = xor i1 %384, true
  %386 = xor i1 %385, true
  %387 = zext i1 %386 to i32
  %388 = sext i32 %387 to i64
  %389 = call i64 @llvm.expect.i64(i64 %388, i64 1)
  %390 = icmp ne i64 %389, 0
  br i1 %390, label %391, label %409

391:                                              ; preds = %380
  br label %392

392:                                              ; preds = %391
  %393 = load i32, ptr %7, align 4, !tbaa !9
  %394 = icmp ne i32 %393, 0
  %395 = xor i1 %394, true
  %396 = xor i1 %395, true
  %397 = xor i1 %396, true
  %398 = zext i1 %397 to i32
  %399 = sext i32 %398 to i64
  %400 = call i64 @llvm.expect.i64(i64 %399, i64 0)
  %401 = icmp ne i64 %400, 0
  br i1 %401, label %402, label %406

402:                                              ; preds = %392
  %403 = load ptr, ptr %4, align 8, !tbaa !5
  %404 = getelementptr inbounds %struct.MDBX_txn, ptr %403, i32 0, i32 9
  %405 = load ptr, ptr %404, align 8, !tbaa !11
  call void @mdbx_assert_fail(ptr noundef %405, ptr noundef @.str.9, ptr noundef @__func__.txn_ro_start, i32 noundef 154) #8
  unreachable

406:                                              ; preds = %392
  br label %407

407:                                              ; preds = %406
  br label %408

408:                                              ; preds = %407
  br label %409

409:                                              ; preds = %408, %380
  br label %410

410:                                              ; preds = %409
  br label %411

411:                                              ; preds = %410
  %412 = load ptr, ptr %4, align 8, !tbaa !5
  %413 = getelementptr inbounds %struct.MDBX_txn, ptr %412, i32 0, i32 7
  store i64 -1, ptr %413, align 8, !tbaa !22
  %414 = load ptr, ptr %4, align 8, !tbaa !5
  %415 = getelementptr inbounds %struct.MDBX_txn, ptr %414, i32 0, i32 17
  %416 = getelementptr inbounds %struct.anon, ptr %415, i32 0, i32 0
  %417 = load ptr, ptr %416, align 8, !tbaa !21
  %418 = icmp ne ptr %417, null
  %419 = xor i1 %418, true
  %420 = xor i1 %419, true
  %421 = zext i1 %420 to i32
  %422 = sext i32 %421 to i64
  %423 = call i64 @llvm.expect.i64(i64 %422, i64 1)
  %424 = icmp ne i64 %423, 0
  br i1 %424, label %425, label %431

425:                                              ; preds = %411
  %426 = load ptr, ptr %4, align 8, !tbaa !5
  %427 = getelementptr inbounds %struct.MDBX_txn, ptr %426, i32 0, i32 17
  %428 = getelementptr inbounds %struct.anon, ptr %427, i32 0, i32 0
  %429 = load ptr, ptr %428, align 8, !tbaa !21
  %430 = getelementptr inbounds %struct.reader_slot, ptr %429, i32 0, i32 0
  call void @safe64_reset(ptr noundef %430, i1 noundef zeroext true)
  br label %431

431:                                              ; preds = %425, %411
  %432 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %432, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %433

433:                                              ; preds = %431, %378, %270
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %434 = load i32, ptr %3, align 4
  ret i32 %434
}

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

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @osal_thread_self() #4

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

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { 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 #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 = { 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 #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 80}
!12 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !16, i64 128, !6, i64 160, !7, i64 168}
!13 = !{!"long", !7, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!18, !7, i64 25}
!18 = !{!"libmdbx_globals", !7, i64 0, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !19, i64 27, !10, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{!12, !10, i64 4}
!21 = !{!7, !7, i64 0}
!22 = !{!12, !13, i64 64}
!23 = !{!12, !13, i64 16}
!24 = !{!12, !13, i64 8}
!25 = !{!26, !10, i64 4}
!26 = !{!"MDBX_env", !7, i64 0, !10, i64 4, !10, i64 8, !27, i64 16, !10, i64 56, !10, i64 60, !27, i64 64, !6, i64 104, !15, i64 112, !15, i64 114, !15, i64 116, !15, i64 118, !15, i64 120, !15, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !15, i64 130, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !28, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !13, i64 256, !29, i64 264, !31, i64 320, !19, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !32, i64 392, !7, i64 400, !10, i64 440, !10, i64 444, !6, i64 448, !33, i64 456, !7, i64 496, !7, i64 536}
!27 = !{!"osal_mmap", !7, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!28 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!29 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !13, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !10, i64 28, !10, i64 32, !19, i64 36, !19, i64 37, !19, i64 38, !30, i64 40, !7, i64 48}
!30 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6}
!31 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!32 = !{!"", !13, i64 0}
!33 = !{!"osal_ioring", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!34 = !{!26, !6, i64 384}
!35 = !{!26, !6, i64 192}
!36 = !{!18, !7, i64 26}


; 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.6 }
%struct.anon.6 = 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 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@__func__.txn_ro_start = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @txn_ro_start(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %6 = and i8 %5, 1
  %.not = icmp ne i8 %6, 0
  %7 = and i32 %1, 131072
  %.not48 = icmp eq i32 %7, 0
  %or.cond = and i1 %.not48, %.not
  br i1 %or.cond, label %8, label %9, !prof !18

8:                                                ; preds = %2
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 111) #5
  unreachable

9:                                                ; preds = %2
  %.not49 = icmp eq i8 %6, 0
  %10 = and i32 %1, -19529729
  %.not50 = icmp eq i32 %10, 0
  %or.cond70 = or i1 %.not50, %.not49
  br i1 %or.cond70, label %12, label %11, !prof !19

11:                                               ; preds = %9
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 112) #5
  unreachable

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %1, ptr %13, align 4, !tbaa !20
  %14 = tail call i32 @txn_ro_rslot(ptr noundef nonnull %0)
  %.not51 = icmp eq i32 %14, 0
  br i1 %.not51, label %15, label %83, !prof !21

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 168
  %17 = load ptr, ptr %16, align 8, !tbaa !22
  %18 = and i32 %1, 16777216
  %.not52 = icmp eq i32 %18, 0
  br i1 %.not52, label %44, label %19

19:                                               ; preds = %15
  %20 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %21 = and i8 %20, 1
  %.not58 = icmp eq i8 %21, 0
  br i1 %.not58, label %.thread71, label %22, !prof !23

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = load i64, ptr %23, align 8, !tbaa !24
  %.not59 = icmp eq i64 %24, 0
  br i1 %.not59, label %26, label %25, !prof !21

25:                                               ; preds = %22
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 122) #5
  unreachable

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = load i64, ptr %27, align 8, !tbaa !25
  %.not61 = icmp eq i64 %28, 0
  br i1 %.not61, label %30, label %29, !prof !21

29:                                               ; preds = %26
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 123) #5
  unreachable

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  %32 = load i64, ptr %31, align 8, !tbaa !26
  %.not63 = icmp eq i64 %32, 0
  br i1 %.not63, label %.thread72, label %33, !prof !21

33:                                               ; preds = %30
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.4, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 124) #5
  unreachable

.thread71:                                        ; preds = %19
  %.not64 = icmp eq ptr %17, null
  br i1 %.not64, label %43, label %.thread75, !prof !23

.thread72:                                        ; preds = %30
  %.not6473 = icmp eq ptr %17, null
  br i1 %.not6473, label %43, label %.thread74, !prof !23

.thread74:                                        ; preds = %.thread72
  %34 = getelementptr inbounds i8, ptr %17, i64 20
  %35 = load volatile i32, ptr %34, align 4, !tbaa !22
  %.not66 = icmp eq i32 %35, 0
  br i1 %.not66, label %37, label %36, !prof !21

36:                                               ; preds = %.thread74
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.5, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 126) #5
  unreachable

37:                                               ; preds = %.thread74
  %38 = load volatile i64, ptr %17, align 8, !tbaa !22
  %39 = icmp ult i64 %38, -4294967296
  br i1 %39, label %40, label %.thread75, !prof !23

40:                                               ; preds = %37
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.6, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 127) #5
  unreachable

.thread75:                                        ; preds = %.thread71, %37
  %41 = getelementptr inbounds i8, ptr %17, i64 20
  %42 = tail call i32 @atomic_store32(ptr noundef nonnull %41, i32 noundef 0, i32 noundef 0)
  br label %43

43:                                               ; preds = %.thread72, %.thread75, %.thread71
  store i32 131073, ptr %13, align 4, !tbaa !20
  br label %88

44:                                               ; preds = %15
  %.not53 = icmp eq ptr %17, null
  br i1 %.not53, label %48, label %45, !prof !23

45:                                               ; preds = %44
  %46 = getelementptr inbounds i8, ptr %17, i64 8
  %47 = load volatile i64, ptr %46, align 8, !tbaa !22
  br label %54

48:                                               ; preds = %44
  %49 = getelementptr inbounds i8, ptr %4, i64 4
  %50 = load i32, ptr %49, align 4, !tbaa !27
  %51 = and i32 %50, 2097152
  %.not54 = icmp eq i32 %51, 0
  br i1 %.not54, label %52, label %54

52:                                               ; preds = %48
  %53 = tail call i64 @osal_thread_self()
  br label %54

54:                                               ; preds = %52, %48, %45
  %55 = phi i64 [ %47, %45 ], [ %53, %52 ], [ 0, %48 ]
  %56 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 %55, ptr %56, align 8, !tbaa !25
  %57 = getelementptr inbounds i8, ptr %4, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !27
  %59 = and i32 %58, 2097152
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %74

61:                                               ; preds = %54
  %62 = getelementptr inbounds i8, ptr %4, i64 384
  %63 = load ptr, ptr %62, align 8, !tbaa !36
  %.not55 = icmp eq ptr %63, null
  br i1 %.not55, label %74, label %64

64:                                               ; preds = %61
  %65 = getelementptr inbounds i8, ptr %4, i64 192
  %66 = load ptr, ptr %65, align 8, !tbaa !37
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  %68 = load i64, ptr %67, align 8, !tbaa !25
  %69 = icmp eq i64 %68, %55
  br i1 %69, label %70, label %74, !prof !23

70:                                               ; preds = %64
  %71 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %72 = and i8 %71, 32
  %73 = icmp eq i8 %72, 0
  br i1 %73, label %83, label %74

74:                                               ; preds = %70, %64, %61, %54
  %75 = tail call i32 @txn_ro_seize(ptr noundef nonnull %0)
  %.not56 = icmp eq i32 %75, 0
  br i1 %.not56, label %76, label %83, !prof !21

76:                                               ; preds = %74
  %77 = getelementptr inbounds i8, ptr %0, i64 64
  %78 = load i64, ptr %77, align 8, !tbaa !24
  %79 = add i64 %78, 4294967296
  %spec.select = icmp ult i64 %79, 4294967297
  br i1 %spec.select, label %80, label %88, !prof !23

80:                                               ; preds = %76
  %81 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !38
  %.not57 = icmp eq i8 %81, 0
  br i1 %.not57, label %83, label %82, !prof !21

82:                                               ; preds = %80
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.txn_ro_start, i32 noundef 146, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8) #6
  br label %83

83:                                               ; preds = %80, %82, %70, %12, %74
  %.042 = phi i32 [ %14, %12 ], [ %75, %74 ], [ -30415, %70 ], [ -30796, %82 ], [ -30796, %80 ]
  %84 = getelementptr inbounds i8, ptr %0, i64 64
  store i64 -1, ptr %84, align 8, !tbaa !24
  %85 = getelementptr inbounds i8, ptr %0, i64 168
  %86 = load ptr, ptr %85, align 8, !tbaa !22
  %.not69 = icmp eq ptr %86, null
  br i1 %.not69, label %88, label %87, !prof !23

87:                                               ; preds = %83
  tail call void @safe64_reset(ptr noundef nonnull %86, i1 noundef zeroext true)
  br label %88

88:                                               ; preds = %83, %87, %76, %43
  %.0 = phi i32 [ 0, %43 ], [ 0, %76 ], [ %.042, %87 ], [ %.042, %83 ]
  ret i32 %.0
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @txn_ro_rslot(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 #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @osal_thread_self() local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @txn_ro_seize(ptr noundef) local_unnamed_addr #2

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn "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 = { 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 #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 = { "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 = { noreturn nounwind }
attributes #6 = { 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, !11, i64 80}
!6 = !{!"MDBX_txn", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !11, i64 24, !11, i64 32, !12, i64 40, !10, i64 64, !10, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !14, i64 128, !11, i64 160, !8, i64 168}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"geo", !13, i64 0, !13, i64 2, !7, i64 4, !7, i64 8, !8, i64 12, !8, i64 16}
!13 = !{!"short", !8, i64 0}
!14 = !{!"MDBX_canary", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!16, !8, i64 25}
!16 = !{!"libmdbx_globals", !8, i64 0, !7, i64 16, !7, i64 20, !8, i64 24, !8, i64 25, !8, i64 26, !17, i64 27, !7, i64 28, !8, i64 32, !8, i64 40, !10, i64 80, !11, i64 88}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!"branch_weights", i32 2000, i32 4002001}
!19 = !{!"branch_weights", i32 4002001, i32 2000}
!20 = !{!6, !7, i64 4}
!21 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!22 = !{!8, !8, i64 0}
!23 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!24 = !{!6, !10, i64 64}
!25 = !{!6, !10, i64 16}
!26 = !{!6, !10, i64 8}
!27 = !{!28, !7, i64 4}
!28 = !{!"MDBX_env", !8, i64 0, !7, i64 4, !7, i64 8, !29, i64 16, !7, i64 56, !7, i64 60, !29, i64 64, !11, i64 104, !13, i64 112, !13, i64 114, !13, i64 116, !13, i64 118, !13, i64 120, !13, i64 122, !8, i64 124, !8, i64 128, !8, i64 129, !13, i64 130, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !30, i64 152, !11, i64 184, !11, i64 192, !11, i64 200, !11, i64 208, !11, i64 216, !7, i64 224, !7, i64 228, !7, i64 232, !11, i64 240, !11, i64 248, !10, i64 256, !31, i64 264, !33, i64 320, !17, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !34, i64 392, !8, i64 400, !7, i64 440, !7, i64 444, !11, i64 448, !35, i64 456, !8, i64 496, !8, i64 536}
!29 = !{!"osal_mmap", !8, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!30 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!31 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !8, i64 24, !8, i64 25, !8, i64 26, !8, i64 27, !7, i64 28, !7, i64 32, !17, i64 36, !17, i64 37, !17, i64 38, !32, i64 40, !8, i64 48}
!32 = !{!"", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6}
!33 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!34 = !{!"", !10, i64 0}
!35 = !{!"osal_ioring", !7, i64 0, !7, i64 4, !7, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!36 = !{!28, !11, i64 384}
!37 = !{!28, !11, i64 192}
!38 = !{!16, !8, i64 26}


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