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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.bind_reader_slot_result = type { i32, ptr }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.1, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.2, %struct.anon.6, i8, ptr, ptr, ptr, %struct.anon.7, %union.pthread_mutex_t, i32, i32, ptr, %struct.osal_ioring, %union.pthread_mutex_t, [71 x %union.mdbx_atomic_uint64_t] }
%struct.osal_mmap = type { %union.anon, i32, i64, i64, i64 }
%union.anon = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.1 = type { ptr, ptr, ptr, ptr }
%struct.anon.2 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.3, %union.anon.4 }
%struct.anon.3 = type { i16, i16, i16, i16 }
%union.anon.4 = type { i32 }
%struct.anon.6 = type { i64, i64, i64, i64, i64 }
%struct.anon.7 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.shared_lck = type { i64, i32, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, [2 x %union.mdbx_atomic_uint32_t], [16 x i8], %struct.pgops, [16 x i8], %union.pthread_mutex_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, i32, %struct.anon.10, %union.pthread_mutex_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, [16 x i8], [0 x %struct.reader_slot] }
%struct.pgops = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %struct.anon.8 }
%struct.anon.8 = type { %struct.gc_prof_stat, %struct.gc_prof_stat, i32, i32, i32, i32, i32 }
%struct.gc_prof_stat = type { i64, i64, i32, i32, i32, i32, %struct.anon.9 }
%struct.anon.9 = type { i64, i64, i32 }
%struct.anon.10 = type { [4 x i32], [4 x i64] }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@__func__.mvcc_bind_slot = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [318 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @mvcc_bind_slot(ptr noundef %0) #0 {
  %2 = alloca %struct.bind_reader_slot_result, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %7

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

18:                                               ; preds = %7
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.MDBX_env, ptr %20, i32 0, i32 6
  %22 = getelementptr inbounds %struct.osal_mmap, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  %24 = icmp ne ptr %23, null
  %25 = xor i1 %24, true
  %26 = xor i1 %25, true
  %27 = xor i1 %26, true
  %28 = zext i1 %27 to i32
  %29 = sext i32 %28 to i64
  %30 = call i64 @llvm.expect.i64(i64 %29, i64 0)
  %31 = icmp ne i64 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %19
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %33, ptr noundef @.str, ptr noundef @__func__.mvcc_bind_slot, i32 noundef 7) #8
  unreachable

34:                                               ; preds = %19
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35, %7
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  %39 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %40 = zext i8 %39 to i32
  %41 = and i32 %40, 1
  %42 = icmp ne i32 %41, 0
  %43 = xor i1 %42, true
  %44 = xor i1 %43, true
  %45 = zext i1 %44 to i32
  %46 = sext i32 %45 to i64
  %47 = call i64 @llvm.expect.i64(i64 %46, i64 1)
  %48 = icmp ne i64 %47, 0
  br i1 %48, label %49, label %68

49:                                               ; preds = %38
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MDBX_env, ptr %51, i32 0, i32 7
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = getelementptr inbounds %struct.shared_lck, ptr %53, i32 0, i32 0
  %55 = load i64, ptr %54, align 64, !tbaa !25
  %56 = icmp eq i64 %55, 6441728281112482054
  %57 = xor i1 %56, true
  %58 = xor i1 %57, true
  %59 = xor i1 %58, true
  %60 = zext i1 %59 to i32
  %61 = sext i32 %60 to i64
  %62 = call i64 @llvm.expect.i64(i64 %61, i64 0)
  %63 = icmp ne i64 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %50
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %65, ptr noundef @.str.1, ptr noundef @__func__.mvcc_bind_slot, i32 noundef 8) #8
  unreachable

66:                                               ; preds = %50
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67, %38
  br label %69

69:                                               ; preds = %68
  br label %70

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

81:                                               ; preds = %70
  br label %82

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

96:                                               ; preds = %82
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %97, ptr noundef @.str.2, ptr noundef @__func__.mvcc_bind_slot, i32 noundef 9) #8
  unreachable

98:                                               ; preds = %82
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99, %70
  br label %101

101:                                              ; preds = %100
  %102 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = call i32 @lck_rdt_lock(ptr noundef %103)
  store i32 %104, ptr %102, align 8, !tbaa !27
  %105 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  store ptr null, ptr %105, align 8, !tbaa !29
  %106 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %107 = load i32, ptr %106, align 8, !tbaa !27
  %108 = icmp ne i32 %107, -1
  br i1 %108, label %109, label %113

109:                                              ; preds = %101
  %110 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %111 = load i32, ptr %110, align 8, !tbaa !27
  %112 = icmp ne i32 %111, 0
  br label %113

113:                                              ; preds = %109, %101
  %114 = phi i1 [ false, %101 ], [ %112, %109 ]
  %115 = xor i1 %114, true
  %116 = xor i1 %115, true
  %117 = zext i1 %116 to i32
  %118 = sext i32 %117 to i64
  %119 = call i64 @llvm.expect.i64(i64 %118, i64 0)
  %120 = icmp ne i64 %119, 0
  br i1 %120, label %121, label %122

121:                                              ; preds = %113
  br label %353

122:                                              ; preds = %113
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MDBX_env, ptr %123, i32 0, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !30
  %126 = and i32 %125, -2147483648
  %127 = icmp ne i32 %126, 0
  %128 = xor i1 %127, true
  %129 = xor i1 %128, true
  %130 = zext i1 %129 to i32
  %131 = sext i32 %130 to i64
  %132 = call i64 @llvm.expect.i64(i64 %131, i64 0)
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %137

134:                                              ; preds = %122
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %135)
  %136 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 -30795, ptr %136, align 8, !tbaa !27
  br label %353

137:                                              ; preds = %122
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MDBX_env, ptr %138, i32 0, i32 3
  %140 = getelementptr inbounds %struct.osal_mmap, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !14
  %142 = icmp ne ptr %141, null
  %143 = xor i1 %142, true
  %144 = xor i1 %143, true
  %145 = xor i1 %144, true
  %146 = zext i1 %145 to i32
  %147 = sext i32 %146 to i64
  %148 = call i64 @llvm.expect.i64(i64 %147, i64 0)
  %149 = icmp ne i64 %148, 0
  br i1 %149, label %150, label %153

150:                                              ; preds = %137
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %151)
  %152 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 1, ptr %152, align 8, !tbaa !27
  br label %353

153:                                              ; preds = %137
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.MDBX_env, ptr %154, i32 0, i32 30
  %156 = load i32, ptr %155, align 8, !tbaa !31
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.MDBX_env, ptr %157, i32 0, i32 20
  %159 = load i32, ptr %158, align 4, !tbaa !32
  %160 = icmp ne i32 %156, %159
  %161 = xor i1 %160, true
  %162 = xor i1 %161, true
  %163 = zext i1 %162 to i32
  %164 = sext i32 %163 to i64
  %165 = call i64 @llvm.expect.i64(i64 %164, i64 0)
  %166 = icmp ne i64 %165, 0
  br i1 %166, label %167, label %188

167:                                              ; preds = %153
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = call i32 @lck_rpid_set(ptr noundef %168)
  %170 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 %169, ptr %170, align 8, !tbaa !27
  %171 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %172 = load i32, ptr %171, align 8, !tbaa !27
  %173 = icmp ne i32 %172, 0
  %174 = xor i1 %173, true
  %175 = xor i1 %174, true
  %176 = zext i1 %175 to i32
  %177 = sext i32 %176 to i64
  %178 = call i64 @llvm.expect.i64(i64 %177, i64 0)
  %179 = icmp ne i64 %178, 0
  br i1 %179, label %180, label %182

180:                                              ; preds = %167
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %181)
  br label %353

182:                                              ; preds = %167
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.MDBX_env, ptr %183, i32 0, i32 20
  %185 = load i32, ptr %184, align 4, !tbaa !32
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.MDBX_env, ptr %186, i32 0, i32 30
  store i32 %185, ptr %187, align 8, !tbaa !31
  br label %188

188:                                              ; preds = %182, %153
  %189 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 0, ptr %189, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  br label %190

190:                                              ; preds = %250, %188
  br label %191

191:                                              ; preds = %190
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.MDBX_env, ptr %192, i32 0, i32 7
  %194 = load ptr, ptr %193, align 8, !tbaa !15
  %195 = getelementptr inbounds %struct.shared_lck, ptr %194, i32 0, i32 20
  %196 = load volatile i32, ptr %195, align 8, !tbaa !14
  %197 = zext i32 %196 to i64
  store i64 %197, ptr %5, align 8, !tbaa !25
  store i64 0, ptr %4, align 8, !tbaa !25
  br label %198

198:                                              ; preds = %214, %191
  %199 = load i64, ptr %4, align 8, !tbaa !25
  %200 = load i64, ptr %5, align 8, !tbaa !25
  %201 = icmp ult i64 %199, %200
  br i1 %201, label %202, label %217

202:                                              ; preds = %198
  %203 = load ptr, ptr %3, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.MDBX_env, ptr %203, i32 0, i32 7
  %205 = load ptr, ptr %204, align 8, !tbaa !15
  %206 = getelementptr inbounds %struct.shared_lck, ptr %205, i32 0, i32 23
  %207 = load i64, ptr %4, align 8, !tbaa !25
  %208 = getelementptr inbounds [0 x %struct.reader_slot], ptr %206, i64 0, i64 %207
  %209 = getelementptr inbounds %struct.reader_slot, ptr %208, i32 0, i32 2
  %210 = call i32 @atomic_load32(ptr noundef %209, i32 noundef 1)
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %213, label %212

212:                                              ; preds = %202
  br label %217

213:                                              ; preds = %202
  br label %214

214:                                              ; preds = %213
  %215 = load i64, ptr %4, align 8, !tbaa !25
  %216 = add i64 %215, 1
  store i64 %216, ptr %4, align 8, !tbaa !25
  br label %198, !llvm.loop !33

217:                                              ; preds = %212, %198
  %218 = load i64, ptr %4, align 8, !tbaa !25
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.MDBX_env, ptr %219, i32 0, i32 18
  %221 = load i32, ptr %220, align 4, !tbaa !35
  %222 = zext i32 %221 to i64
  %223 = icmp ult i64 %218, %222
  %224 = xor i1 %223, true
  %225 = xor i1 %224, true
  %226 = zext i1 %225 to i32
  %227 = sext i32 %226 to i64
  %228 = call i64 @llvm.expect.i64(i64 %227, i64 1)
  %229 = icmp ne i64 %228, 0
  br i1 %229, label %230, label %231

230:                                              ; preds = %217
  br label %251

231:                                              ; preds = %217
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = call i32 @mvcc_cleanup_dead(ptr noundef %232, i32 noundef 1, ptr noundef null)
  %234 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 %233, ptr %234, align 8, !tbaa !27
  %235 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %236 = load i32, ptr %235, align 8, !tbaa !27
  %237 = icmp ne i32 %236, -1
  br i1 %237, label %238, label %250

238:                                              ; preds = %231
  %239 = load ptr, ptr %3, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %239)
  %240 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %241 = load i32, ptr %240, align 8, !tbaa !27
  %242 = icmp eq i32 %241, 0
  br i1 %242, label %243, label %244

243:                                              ; preds = %238
  br label %247

244:                                              ; preds = %238
  %245 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  %246 = load i32, ptr %245, align 8, !tbaa !27
  br label %247

247:                                              ; preds = %244, %243
  %248 = phi i32 [ -30790, %243 ], [ %246, %244 ]
  %249 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 0
  store i32 %248, ptr %249, align 8, !tbaa !27
  store i32 1, ptr %6, align 4
  br label %352

250:                                              ; preds = %231
  br label %190

251:                                              ; preds = %230
  %252 = load ptr, ptr %3, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.MDBX_env, ptr %252, i32 0, i32 7
  %254 = load ptr, ptr %253, align 8, !tbaa !15
  %255 = getelementptr inbounds %struct.shared_lck, ptr %254, i32 0, i32 23
  %256 = load i64, ptr %4, align 8, !tbaa !25
  %257 = getelementptr inbounds [0 x %struct.reader_slot], ptr %255, i64 0, i64 %256
  %258 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  store ptr %257, ptr %258, align 8, !tbaa !29
  %259 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  %260 = load ptr, ptr %259, align 8, !tbaa !29
  %261 = getelementptr inbounds %struct.reader_slot, ptr %260, i32 0, i32 2
  %262 = call i32 @atomic_store32(ptr noundef %261, i32 noundef 0, i32 noundef 1)
  %263 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  %264 = load ptr, ptr %263, align 8, !tbaa !29
  %265 = getelementptr inbounds %struct.reader_slot, ptr %264, i32 0, i32 0
  call void @safe64_reset(ptr noundef %265, i1 noundef zeroext true)
  %266 = load i64, ptr %4, align 8, !tbaa !25
  %267 = load i64, ptr %5, align 8, !tbaa !25
  %268 = icmp eq i64 %266, %267
  br i1 %268, label %269, label %277

269:                                              ; preds = %251
  %270 = load i64, ptr %5, align 8, !tbaa !25
  %271 = add i64 %270, 1
  store i64 %271, ptr %5, align 8, !tbaa !25
  %272 = trunc i64 %271 to i32
  %273 = load ptr, ptr %3, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.MDBX_env, ptr %273, i32 0, i32 7
  %275 = load ptr, ptr %274, align 8, !tbaa !15
  %276 = getelementptr inbounds %struct.shared_lck, ptr %275, i32 0, i32 20
  store volatile i32 %272, ptr %276, align 8, !tbaa !14
  br label %277

277:                                              ; preds = %269, %251
  %278 = load ptr, ptr %3, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.MDBX_env, ptr %278, i32 0, i32 1
  %280 = load i32, ptr %279, align 4, !tbaa !30
  %281 = and i32 %280, 2097152
  %282 = icmp ne i32 %281, 0
  br i1 %282, label %283, label %284

283:                                              ; preds = %277
  br label %286

284:                                              ; preds = %277
  %285 = call i64 @osal_thread_self()
  br label %286

286:                                              ; preds = %284, %283
  %287 = phi i64 [ 0, %283 ], [ %285, %284 ]
  %288 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  %289 = load ptr, ptr %288, align 8, !tbaa !29
  %290 = getelementptr inbounds %struct.reader_slot, ptr %289, i32 0, i32 1
  store volatile i64 %287, ptr %290, align 8, !tbaa !14
  %291 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  %292 = load ptr, ptr %291, align 8, !tbaa !29
  %293 = getelementptr inbounds %struct.reader_slot, ptr %292, i32 0, i32 2
  %294 = load ptr, ptr %3, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.MDBX_env, ptr %294, i32 0, i32 20
  %296 = load i32, ptr %295, align 4, !tbaa !32
  %297 = call i32 @atomic_store32(ptr noundef %293, i32 noundef %296, i32 noundef 1)
  %298 = load ptr, ptr %3, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %298)
  %299 = load ptr, ptr %3, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.MDBX_env, ptr %299, i32 0, i32 1
  %301 = load i32, ptr %300, align 4, !tbaa !30
  %302 = and i32 %301, 268435456
  %303 = icmp ne i32 %302, 0
  %304 = xor i1 %303, true
  %305 = xor i1 %304, true
  %306 = zext i1 %305 to i32
  %307 = sext i32 %306 to i64
  %308 = call i64 @llvm.expect.i64(i64 %307, i64 1)
  %309 = icmp ne i64 %308, 0
  br i1 %309, label %310, label %351

310:                                              ; preds = %286
  br label %311

311:                                              ; preds = %310
  %312 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %313 = zext i8 %312 to i32
  %314 = and i32 %313, 1
  %315 = icmp ne i32 %314, 0
  %316 = xor i1 %315, true
  %317 = xor i1 %316, true
  %318 = zext i1 %317 to i32
  %319 = sext i32 %318 to i64
  %320 = call i64 @llvm.expect.i64(i64 %319, i64 1)
  %321 = icmp ne i64 %320, 0
  br i1 %321, label %322, label %343

322:                                              ; preds = %311
  br label %323

323:                                              ; preds = %322
  %324 = load ptr, ptr %3, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct.MDBX_env, ptr %324, i32 0, i32 30
  %326 = load i32, ptr %325, align 8, !tbaa !31
  %327 = load ptr, ptr %3, align 8, !tbaa !5
  %328 = getelementptr inbounds %struct.MDBX_env, ptr %327, i32 0, i32 20
  %329 = load i32, ptr %328, align 4, !tbaa !32
  %330 = icmp eq i32 %326, %329
  %331 = xor i1 %330, true
  %332 = xor i1 %331, true
  %333 = xor i1 %332, true
  %334 = zext i1 %333 to i32
  %335 = sext i32 %334 to i64
  %336 = call i64 @llvm.expect.i64(i64 %335, i64 0)
  %337 = icmp ne i64 %336, 0
  br i1 %337, label %338, label %340

338:                                              ; preds = %323
  %339 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %339, ptr noundef @.str.3, ptr noundef @__func__.mvcc_bind_slot, i32 noundef 68) #8
  unreachable

340:                                              ; preds = %323
  br label %341

341:                                              ; preds = %340
  br label %342

342:                                              ; preds = %341
  br label %343

343:                                              ; preds = %342, %311
  br label %344

344:                                              ; preds = %343
  br label %345

345:                                              ; preds = %344
  %346 = load ptr, ptr %3, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct.MDBX_env, ptr %346, i32 0, i32 21
  %348 = load i32, ptr %347, align 8, !tbaa !36
  %349 = getelementptr inbounds %struct.bind_reader_slot_result, ptr %2, i32 0, i32 1
  %350 = load ptr, ptr %349, align 8, !tbaa !29
  call void @thread_rthc_set(i32 noundef %348, ptr noundef %350)
  br label %351

351:                                              ; preds = %345, %286
  store i32 1, ptr %6, align 4
  br label %352

352:                                              ; preds = %351, %247
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  br label %353

353:                                              ; preds = %352, %180, %150, %134, %121
  %354 = load { i32, ptr }, ptr %2, align 8
  ret { i32, ptr } %354
}

; 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

declare i32 @lck_rdt_lock(ptr noundef) #3

declare void @lck_rdt_unlock(ptr noundef) #3

declare i32 @lck_rpid_set(ptr noundef) #3

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

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

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

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

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

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

declare void @thread_rthc_set(i32 noundef, ptr noundef) #3

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

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

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

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


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

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }
%union.mdbx_atomic_uint32_t = type { i32 }
%union.mdbx_atomic_uint64_t = type { i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@__func__.mvcc_bind_slot = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [318 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local { i32, ptr } @mvcc_bind_slot(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %3 = and i8 %2, 1
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %.thread69, label %4, !prof !13

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load ptr, ptr %5, align 8, !tbaa !14
  %.not54 = icmp eq ptr %6, null
  br i1 %.not54, label %7, label %8, !prof !13

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

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 104
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  %11 = load i64, ptr %10, align 64, !tbaa !25
  %.not56 = icmp eq i64 %11, 6441728281112482054
  br i1 %.not56, label %13, label %12, !prof !26

12:                                               ; preds = %8
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.mvcc_bind_slot, i32 noundef 8) #6
  unreachable

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %10, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !27
  %.not58 = icmp eq i32 %15, 909461023
  br i1 %.not58, label %.thread69, label %16, !prof !26

16:                                               ; preds = %13
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.mvcc_bind_slot, i32 noundef 9) #6
  unreachable

.thread69:                                        ; preds = %1, %13
  %17 = tail call i32 @lck_rdt_lock(ptr noundef %0) #7
  %18 = add i32 %17, -1
  %19 = icmp ult i32 %18, -2
  br i1 %19, label %93, label %20, !prof !13

20:                                               ; preds = %.thread69
  %21 = getelementptr inbounds i8, ptr %0, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !28
  %.not59 = icmp sgt i32 %22, -1
  br i1 %.not59, label %24, label %23, !prof !26

23:                                               ; preds = %20
  tail call void @lck_rdt_unlock(ptr noundef nonnull %0) #7
  br label %93

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  %.not60 = icmp eq ptr %26, null
  br i1 %.not60, label %27, label %28, !prof !13

27:                                               ; preds = %24
  tail call void @lck_rdt_unlock(ptr noundef nonnull %0) #7
  br label %93

28:                                               ; preds = %24
  %29 = getelementptr inbounds i8, ptr %0, i64 232
  %30 = load i32, ptr %29, align 8, !tbaa !29
  %31 = getelementptr inbounds i8, ptr %0, i64 140
  %32 = load i32, ptr %31, align 4, !tbaa !30
  %.not61 = icmp eq i32 %30, %32
  br i1 %.not61, label %38, label %33, !prof !26

33:                                               ; preds = %28
  %34 = tail call i32 @lck_rpid_set(ptr noundef nonnull %0) #7
  %.not62 = icmp eq i32 %34, 0
  br i1 %.not62, label %36, label %35, !prof !26

35:                                               ; preds = %33
  tail call void @lck_rdt_unlock(ptr noundef nonnull %0) #7
  br label %93

36:                                               ; preds = %33
  %37 = load i32, ptr %31, align 4, !tbaa !30
  store i32 %37, ptr %29, align 8, !tbaa !29
  br label %38

38:                                               ; preds = %36, %28
  %39 = getelementptr inbounds i8, ptr %0, i64 104
  %40 = getelementptr inbounds i8, ptr %0, i64 132
  br label %41

41:                                               ; preds = %55, %38
  %.sroa.0.0 = phi i32 [ 0, %38 ], [ -1, %55 ]
  %42 = load ptr, ptr %39, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %42, i64 488
  %44 = load volatile i32, ptr %43, align 8, !tbaa !14
  %45 = zext i32 %44 to i64
  %.not81 = icmp eq i32 %44, 0
  br i1 %.not81, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %41, %50
  %.078 = phi i64 [ %51, %50 ], [ 0, %41 ]
  %46 = load ptr, ptr %39, align 8, !tbaa !15
  %47 = getelementptr inbounds i8, ptr %46, i64 512
  %48 = getelementptr inbounds [0 x %struct.reader_slot], ptr %47, i64 0, i64 %.078, i32 2
  %49 = tail call i32 @atomic_load32(ptr noundef nonnull %48, i32 noundef 1)
  %.not63 = icmp eq i32 %49, 0
  br i1 %.not63, label %._crit_edge, label %50

50:                                               ; preds = %.lr.ph
  %51 = add nuw nsw i64 %.078, 1
  %exitcond.not = icmp eq i64 %51, %45
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !31

._crit_edge:                                      ; preds = %50, %.lr.ph, %41
  %.0.lcssa = phi i64 [ 0, %41 ], [ %.078, %.lr.ph ], [ %45, %50 ]
  %52 = load i32, ptr %40, align 4, !tbaa !33
  %53 = zext i32 %52 to i64
  %54 = icmp ult i64 %.0.lcssa, %53
  br i1 %54, label %60, label %55, !prof !26

55:                                               ; preds = %._crit_edge
  %56 = tail call i32 @mvcc_cleanup_dead(ptr noundef nonnull %0, i32 noundef 1, ptr noundef null)
  %.not64 = icmp eq i32 %56, -1
  br i1 %.not64, label %41, label %57

57:                                               ; preds = %55
  tail call void @lck_rdt_unlock(ptr noundef nonnull %0) #7
  %58 = icmp eq i32 %56, 0
  %59 = select i1 %58, i32 -30790, i32 %56
  br label %93

60:                                               ; preds = %._crit_edge
  %61 = load ptr, ptr %39, align 8, !tbaa !15
  %62 = getelementptr inbounds i8, ptr %61, i64 512
  %63 = getelementptr inbounds [0 x %struct.reader_slot], ptr %62, i64 0, i64 %.0.lcssa
  %64 = getelementptr inbounds i8, ptr %63, i64 16
  %65 = tail call i32 @atomic_store32(ptr noundef nonnull %64, i32 noundef 0, i32 noundef 1)
  tail call void @safe64_reset(ptr noundef nonnull %63, i1 noundef zeroext true)
  %66 = icmp eq i64 %.0.lcssa, %45
  br i1 %66, label %67, label %71

67:                                               ; preds = %60
  %68 = add i32 %44, 1
  %69 = load ptr, ptr %39, align 8, !tbaa !15
  %70 = getelementptr inbounds i8, ptr %69, i64 488
  store volatile i32 %68, ptr %70, align 8, !tbaa !14
  br label %71

71:                                               ; preds = %67, %60
  %72 = load i32, ptr %21, align 4, !tbaa !28
  %73 = and i32 %72, 2097152
  %.not65 = icmp eq i32 %73, 0
  br i1 %.not65, label %74, label %76

74:                                               ; preds = %71
  %75 = tail call i64 @osal_thread_self()
  br label %76

76:                                               ; preds = %71, %74
  %77 = phi i64 [ %75, %74 ], [ 0, %71 ]
  %78 = getelementptr inbounds i8, ptr %63, i64 8
  store volatile i64 %77, ptr %78, align 8, !tbaa !14
  %79 = load i32, ptr %31, align 4, !tbaa !30
  %80 = tail call i32 @atomic_store32(ptr noundef nonnull %64, i32 noundef %79, i32 noundef 1)
  tail call void @lck_rdt_unlock(ptr noundef nonnull %0) #7
  %81 = load i32, ptr %21, align 4, !tbaa !28
  %82 = and i32 %81, 268435456
  %.not66 = icmp eq i32 %82, 0
  br i1 %.not66, label %93, label %83, !prof !13

83:                                               ; preds = %76
  %84 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %85 = and i8 %84, 1
  %.not67 = icmp eq i8 %85, 0
  br i1 %.not67, label %90, label %86, !prof !13

86:                                               ; preds = %83
  %87 = load i32, ptr %29, align 8, !tbaa !29
  %88 = load i32, ptr %31, align 4, !tbaa !30
  %.not68 = icmp eq i32 %87, %88
  br i1 %.not68, label %90, label %89, !prof !26

89:                                               ; preds = %86
  tail call void @mdbx_assert_fail(ptr noundef nonnull %0, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.mvcc_bind_slot, i32 noundef 68) #6
  unreachable

90:                                               ; preds = %86, %83
  %91 = getelementptr inbounds i8, ptr %0, i64 144
  %92 = load i32, ptr %91, align 8, !tbaa !34
  tail call void @thread_rthc_set(i32 noundef %92, ptr noundef nonnull %63) #7
  br label %93

93:                                               ; preds = %57, %90, %76, %.thread69, %35, %27, %23
  %.sroa.0.2 = phi i32 [ %17, %.thread69 ], [ -30795, %23 ], [ 1, %27 ], [ %34, %35 ], [ %59, %57 ], [ %.sroa.0.0, %90 ], [ %.sroa.0.0, %76 ]
  %.sroa.14.1 = phi ptr [ null, %.thread69 ], [ null, %23 ], [ null, %27 ], [ null, %35 ], [ null, %57 ], [ %63, %90 ], [ %63, %76 ]
  %.fca.0.insert = insertvalue { i32, ptr } poison, i32 %.sroa.0.2, 0
  %.fca.1.insert = insertvalue { i32, ptr } %.fca.0.insert, ptr %.sroa.14.1, 1
  ret { i32, ptr } %.fca.1.insert
}

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

declare i32 @lck_rdt_lock(ptr noundef) local_unnamed_addr #2

declare void @lck_rdt_unlock(ptr noundef) local_unnamed_addr #2

declare i32 @lck_rpid_set(ptr noundef) local_unnamed_addr #2

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

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

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

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

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

declare void @thread_rthc_set(i32 noundef, ptr noundef) local_unnamed_addr #2

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 = { "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 = { cold nounwind optsize uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { noreturn nounwind }
attributes #7 = { nounwind }

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

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


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