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

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

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.1, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.2, %struct.anon.6, i8, ptr, ptr, ptr, %struct.anon.7, %union.pthread_mutex_t, i32, i32, ptr, %struct.osal_ioring, %union.pthread_mutex_t, [71 x %union.mdbx_atomic_uint64_t] }
%struct.osal_mmap = type { %union.anon, i32, i64, i64, i64 }
%union.anon = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.1 = type { ptr, ptr, ptr, ptr }
%struct.anon.2 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.3, %union.anon.4 }
%struct.anon.3 = type { i16, i16, i16, i16 }
%union.anon.4 = type { i32 }
%struct.anon.6 = type { i64, i64, i64, i64, i64 }
%struct.anon.7 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.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.11 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__.mvcc_cleanup_dead = external hidden unnamed_addr constant [18 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1

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

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

declare i32 @lck_rdt_lock(ptr noundef) #2

declare void @lck_rdt_unlock(ptr noundef) #2

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

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mvcc_cleanup_dead(ptr noundef %0, i32 noundef %1, ptr noundef %2) #5 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca [142 x i32], align 16
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call i32 @check_env(ptr noundef %19, i1 noundef zeroext true)
  store i32 %20, ptr %8, align 4, !tbaa !9
  %21 = load i32, ptr %8, align 4, !tbaa !9
  %22 = icmp ne i32 %21, 0
  %23 = xor i1 %22, true
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = sext i32 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %3
  %30 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %30, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %295

31:                                               ; preds = %3
  br label %32

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

43:                                               ; preds = %32
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = icmp sge i32 %45, 0
  %47 = xor i1 %46, true
  %48 = xor i1 %47, true
  %49 = xor i1 %48, true
  %50 = zext i1 %49 to i32
  %51 = sext i32 %50 to i64
  %52 = call i64 @llvm.expect.i64(i64 %51, i64 0)
  %53 = icmp ne i64 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %44
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mdbx_assert_fail(ptr noundef %55, ptr noundef @.str.11, ptr noundef @__func__.mvcc_cleanup_dead, i32 noundef 212) #11
  unreachable

56:                                               ; preds = %44
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58, %32
  br label %60

60:                                               ; preds = %59
  br label %61

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

74:                                               ; preds = %61
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %79

77:                                               ; preds = %74
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %78, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %77, %74
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %294

80:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #10
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.shared_lck, ptr %81, i32 0, i32 20
  %83 = call i32 @atomic_load32(ptr noundef %82, i32 noundef 1)
  %84 = zext i32 %83 to i64
  store i64 %84, ptr %11, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 568, ptr %12) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  %85 = load i64, ptr %11, align 8, !tbaa !16
  %86 = icmp ult i64 %85, 142
  br i1 %86, label %87, label %89

87:                                               ; preds = %80
  %88 = getelementptr inbounds [142 x i32], ptr %12, i64 0, i64 0
  br label %94

89:                                               ; preds = %80
  %90 = load i64, ptr %11, align 8, !tbaa !16
  %91 = add i64 %90, 1
  %92 = mul i64 %91, 4
  %93 = call noalias ptr @malloc(i64 noundef %92) #12
  br label %94

94:                                               ; preds = %89, %87
  %95 = phi ptr [ %88, %87 ], [ %93, %89 ]
  store ptr %95, ptr %13, align 8, !tbaa !5
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = icmp ne ptr %96, null
  %98 = xor i1 %97, true
  %99 = xor i1 %98, true
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i32
  %102 = sext i32 %101 to i64
  %103 = call i64 @llvm.expect.i64(i64 %102, i64 0)
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %94
  store i32 12, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %293

106:                                              ; preds = %94
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = getelementptr inbounds i32, ptr %107, i64 0
  store i32 0, ptr %108, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #10
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #10
  store i64 0, ptr %15, align 8, !tbaa !16
  br label %109

109:                                              ; preds = %250, %106
  %110 = load i64, ptr %15, align 8, !tbaa !16
  %111 = load i64, ptr %11, align 8, !tbaa !16
  %112 = icmp ult i64 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 6, ptr %9, align 4
  br label %253

114:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #10
  %115 = load ptr, ptr %10, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.shared_lck, ptr %115, i32 0, i32 23
  %117 = load i64, ptr %15, align 8, !tbaa !16
  %118 = getelementptr inbounds [0 x %struct.reader_slot], ptr %116, i64 0, i64 %117
  %119 = getelementptr inbounds %struct.reader_slot, ptr %118, i32 0, i32 2
  %120 = call i32 @atomic_load32(ptr noundef %119, i32 noundef 1)
  store i32 %120, ptr %16, align 4, !tbaa !9
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %124

123:                                              ; preds = %114
  store i32 8, ptr %9, align 4
  br label %247

124:                                              ; preds = %114
  %125 = load i32, ptr %16, align 4, !tbaa !9
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MDBX_env, ptr %126, i32 0, i32 20
  %128 = load i32, ptr %127, align 4, !tbaa !17
  %129 = icmp eq i32 %125, %128
  br i1 %129, label %130, label %131

130:                                              ; preds = %124
  store i32 8, ptr %9, align 4
  br label %247

131:                                              ; preds = %124
  %132 = load ptr, ptr %13, align 8, !tbaa !5
  %133 = load i32, ptr %16, align 4, !tbaa !9
  %134 = call zeroext i1 @pid_insert(ptr noundef %132, i32 noundef %133)
  br i1 %134, label %136, label %135

135:                                              ; preds = %131
  store i32 8, ptr %9, align 4
  br label %247

136:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load i32, ptr %16, align 4, !tbaa !9
  %139 = call i32 @lck_rpid_check(ptr noundef %137, i32 noundef %138)
  store i32 %139, ptr %17, align 4, !tbaa !9
  %140 = load i32, ptr %17, align 4, !tbaa !9
  %141 = icmp eq i32 %140, -1
  br i1 %141, label %142, label %143

142:                                              ; preds = %136
  store i32 8, ptr %9, align 4
  br label %246

143:                                              ; preds = %136
  %144 = load i32, ptr %17, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %143
  %147 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %147, ptr %8, align 4, !tbaa !9
  store i32 6, ptr %9, align 4
  br label %246

148:                                              ; preds = %143
  %149 = load i32, ptr %6, align 4, !tbaa !9
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %191, label %151

151:                                              ; preds = %148
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = call i32 @lck_rdt_lock(ptr noundef %152)
  store i32 %153, ptr %17, align 4, !tbaa !9
  %154 = load i32, ptr %17, align 4, !tbaa !9
  %155 = icmp ne i32 %154, -1
  br i1 %155, label %156, label %161

156:                                              ; preds = %151
  %157 = load i32, ptr %17, align 4, !tbaa !9
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %161

159:                                              ; preds = %156
  %160 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %160, ptr %8, align 4, !tbaa !9
  store i32 6, ptr %9, align 4
  br label %246

161:                                              ; preds = %156, %151
  store i32 -1, ptr %6, align 4, !tbaa !9
  %162 = load i32, ptr %17, align 4, !tbaa !9
  %163 = icmp eq i32 %162, -1
  br i1 %163, label %164, label %165

164:                                              ; preds = %161
  store i32 -1, ptr %8, align 4, !tbaa !9
  store i32 6, ptr %9, align 4
  br label %246

165:                                              ; preds = %161
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.shared_lck, ptr %166, i32 0, i32 23
  %168 = load i64, ptr %15, align 8, !tbaa !16
  %169 = getelementptr inbounds [0 x %struct.reader_slot], ptr %167, i64 0, i64 %168
  %170 = getelementptr inbounds %struct.reader_slot, ptr %169, i32 0, i32 2
  %171 = load volatile i32, ptr %170, align 16, !tbaa !15
  %172 = load i32, ptr %16, align 4, !tbaa !9
  %173 = icmp ne i32 %171, %172
  br i1 %173, label %174, label %175

174:                                              ; preds = %165
  store i32 8, ptr %9, align 4
  br label %246

175:                                              ; preds = %165
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = load i32, ptr %16, align 4, !tbaa !9
  %178 = call i32 @lck_rpid_check(ptr noundef %176, i32 noundef %177)
  store i32 %178, ptr %17, align 4, !tbaa !9
  %179 = load i32, ptr %17, align 4, !tbaa !9
  %180 = icmp ne i32 %179, -1
  br i1 %180, label %181, label %186

181:                                              ; preds = %175
  %182 = load i32, ptr %17, align 4, !tbaa !9
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %186

184:                                              ; preds = %181
  %185 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %185, ptr %8, align 4, !tbaa !9
  store i32 6, ptr %9, align 4
  br label %246

186:                                              ; preds = %181, %175
  %187 = load i32, ptr %17, align 4, !tbaa !9
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %189, label %190

189:                                              ; preds = %186
  store i32 8, ptr %9, align 4
  br label %246

190:                                              ; preds = %186
  br label %191

191:                                              ; preds = %190, %148
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #10
  %192 = load i64, ptr %15, align 8, !tbaa !16
  store i64 %192, ptr %18, align 8, !tbaa !16
  br label %193

193:                                              ; preds = %242, %191
  %194 = load i64, ptr %18, align 8, !tbaa !16
  %195 = load i64, ptr %11, align 8, !tbaa !16
  %196 = icmp ult i64 %194, %195
  br i1 %196, label %198, label %197

197:                                              ; preds = %193
  store i32 9, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #10
  br label %245

198:                                              ; preds = %193
  %199 = load ptr, ptr %10, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.shared_lck, ptr %199, i32 0, i32 23
  %201 = load i64, ptr %18, align 8, !tbaa !16
  %202 = getelementptr inbounds [0 x %struct.reader_slot], ptr %200, i64 0, i64 %201
  %203 = getelementptr inbounds %struct.reader_slot, ptr %202, i32 0, i32 2
  %204 = load volatile i32, ptr %203, align 16, !tbaa !15
  %205 = load i32, ptr %16, align 4, !tbaa !9
  %206 = icmp eq i32 %204, %205
  br i1 %206, label %207, label %241

207:                                              ; preds = %198
  br label %208

208:                                              ; preds = %207
  %209 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !27
  %210 = zext i8 %209 to i32
  %211 = icmp sle i32 5, %210
  %212 = xor i1 %211, true
  %213 = xor i1 %212, true
  %214 = zext i1 %213 to i32
  %215 = sext i32 %214 to i64
  %216 = call i64 @llvm.expect.i64(i64 %215, i64 0)
  %217 = icmp ne i64 %216, 0
  br i1 %217, label %218, label %227

218:                                              ; preds = %208
  %219 = load i32, ptr %16, align 4, !tbaa !9
  %220 = zext i32 %219 to i64
  %221 = load ptr, ptr %10, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.shared_lck, ptr %221, i32 0, i32 23
  %223 = load i64, ptr %18, align 8, !tbaa !16
  %224 = getelementptr inbounds [0 x %struct.reader_slot], ptr %222, i64 0, i64 %223
  %225 = getelementptr inbounds %struct.reader_slot, ptr %224, i32 0, i32 0
  %226 = load volatile i64, ptr %225, align 32, !tbaa !15
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.mvcc_cleanup_dead, i32 noundef 281, ptr noundef @.str.12, i64 noundef %220, i64 noundef %226)
  br label %227

227:                                              ; preds = %218, %208
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  %230 = load ptr, ptr %10, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.shared_lck, ptr %230, i32 0, i32 23
  %232 = load i64, ptr %18, align 8, !tbaa !16
  %233 = getelementptr inbounds [0 x %struct.reader_slot], ptr %231, i64 0, i64 %232
  %234 = getelementptr inbounds %struct.reader_slot, ptr %233, i32 0, i32 2
  %235 = call i32 @atomic_store32(ptr noundef %234, i32 noundef 0, i32 noundef 0)
  %236 = load ptr, ptr %10, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.shared_lck, ptr %236, i32 0, i32 21
  %238 = call i32 @atomic_store32(ptr noundef %237, i32 noundef 1, i32 noundef 1)
  %239 = load i32, ptr %14, align 4, !tbaa !9
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %14, align 4, !tbaa !9
  br label %241

241:                                              ; preds = %229, %198
  br label %242

242:                                              ; preds = %241
  %243 = load i64, ptr %18, align 8, !tbaa !16
  %244 = add i64 %243, 1
  store i64 %244, ptr %18, align 8, !tbaa !16
  br label %193, !llvm.loop !28

245:                                              ; preds = %197
  store i32 0, ptr %9, align 4
  br label %246

246:                                              ; preds = %245, %189, %184, %174, %164, %159, %146, %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  br label %247

247:                                              ; preds = %246, %135, %130, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  %248 = load i32, ptr %9, align 4
  switch i32 %248, label %253 [
    i32 0, label %249
    i32 8, label %250
  ]

249:                                              ; preds = %247
  br label %250

250:                                              ; preds = %249, %247
  %251 = load i64, ptr %15, align 8, !tbaa !16
  %252 = add i64 %251, 1
  store i64 %252, ptr %15, align 8, !tbaa !16
  br label %109, !llvm.loop !30

253:                                              ; preds = %247, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #10
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %8, align 4, !tbaa !9
  %256 = icmp ne i32 %255, -1
  br i1 %256, label %257, label %260

257:                                              ; preds = %254
  %258 = load i32, ptr %8, align 4, !tbaa !9
  %259 = icmp ne i32 %258, 0
  br label %260

260:                                              ; preds = %257, %254
  %261 = phi i1 [ false, %254 ], [ %259, %257 ]
  %262 = xor i1 %261, true
  %263 = xor i1 %262, true
  %264 = xor i1 %263, true
  %265 = zext i1 %264 to i32
  %266 = sext i32 %265 to i64
  %267 = call i64 @llvm.expect.i64(i64 %266, i64 1)
  %268 = icmp ne i64 %267, 0
  br i1 %268, label %269, label %274

269:                                              ; preds = %260
  %270 = load ptr, ptr %10, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.shared_lck, ptr %270, i32 0, i32 15
  %272 = call i64 @osal_monotime()
  %273 = call i64 @atomic_store64(ptr noundef %271, i64 noundef %272, i32 noundef 0)
  br label %274

274:                                              ; preds = %269, %260
  %275 = load i32, ptr %6, align 4, !tbaa !9
  %276 = icmp slt i32 %275, 0
  br i1 %276, label %277, label %279

277:                                              ; preds = %274
  %278 = load ptr, ptr %5, align 8, !tbaa !5
  call void @lck_rdt_unlock(ptr noundef %278)
  br label %279

279:                                              ; preds = %277, %274
  %280 = load ptr, ptr %13, align 8, !tbaa !5
  %281 = getelementptr inbounds [142 x i32], ptr %12, i64 0, i64 0
  %282 = icmp ne ptr %280, %281
  br i1 %282, label %283, label %285

283:                                              ; preds = %279
  %284 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %284) #10
  br label %285

285:                                              ; preds = %283, %279
  %286 = load ptr, ptr %7, align 8, !tbaa !5
  %287 = icmp ne ptr %286, null
  br i1 %287, label %288, label %291

288:                                              ; preds = %285
  %289 = load i32, ptr %14, align 4, !tbaa !9
  %290 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %289, ptr %290, align 4, !tbaa !9
  br label %291

291:                                              ; preds = %288, %285
  %292 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %292, ptr %4, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  br label %293

293:                                              ; preds = %291, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 568, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #10
  br label %294

294:                                              ; preds = %293, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #10
  br label %295

295:                                              ; preds = %294, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  %296 = load i32, ptr %4, align 4
  ret i32 %296
}

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

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @check_env(ptr noundef, i1 noundef zeroext) #6

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #7

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @pid_insert(ptr noundef, i32 noundef) #8

declare i32 @lck_rpid_check(ptr noundef, i32 noundef) #2

declare i64 @osal_monotime() #2

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

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

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


; 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.11 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__.mvcc_cleanup_dead = external hidden unnamed_addr constant [18 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1

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

declare i32 @lck_rdt_lock(ptr noundef) local_unnamed_addr #1

declare void @lck_rdt_unlock(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mvcc_cleanup_dead(ptr noundef %0, i32 noundef %1, ptr noundef writeonly %2) local_unnamed_addr #4 {
  %4 = alloca [142 x i32], align 16
  %5 = tail call i32 @check_env(ptr noundef %0, i1 noundef zeroext true)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %84, !prof !5

6:                                                ; preds = %3
  %7 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !6
  %8 = and i8 %7, 1
  %.not101 = icmp ne i8 %8, 0
  %9 = icmp slt i32 %1, 0
  %or.cond110 = and i1 %9, %.not101
  br i1 %or.cond110, label %10, label %11, !prof !14

10:                                               ; preds = %6
  tail call void @mdbx_assert_fail(ptr noundef %0, ptr noundef nonnull @.str.11, ptr noundef nonnull @__func__.mvcc_cleanup_dead, i32 noundef 212) #9
  unreachable

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %17, !prof !16

15:                                               ; preds = %11
  %.not109 = icmp eq ptr %2, null
  br i1 %.not109, label %84, label %16

16:                                               ; preds = %15
  store i32 0, ptr %2, align 4, !tbaa !17
  br label %84

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %13, i64 488
  %19 = tail call i32 @atomic_load32(ptr noundef nonnull %18, i32 noundef 1)
  %20 = zext i32 %19 to i64
  call void @llvm.lifetime.start.p0(i64 568, ptr nonnull %4) #10
  %21 = icmp ult i32 %19, 142
  br i1 %21, label %.thread, label %22

22:                                               ; preds = %17
  %23 = shl nuw nsw i64 %20, 2
  %24 = add nuw nsw i64 %23, 4
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #11
  %.not102 = icmp eq ptr %25, null
  br i1 %.not102, label %83, label %.thread.thread, !prof !18

.thread.thread:                                   ; preds = %22
  store i32 0, ptr %25, align 4, !tbaa !17
  br label %.lr.ph139

.thread:                                          ; preds = %17
  store i32 0, ptr %4, align 16, !tbaa !17
  %.not155 = icmp eq i32 %19, 0
  br i1 %.not155, label %.thread120, label %.lr.ph139

.lr.ph139:                                        ; preds = %.thread.thread, %.thread
  %26 = phi ptr [ %25, %.thread.thread ], [ %4, %.thread ]
  %27 = getelementptr inbounds i8, ptr %13, i64 512
  %28 = getelementptr inbounds i8, ptr %0, i64 140
  %29 = getelementptr inbounds i8, ptr %13, i64 492
  br label %30

30:                                               ; preds = %.lr.ph139, %.loopexit
  %.074137 = phi i64 [ 0, %.lr.ph139 ], [ %71, %.loopexit ]
  %.075136 = phi i32 [ 0, %.lr.ph139 ], [ %.4.ph, %.loopexit ]
  %.078135 = phi i32 [ %1, %.lr.ph139 ], [ %.381.ph, %.loopexit ]
  %31 = getelementptr inbounds [0 x %struct.reader_slot], ptr %27, i64 0, i64 %.074137, i32 2
  %32 = call i32 @atomic_load32(ptr noundef nonnull %31, i32 noundef 1)
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.loopexit, label %34

34:                                               ; preds = %30
  %35 = load i32, ptr %28, align 4, !tbaa !19
  %36 = icmp eq i32 %32, %35
  br i1 %36, label %.loopexit, label %37

37:                                               ; preds = %34
  %38 = call zeroext i1 @pid_insert(ptr noundef nonnull %26, i32 noundef %32)
  br i1 %38, label %39, label %.loopexit

39:                                               ; preds = %37
  %40 = call i32 @lck_rpid_check(ptr noundef nonnull %0, i32 noundef %32) #10
  switch i32 %40, label %._crit_edge [
    i32 -1, label %.loopexit
    i32 0, label %41
  ]

41:                                               ; preds = %39
  %.not104 = icmp eq i32 %.078135, 0
  br i1 %.not104, label %42, label %.lr.ph

42:                                               ; preds = %41
  %43 = call i32 @lck_rdt_lock(ptr noundef nonnull %0) #10
  %44 = add i32 %43, -1
  %or.cond = icmp ult i32 %44, -2
  br i1 %or.cond, label %._crit_edge, label %45

45:                                               ; preds = %42
  %46 = icmp eq i32 %43, -1
  br i1 %46, label %.thread120, label %47

47:                                               ; preds = %45
  %48 = load volatile i32, ptr %31, align 16, !tbaa !15
  %.not105 = icmp eq i32 %48, %32
  br i1 %.not105, label %49, label %.loopexit

49:                                               ; preds = %47
  %50 = call i32 @lck_rpid_check(ptr noundef nonnull %0, i32 noundef %32) #10
  %51 = add i32 %50, -1
  %or.cond3 = icmp ult i32 %51, -2
  br i1 %or.cond3, label %._crit_edge, label %52

52:                                               ; preds = %49
  %.not106 = icmp eq i32 %50, 0
  br i1 %.not106, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %41, %52
  %.179 = phi i32 [ %.078135, %41 ], [ -1, %52 ]
  %53 = zext i32 %32 to i64
  br label %54

54:                                               ; preds = %.lr.ph, %68
  %.0134 = phi i64 [ %.074137, %.lr.ph ], [ %69, %68 ]
  %.176133 = phi i32 [ %.075136, %.lr.ph ], [ %.277, %68 ]
  %55 = getelementptr inbounds [0 x %struct.reader_slot], ptr %27, i64 0, i64 %.0134
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %57 = load volatile i32, ptr %56, align 16, !tbaa !15
  %58 = icmp eq i32 %57, %32
  br i1 %58, label %59, label %68

59:                                               ; preds = %54
  %60 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !29
  %61 = icmp ugt i8 %60, 4
  br i1 %61, label %62, label %64, !prof !16

62:                                               ; preds = %59
  %63 = load volatile i64, ptr %55, align 32, !tbaa !15
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.mvcc_cleanup_dead, i32 noundef 281, ptr noundef nonnull @.str.12, i64 noundef %53, i64 noundef %63) #10
  br label %64

64:                                               ; preds = %62, %59
  %65 = call i32 @atomic_store32(ptr noundef nonnull %56, i32 noundef 0, i32 noundef 0)
  %66 = call i32 @atomic_store32(ptr noundef nonnull %29, i32 noundef 1, i32 noundef 1)
  %67 = add nsw i32 %.176133, 1
  br label %68

68:                                               ; preds = %54, %64
  %.277 = phi i32 [ %67, %64 ], [ %.176133, %54 ]
  %69 = add nuw nsw i64 %.0134, 1
  %70 = icmp ult i64 %69, %20
  br i1 %70, label %54, label %.loopexit, !llvm.loop !30

.loopexit:                                        ; preds = %68, %30, %34, %37, %39, %47, %52
  %.381.ph = phi i32 [ -1, %52 ], [ -1, %47 ], [ %.078135, %39 ], [ %.078135, %37 ], [ %.078135, %34 ], [ %.078135, %30 ], [ %.179, %68 ]
  %.4.ph = phi i32 [ %.075136, %52 ], [ %.075136, %47 ], [ %.075136, %39 ], [ %.075136, %37 ], [ %.075136, %34 ], [ %.075136, %30 ], [ %.277, %68 ]
  %71 = add nuw nsw i64 %.074137, 1
  %exitcond.not = icmp eq i64 %71, %20
  br i1 %exitcond.not, label %.thread120, label %30, !llvm.loop !32

.thread120:                                       ; preds = %.loopexit, %45, %.thread
  %72 = phi ptr [ %4, %.thread ], [ %26, %45 ], [ %26, %.loopexit ]
  %.075132 = phi i32 [ 0, %.thread ], [ %.4.ph, %.loopexit ], [ %.075136, %45 ]
  %.482127 = phi i32 [ %1, %.thread ], [ %.381.ph, %.loopexit ], [ -1, %45 ]
  %.386125 = phi i32 [ 0, %.thread ], [ 0, %.loopexit ], [ -1, %45 ]
  %73 = getelementptr inbounds i8, ptr %13, i64 384
  %74 = call i64 @osal_monotime() #10
  %75 = call i64 @atomic_store64(ptr noundef nonnull %73, i64 noundef %74, i32 noundef 0)
  br label %._crit_edge

._crit_edge:                                      ; preds = %39, %49, %42, %.thread120
  %76 = phi ptr [ %72, %.thread120 ], [ %26, %42 ], [ %26, %49 ], [ %26, %39 ]
  %.075131 = phi i32 [ %.075132, %.thread120 ], [ %.075136, %42 ], [ %.075136, %49 ], [ %.075136, %39 ]
  %.482126 = phi i32 [ %.482127, %.thread120 ], [ %.078135, %39 ], [ -1, %49 ], [ 0, %42 ]
  %.386124 = phi i32 [ %.386125, %.thread120 ], [ %40, %39 ], [ %50, %49 ], [ %43, %42 ]
  %77 = icmp slt i32 %.482126, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %._crit_edge
  call void @lck_rdt_unlock(ptr noundef %0) #10
  br label %79

79:                                               ; preds = %78, %._crit_edge
  %.not107 = icmp eq ptr %76, %4
  br i1 %.not107, label %81, label %80

80:                                               ; preds = %79
  call void @free(ptr noundef nonnull %76) #10
  br label %81

81:                                               ; preds = %80, %79
  %.not108 = icmp eq ptr %2, null
  br i1 %.not108, label %83, label %82

82:                                               ; preds = %81
  store i32 %.075131, ptr %2, align 4, !tbaa !17
  br label %83

83:                                               ; preds = %81, %82, %22
  %.073 = phi i32 [ 12, %22 ], [ %.386124, %82 ], [ %.386124, %81 ]
  call void @llvm.lifetime.end.p0(i64 568, ptr nonnull %4) #10
  br label %84

84:                                               ; preds = %83, %16, %15, %3
  %.2 = phi i32 [ %5, %3 ], [ %.073, %83 ], [ 0, %16 ], [ 0, %15 ]
  ret i32 %.2
}

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

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

declare void @debug_log(i32 noundef, ptr noundef, i32 noundef, 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 #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @check_env(ptr noundef, i1 noundef zeroext) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @pid_insert(ptr noundef, i32 noundef) local_unnamed_addr #7

declare i32 @lck_rpid_check(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i64 @osal_monotime() local_unnamed_addr #1

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

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

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


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