; 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.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 }
%union.mdbx_atomic_uint32_t = type { i32 }
%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 }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }
%struct.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.18, %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.16 }
%struct.anon.16 = 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.17 }
%struct.anon.17 = type { i64, i64, i32 }
%struct.anon.18 = type { [4 x i32], [4 x i64] }

@globals = external global %struct.libmdbx_globals, align 8
@.str.10 = external hidden unnamed_addr constant [41 x i8], align 1
@__func__.txn_ro_end = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1

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

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

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

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

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

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

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

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

21:                                               ; preds = %10
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MDBX_txn, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !20
  %26 = and i32 %25, 256
  %27 = icmp eq i32 %26, 0
  %28 = xor i1 %27, true
  %29 = xor i1 %28, true
  %30 = xor i1 %29, true
  %31 = zext i1 %30 to i32
  %32 = sext i32 %31 to i64
  %33 = call i64 @llvm.expect.i64(i64 %32, i64 0)
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %22
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.MDBX_txn, ptr %36, i32 0, i32 9
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  call void @mdbx_assert_fail(ptr noundef %38, ptr noundef @.str.10, ptr noundef @__func__.txn_ro_end, i32 noundef 163) #8
  unreachable

39:                                               ; preds = %22
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41, %10
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.MDBX_txn, ptr %45, i32 0, i32 2
  store i64 0, ptr %46, align 8, !tbaa !21
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MDBX_txn, ptr %47, i32 0, i32 17
  %49 = getelementptr inbounds %struct.anon, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %346

52:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.MDBX_txn, ptr %53, i32 0, i32 17
  %55 = getelementptr inbounds %struct.anon, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !22
  store ptr %56, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MDBX_env, ptr %57, i32 0, i32 7
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = icmp ne ptr %59, null
  %61 = xor i1 %60, true
  %62 = xor i1 %61, true
  %63 = xor i1 %62, true
  %64 = zext i1 %63 to i32
  %65 = sext i32 %64 to i64
  %66 = call i64 @llvm.expect.i64(i64 %65, i64 0)
  %67 = icmp ne i64 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %52
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.MDBX_txn, ptr %69, i32 0, i32 17
  %71 = getelementptr inbounds %struct.anon, ptr %70, i32 0, i32 0
  store ptr null, ptr %71, align 8, !tbaa !22
  br label %345

72:                                               ; preds = %52
  br label %73

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

84:                                               ; preds = %73
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.reader_slot, ptr %86, i32 0, i32 2
  %88 = load volatile i32, ptr %87, align 8, !tbaa !22
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.MDBX_env, ptr %89, i32 0, i32 20
  %91 = load i32, ptr %90, align 4, !tbaa !32
  %92 = icmp eq i32 %88, %91
  %93 = xor i1 %92, true
  %94 = xor i1 %93, true
  %95 = xor i1 %94, true
  %96 = zext i1 %95 to i32
  %97 = sext i32 %96 to i64
  %98 = call i64 @llvm.expect.i64(i64 %97, i64 0)
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %102

100:                                              ; preds = %85
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %101, ptr noundef @.str.11, ptr noundef @__func__.txn_ro_end, i32 noundef 170) #8
  unreachable

102:                                              ; preds = %85
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104, %73
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.MDBX_txn, ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 4, !tbaa !20
  %111 = and i32 %110, 1
  %112 = icmp eq i32 %111, 0
  %113 = xor i1 %112, true
  %114 = xor i1 %113, true
  %115 = zext i1 %114 to i32
  %116 = sext i32 %115 to i64
  %117 = call i64 @llvm.expect.i64(i64 %116, i64 1)
  %118 = icmp ne i64 %117, 0
  br i1 %118, label %119, label %258

119:                                              ; preds = %107
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MDBX_txn, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !20
  %123 = and i32 %122, 32
  %124 = icmp eq i32 %123, 0
  %125 = xor i1 %124, true
  %126 = xor i1 %125, true
  %127 = zext i1 %126 to i32
  %128 = sext i32 %127 to i64
  %129 = call i64 @llvm.expect.i64(i64 %128, i64 1)
  %130 = icmp ne i64 %129, 0
  br i1 %130, label %131, label %201

131:                                              ; preds = %119
  br label %132

132:                                              ; preds = %131
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MDBX_txn, ptr %133, i32 0, i32 7
  %135 = load i64, ptr %134, align 8, !tbaa !33
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.MDBX_env, ptr %136, i32 0, i32 7
  %138 = load ptr, ptr %137, align 8, !tbaa !23
  %139 = getelementptr inbounds %struct.shared_lck, ptr %138, i32 0, i32 12
  %140 = load volatile i64, ptr %139, align 8, !tbaa !22
  %141 = icmp uge i64 %135, %140
  %142 = xor i1 %141, true
  %143 = xor i1 %142, true
  %144 = xor i1 %143, true
  %145 = zext i1 %144 to i32
  %146 = sext i32 %145 to i64
  %147 = call i64 @llvm.expect.i64(i64 %146, i64 0)
  %148 = icmp ne i64 %147, 0
  br i1 %148, label %149, label %151

149:                                              ; preds = %132
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %150, ptr noundef @.str.12, ptr noundef @__func__.txn_ro_end, i32 noundef 174) #8
  unreachable

151:                                              ; preds = %132
  br label %152

152:                                              ; preds = %151
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  %155 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %156 = zext i8 %155 to i32
  %157 = and i32 %156, 1
  %158 = icmp ne i32 %157, 0
  %159 = xor i1 %158, true
  %160 = xor i1 %159, true
  %161 = zext i1 %160 to i32
  %162 = sext i32 %161 to i64
  %163 = call i64 @llvm.expect.i64(i64 %162, i64 1)
  %164 = icmp ne i64 %163, 0
  br i1 %164, label %165, label %198

165:                                              ; preds = %154
  br label %166

166:                                              ; preds = %165
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.MDBX_txn, ptr %167, i32 0, i32 7
  %169 = load i64, ptr %168, align 8, !tbaa !33
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.reader_slot, ptr %170, i32 0, i32 0
  %172 = load volatile i64, ptr %171, align 8, !tbaa !22
  %173 = icmp eq i64 %169, %172
  br i1 %173, label %174, label %184

174:                                              ; preds = %166
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.reader_slot, ptr %175, i32 0, i32 0
  %177 = load volatile i64, ptr %176, align 8, !tbaa !22
  %178 = load ptr, ptr %5, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.MDBX_env, ptr %178, i32 0, i32 7
  %180 = load ptr, ptr %179, align 8, !tbaa !23
  %181 = getelementptr inbounds %struct.shared_lck, ptr %180, i32 0, i32 12
  %182 = load volatile i64, ptr %181, align 8, !tbaa !22
  %183 = icmp uge i64 %177, %182
  br label %184

184:                                              ; preds = %174, %166
  %185 = phi i1 [ false, %166 ], [ %183, %174 ]
  %186 = xor i1 %185, true
  %187 = xor i1 %186, true
  %188 = xor i1 %187, true
  %189 = zext i1 %188 to i32
  %190 = sext i32 %189 to i64
  %191 = call i64 @llvm.expect.i64(i64 %190, i64 0)
  %192 = icmp ne i64 %191, 0
  br i1 %192, label %193, label %195

193:                                              ; preds = %184
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %194, ptr noundef @.str.13, ptr noundef @__func__.txn_ro_end, i32 noundef 175) #8
  unreachable

195:                                              ; preds = %184
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197, %154
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  br label %246

201:                                              ; preds = %119
  %202 = load i32, ptr %4, align 4, !tbaa !9
  %203 = and i32 %202, 7
  %204 = icmp ne i32 %203, 6
  br i1 %204, label %205, label %214

205:                                              ; preds = %201
  %206 = load ptr, ptr %6, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.reader_slot, ptr %206, i32 0, i32 1
  %208 = call i64 @safe64_read(ptr noundef %207)
  %209 = icmp eq i64 %208, -2
  br i1 %209, label %210, label %214

210:                                              ; preds = %205
  %211 = load i32, ptr %4, align 4, !tbaa !9
  %212 = and i32 %211, -8
  %213 = or i32 %212, 6
  store i32 %213, ptr %4, align 4, !tbaa !9
  br label %214

214:                                              ; preds = %210, %205, %201
  br label %215

215:                                              ; preds = %237, %214
  %216 = load ptr, ptr %6, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.reader_slot, ptr %216, i32 0, i32 0
  call void @safe64_reset(ptr noundef %217, i1 noundef zeroext false)
  %218 = load ptr, ptr %6, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.reader_slot, ptr %218, i32 0, i32 1
  %220 = load ptr, ptr %3, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.MDBX_txn, ptr %220, i32 0, i32 3
  %222 = load i64, ptr %221, align 8, !tbaa !34
  %223 = call i64 @atomic_store64(ptr noundef %219, i64 noundef %222, i32 noundef 1)
  call void @atomic_yield()
  br label %224

224:                                              ; preds = %215
  %225 = load ptr, ptr %6, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.reader_slot, ptr %225, i32 0, i32 0
  %227 = call i64 @safe64_read(ptr noundef %226)
  %228 = icmp ult i64 %227, -4294967296
  br i1 %228, label %237, label %229

229:                                              ; preds = %224
  %230 = load ptr, ptr %6, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.reader_slot, ptr %230, i32 0, i32 1
  %232 = call i64 @safe64_read(ptr noundef %231)
  %233 = load ptr, ptr %3, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.MDBX_txn, ptr %233, i32 0, i32 3
  %235 = load i64, ptr %234, align 8, !tbaa !34
  %236 = icmp ne i64 %232, %235
  br label %237

237:                                              ; preds = %229, %224
  %238 = phi i1 [ true, %224 ], [ %236, %229 ]
  %239 = xor i1 %238, true
  %240 = xor i1 %239, true
  %241 = zext i1 %240 to i32
  %242 = sext i32 %241 to i64
  %243 = call i64 @llvm.expect.i64(i64 %242, i64 0)
  %244 = icmp ne i64 %243, 0
  br i1 %244, label %215, label %245, !llvm.loop !35

245:                                              ; preds = %237
  br label %246

246:                                              ; preds = %245, %200
  %247 = load ptr, ptr %5, align 8, !tbaa !5
  call void @dxb_sanitize_tail(ptr noundef %247, ptr noundef null)
  %248 = load ptr, ptr %6, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.reader_slot, ptr %248, i32 0, i32 3
  %250 = call i32 @atomic_store32(ptr noundef %249, i32 noundef 0, i32 noundef 0)
  %251 = load ptr, ptr %6, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.reader_slot, ptr %251, i32 0, i32 0
  call void @safe64_reset(ptr noundef %252, i1 noundef zeroext true)
  %253 = load ptr, ptr %5, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.MDBX_env, ptr %253, i32 0, i32 7
  %255 = load ptr, ptr %254, align 8, !tbaa !23
  %256 = getelementptr inbounds %struct.shared_lck, ptr %255, i32 0, i32 21
  %257 = call i32 @atomic_store32(ptr noundef %256, i32 noundef 1, i32 noundef 0)
  br label %326

258:                                              ; preds = %107
  br label %259

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

270:                                              ; preds = %259
  br label %271

271:                                              ; preds = %270
  %272 = load ptr, ptr %6, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.reader_slot, ptr %272, i32 0, i32 2
  %274 = load volatile i32, ptr %273, align 8, !tbaa !22
  %275 = load ptr, ptr %5, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.MDBX_env, ptr %275, i32 0, i32 20
  %277 = load i32, ptr %276, align 4, !tbaa !32
  %278 = icmp eq i32 %274, %277
  %279 = xor i1 %278, true
  %280 = xor i1 %279, true
  %281 = xor i1 %280, true
  %282 = zext i1 %281 to i32
  %283 = sext i32 %282 to i64
  %284 = call i64 @llvm.expect.i64(i64 %283, i64 0)
  %285 = icmp ne i64 %284, 0
  br i1 %285, label %286, label %288

286:                                              ; preds = %271
  %287 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %287, ptr noundef @.str.11, ptr noundef @__func__.txn_ro_end, i32 noundef 191) #8
  unreachable

288:                                              ; preds = %271
  br label %289

289:                                              ; preds = %288
  br label %290

290:                                              ; preds = %289
  br label %291

291:                                              ; preds = %290, %259
  br label %292

292:                                              ; preds = %291
  br label %293

293:                                              ; preds = %292
  br label %294

294:                                              ; preds = %293
  %295 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !17
  %296 = zext i8 %295 to i32
  %297 = and i32 %296, 1
  %298 = icmp ne i32 %297, 0
  %299 = xor i1 %298, true
  %300 = xor i1 %299, true
  %301 = zext i1 %300 to i32
  %302 = sext i32 %301 to i64
  %303 = call i64 @llvm.expect.i64(i64 %302, i64 1)
  %304 = icmp ne i64 %303, 0
  br i1 %304, label %305, label %323

305:                                              ; preds = %294
  br label %306

306:                                              ; preds = %305
  %307 = load ptr, ptr %6, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.reader_slot, ptr %307, i32 0, i32 0
  %309 = load volatile i64, ptr %308, align 8, !tbaa !22
  %310 = icmp uge i64 %309, -4294967296
  %311 = xor i1 %310, true
  %312 = xor i1 %311, true
  %313 = xor i1 %312, true
  %314 = zext i1 %313 to i32
  %315 = sext i32 %314 to i64
  %316 = call i64 @llvm.expect.i64(i64 %315, i64 0)
  %317 = icmp ne i64 %316, 0
  br i1 %317, label %318, label %320

318:                                              ; preds = %306
  %319 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %319, ptr noundef @.str.14, ptr noundef @__func__.txn_ro_end, i32 noundef 192) #8
  unreachable

320:                                              ; preds = %306
  br label %321

321:                                              ; preds = %320
  br label %322

322:                                              ; preds = %321
  br label %323

323:                                              ; preds = %322, %294
  br label %324

324:                                              ; preds = %323
  br label %325

325:                                              ; preds = %324
  br label %326

326:                                              ; preds = %325, %246
  %327 = load i32, ptr %4, align 4, !tbaa !9
  %328 = and i32 %327, 64
  %329 = icmp ne i32 %328, 0
  br i1 %329, label %330, label %344

330:                                              ; preds = %326
  %331 = load ptr, ptr %5, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.MDBX_env, ptr %331, i32 0, i32 1
  %333 = load i32, ptr %332, align 4, !tbaa !37
  %334 = and i32 %333, 268435456
  %335 = icmp eq i32 %334, 0
  br i1 %335, label %336, label %340

336:                                              ; preds = %330
  %337 = load ptr, ptr %6, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct.reader_slot, ptr %337, i32 0, i32 2
  %339 = call i32 @atomic_store32(ptr noundef %338, i32 noundef 0, i32 noundef 0)
  br label %340

340:                                              ; preds = %336, %330
  %341 = load ptr, ptr %3, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.MDBX_txn, ptr %341, i32 0, i32 17
  %343 = getelementptr inbounds %struct.anon, ptr %342, i32 0, i32 0
  store ptr null, ptr %343, align 8, !tbaa !22
  br label %344

344:                                              ; preds = %340, %326
  br label %345

345:                                              ; preds = %344, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %346

346:                                              ; preds = %345, %44
  %347 = load i32, ptr %4, align 4, !tbaa !9
  %348 = and i32 %347, 7
  %349 = icmp ne i32 %348, 6
  %350 = zext i1 %349 to i64
  %351 = select i1 %349, i32 131073, i32 131201
  %352 = load ptr, ptr %3, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.MDBX_txn, ptr %352, i32 0, i32 1
  store i32 %351, ptr %353, align 4, !tbaa !20
  %354 = load ptr, ptr %3, align 8, !tbaa !5
  %355 = getelementptr inbounds %struct.MDBX_txn, ptr %354, i32 0, i32 3
  store i64 0, ptr %355, align 8, !tbaa !34
  %356 = load i32, ptr %4, align 4, !tbaa !9
  %357 = and i32 %356, 32
  %358 = icmp ne i32 %357, 0
  br i1 %358, label %359, label %363

359:                                              ; preds = %346
  %360 = load ptr, ptr %3, align 8, !tbaa !5
  %361 = getelementptr inbounds %struct.MDBX_txn, ptr %360, i32 0, i32 0
  store i32 0, ptr %361, align 8, !tbaa !38
  %362 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %362) #7
  br label %363

363:                                              ; preds = %359, %346
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret i32 0
}

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @atomic_yield() #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @dxb_sanitize_tail(ptr noundef, ptr noundef) #5

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { 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 #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 = { 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 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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!12, !13, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !6, i64 104}
!24 = !{!"MDBX_env", !7, i64 0, !10, i64 4, !10, i64 8, !25, i64 16, !10, i64 56, !10, i64 60, !25, 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, !26, 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, !27, i64 264, !29, i64 320, !19, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !30, i64 392, !7, i64 400, !10, i64 440, !10, i64 444, !6, i64 448, !31, i64 456, !7, i64 496, !7, i64 536}
!25 = !{!"osal_mmap", !7, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!26 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!27 = !{!"", !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, !28, i64 40, !7, i64 48}
!28 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6}
!29 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!30 = !{!"", !13, i64 0}
!31 = !{!"osal_ioring", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!32 = !{!24, !10, i64 140}
!33 = !{!12, !13, i64 64}
!34 = !{!12, !13, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!24, !10, i64 4}
!38 = !{!12, !10, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%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.10 = external hidden unnamed_addr constant [41 x i8], align 1
@__func__.txn_ro_end = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 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_store32(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @txn_ro_end(ptr nocapture noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %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 eq i8 %6, 0
  br i1 %.not, label %12, label %7, !prof !18

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !19
  %10 = and i32 %9, 256
  %.not49 = icmp eq i32 %10, 0
  br i1 %.not49, label %12, label %11, !prof !20

11:                                               ; preds = %7
  tail call void @mdbx_assert_fail(ptr noundef %4, ptr noundef nonnull @.str.10, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 163) #5
  unreachable

12:                                               ; preds = %7, %2
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 0, ptr %13, align 8, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %0, i64 168
  %15 = load ptr, ptr %14, align 8, !tbaa !22
  %.not50 = icmp eq ptr %15, null
  br i1 %.not50, label %94, label %16

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %4, i64 104
  %18 = load ptr, ptr %17, align 8, !tbaa !23
  %.not51 = icmp eq ptr %18, null
  br i1 %.not51, label %.sink.split, label %19, !prof !18

19:                                               ; preds = %16
  br i1 %.not, label %26, label %20, !prof !18

20:                                               ; preds = %19
  %21 = getelementptr inbounds i8, ptr %15, i64 16
  %22 = load volatile i32, ptr %21, align 8, !tbaa !22
  %23 = getelementptr inbounds i8, ptr %4, i64 140
  %24 = load i32, ptr %23, align 4, !tbaa !32
  %.not53 = icmp eq i32 %22, %24
  br i1 %.not53, label %.thread, label %25, !prof !20

25:                                               ; preds = %20
  tail call void @mdbx_assert_fail(ptr noundef nonnull %4, ptr noundef nonnull @.str.11, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 170) #5
  unreachable

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %0, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !19
  %29 = and i32 %28, 1
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %35, label %84, !prof !20

.thread:                                          ; preds = %20
  %31 = getelementptr inbounds i8, ptr %0, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !19
  %33 = and i32 %32, 1
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %77, !prof !20

35:                                               ; preds = %.thread, %26
  %36 = phi i32 [ %32, %.thread ], [ %28, %26 ]
  %37 = and i32 %36, 32
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %53, !prof !20

39:                                               ; preds = %35
  %40 = getelementptr inbounds i8, ptr %0, i64 64
  %41 = load i64, ptr %40, align 8, !tbaa !33
  %42 = getelementptr inbounds i8, ptr %18, i64 360
  %43 = load volatile i64, ptr %42, align 8, !tbaa !22
  %.not58 = icmp ult i64 %41, %43
  br i1 %.not58, label %44, label %45, !prof !18

44:                                               ; preds = %39
  tail call void @mdbx_assert_fail(ptr noundef nonnull %4, ptr noundef nonnull @.str.12, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 174) #5
  unreachable

45:                                               ; preds = %39
  br i1 %.not, label %.loopexit, label %46, !prof !18

46:                                               ; preds = %45
  %47 = load volatile i64, ptr %15, align 8, !tbaa !22
  %48 = icmp eq i64 %41, %47
  br i1 %48, label %49, label %.critedge, !prof !20

49:                                               ; preds = %46
  %50 = load volatile i64, ptr %15, align 8, !tbaa !22
  %51 = load volatile i64, ptr %42, align 8, !tbaa !22
  %52 = icmp ult i64 %50, %51
  br i1 %52, label %.critedge, label %.loopexit, !prof !18

.critedge:                                        ; preds = %46, %49
  tail call void @mdbx_assert_fail(ptr noundef nonnull %4, ptr noundef nonnull @.str.13, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 175) #5
  unreachable

53:                                               ; preds = %35
  %54 = and i32 %1, 7
  %.not57 = icmp eq i32 %54, 6
  br i1 %.not57, label %62, label %55

55:                                               ; preds = %53
  %56 = getelementptr inbounds i8, ptr %15, i64 8
  %57 = tail call i64 @safe64_read(ptr noundef nonnull %56)
  %58 = icmp eq i64 %57, -2
  br i1 %58, label %59, label %62

59:                                               ; preds = %55
  %60 = and i32 %1, -8
  %61 = or disjoint i32 %60, 6
  br label %62

62:                                               ; preds = %59, %55, %53
  %.0 = phi i32 [ %61, %59 ], [ %1, %55 ], [ %1, %53 ]
  %63 = getelementptr inbounds i8, ptr %15, i64 8
  %64 = getelementptr inbounds i8, ptr %0, i64 16
  br label %.critedge64

.critedge64:                                      ; preds = %.critedge64.backedge, %62
  tail call void @safe64_reset(ptr noundef nonnull %15, i1 noundef zeroext false)
  %65 = load i64, ptr %64, align 8, !tbaa !34
  %66 = tail call i64 @atomic_store64(ptr noundef nonnull %63, i64 noundef %65, i32 noundef 1)
  tail call void @atomic_yield()
  %67 = tail call i64 @safe64_read(ptr noundef nonnull %15)
  %68 = icmp ult i64 %67, -4294967296
  br i1 %68, label %.critedge64.backedge, label %69, !prof !18

69:                                               ; preds = %.critedge64
  %70 = tail call i64 @safe64_read(ptr noundef nonnull %63)
  %71 = load i64, ptr %64, align 8, !tbaa !34
  %.not67 = icmp eq i64 %70, %71
  br i1 %.not67, label %.loopexit, label %.critedge64.backedge, !prof !20

.critedge64.backedge:                             ; preds = %69, %.critedge64
  br label %.critedge64, !llvm.loop !35

.loopexit:                                        ; preds = %69, %45, %49
  %.1 = phi i32 [ %1, %49 ], [ %1, %45 ], [ %.0, %69 ]
  tail call void @dxb_sanitize_tail(ptr noundef %4, ptr noundef null)
  %72 = getelementptr inbounds i8, ptr %15, i64 20
  %73 = tail call i32 @atomic_store32(ptr noundef nonnull %72, i32 noundef 0, i32 noundef 0)
  tail call void @safe64_reset(ptr noundef nonnull %15, i1 noundef zeroext true)
  %74 = load ptr, ptr %17, align 8, !tbaa !23
  %75 = getelementptr inbounds i8, ptr %74, i64 492
  %76 = tail call i32 @atomic_store32(ptr noundef nonnull %75, i32 noundef 1, i32 noundef 0)
  br label %84

77:                                               ; preds = %.thread
  %78 = load volatile i32, ptr %21, align 8, !tbaa !22
  %.not55 = icmp eq i32 %78, %22
  br i1 %.not55, label %80, label %79, !prof !20

79:                                               ; preds = %77
  tail call void @mdbx_assert_fail(ptr noundef nonnull %4, ptr noundef nonnull @.str.11, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 191) #5
  unreachable

80:                                               ; preds = %77
  %81 = load volatile i64, ptr %15, align 8, !tbaa !22
  %82 = icmp ult i64 %81, -4294967296
  br i1 %82, label %83, label %84, !prof !18

83:                                               ; preds = %80
  tail call void @mdbx_assert_fail(ptr noundef nonnull %4, ptr noundef nonnull @.str.14, ptr noundef nonnull @__func__.txn_ro_end, i32 noundef 192) #5
  unreachable

84:                                               ; preds = %26, %80, %.loopexit
  %.2 = phi i32 [ %.1, %.loopexit ], [ %1, %80 ], [ %1, %26 ]
  %85 = and i32 %.2, 64
  %.not60 = icmp eq i32 %85, 0
  br i1 %.not60, label %94, label %86

86:                                               ; preds = %84
  %87 = getelementptr inbounds i8, ptr %4, i64 4
  %88 = load i32, ptr %87, align 4, !tbaa !37
  %89 = and i32 %88, 268435456
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %.sink.split

91:                                               ; preds = %86
  %92 = getelementptr inbounds i8, ptr %15, i64 16
  %93 = tail call i32 @atomic_store32(ptr noundef nonnull %92, i32 noundef 0, i32 noundef 0)
  br label %.sink.split

.sink.split:                                      ; preds = %86, %91, %16
  %.4.ph = phi i32 [ %1, %16 ], [ %.2, %91 ], [ %.2, %86 ]
  store ptr null, ptr %14, align 8, !tbaa !22
  br label %94

94:                                               ; preds = %.sink.split, %84, %12
  %.4 = phi i32 [ %1, %12 ], [ %.2, %84 ], [ %.4.ph, %.sink.split ]
  %95 = and i32 %.4, 7
  %.not61 = icmp eq i32 %95, 6
  %96 = select i1 %.not61, i32 131201, i32 131073
  %97 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %96, ptr %97, align 4, !tbaa !19
  %98 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %98, align 8, !tbaa !34
  %99 = and i32 %.4, 32
  %.not62 = icmp eq i32 %99, 0
  br i1 %.not62, label %101, label %100

100:                                              ; preds = %94
  tail call void @free(ptr noundef nonnull %0) #6
  br label %101

101:                                              ; preds = %100, %94
  ret i32 0
}

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @atomic_yield() local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @dxb_sanitize_tail(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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 = { 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 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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", !"expected", i32 1, i32 2000}
!19 = !{!6, !7, i64 4}
!20 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!21 = !{!6, !10, i64 8}
!22 = !{!8, !8, i64 0}
!23 = !{!24, !11, i64 104}
!24 = !{!"MDBX_env", !8, i64 0, !7, i64 4, !7, i64 8, !25, i64 16, !7, i64 56, !7, i64 60, !25, 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, !26, 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, !27, i64 264, !29, i64 320, !17, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !30, i64 392, !8, i64 400, !7, i64 440, !7, i64 444, !11, i64 448, !31, i64 456, !8, i64 496, !8, i64 536}
!25 = !{!"osal_mmap", !8, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!26 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!27 = !{!"", !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, !28, i64 40, !8, i64 48}
!28 = !{!"", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6}
!29 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!30 = !{!"", !10, i64 0}
!31 = !{!"osal_ioring", !7, i64 0, !7, i64 4, !7, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!32 = !{!24, !7, i64 140}
!33 = !{!6, !10, i64 64}
!34 = !{!6, !10, i64 16}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!24, !7, i64 4}


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