; LLVM IR from erthink/libmdbx :: src (api-cold)

; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.16, i64 }
%union.anon.16 = type { ptr }
%struct.rlimit = type { i64, i64 }
%struct.iovec = type { ptr, i64 }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.10 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.8, %union.anon.9 }
%union.anon.8 = type { i32 }
%union.anon.9 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.10 = type { %struct.anon.12 }
%struct.anon.12 = type { %struct.troika, ptr, %struct.anon.13, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.14 }
%struct.anon.13 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.14 = type { %struct.anon.15 }
%struct.anon.15 = type { i64, ptr }
%struct.meta = type { [2 x i32], %union.anon.17, i16, i8, i8, %struct.geo, %union.anon.18, %struct.MDBX_canary, %union.anon.21, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.17 = type { i64 }
%union.anon.18 = type { %struct.anon.19 }
%struct.anon.19 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%union.anon.21 = type { i64 }
%union.mdbx_atomic_uint32_t = type { i32 }
%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 }
%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 }

@globals = external global %struct.libmdbx_globals, align 8
@__func__.mdbx_env_warmup = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_env_warmup(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.troika, align 8
  %16 = alloca %struct.meta_ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca %struct.rlimit, align 8
  %22 = alloca %struct.rlimit, align 8
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i32, align 4
  %28 = alloca [64 x %struct.iovec], align 16
  %29 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %35

32:                                               ; preds = %4
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br label %35

35:                                               ; preds = %32, %4
  %36 = phi i1 [ false, %4 ], [ %34, %32 ]
  %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 0)
  %42 = icmp ne i64 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %35
  %44 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 138)
  store i32 %44, ptr %5, align 4
  br label %504

45:                                               ; preds = %35
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = icmp ugt i32 %46, 31
  %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 = %45
  %55 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 141)
  store i32 %55, ptr %5, align 4
  br label %504

56:                                               ; preds = %45
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %77

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #11
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = call i32 @check_txn(ptr noundef %60, i32 noundef 3)
  store i32 %61, ptr %10, align 4, !tbaa !9
  %62 = load i32, ptr %10, align 4, !tbaa !9
  %63 = icmp ne i32 %62, 0
  %64 = xor i1 %63, true
  %65 = xor i1 %64, true
  %66 = zext i1 %65 to i32
  %67 = sext i32 %66 to i64
  %68 = call i64 @llvm.expect.i64(i64 %67, i64 0)
  %69 = icmp ne i64 %68, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %59
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = call i32 @log_if_error(i32 noundef %71, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 146)
  store i32 %72, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %74

73:                                               ; preds = %59
  store i32 0, ptr %11, align 4
  br label %74

74:                                               ; preds = %73, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #11
  %75 = load i32, ptr %11, align 4
  switch i32 %75, label %506 [
    i32 0, label %76
    i32 1, label %504
  ]

76:                                               ; preds = %74
  br label %77

77:                                               ; preds = %76, %56
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %115

80:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #11
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = call i32 @check_env(ptr noundef %81, i1 noundef zeroext false)
  store i32 %82, ptr %12, align 4, !tbaa !9
  %83 = load i32, ptr %12, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  %85 = xor i1 %84, true
  %86 = xor i1 %85, true
  %87 = zext i1 %86 to i32
  %88 = sext i32 %87 to i64
  %89 = call i64 @llvm.expect.i64(i64 %88, i64 0)
  %90 = icmp ne i64 %89, 0
  br i1 %90, label %91, label %94

91:                                               ; preds = %80
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = call i32 @log_if_error(i32 noundef %92, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 151)
  store i32 %93, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %112

94:                                               ; preds = %80
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %111

97:                                               ; preds = %94
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.MDBX_txn, ptr %98, i32 0, i32 9
  %100 = load ptr, ptr %99, align 8, !tbaa !11
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = icmp ne ptr %100, %101
  %103 = xor i1 %102, true
  %104 = xor i1 %103, true
  %105 = zext i1 %104 to i32
  %106 = sext i32 %105 to i64
  %107 = call i64 @llvm.expect.i64(i64 %106, i64 0)
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %97
  %110 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 153)
  store i32 %110, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %112

111:                                              ; preds = %97, %94
  store i32 0, ptr %11, align 4
  br label %112

112:                                              ; preds = %111, %109, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #11
  %113 = load i32, ptr %11, align 4
  switch i32 %113, label %506 [
    i32 0, label %114
    i32 1, label %504
  ]

114:                                              ; preds = %112
  br label %119

115:                                              ; preds = %77
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.MDBX_txn, ptr %116, i32 0, i32 9
  %118 = load ptr, ptr %117, align 8, !tbaa !11
  store ptr %118, ptr %6, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %115, %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #11
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %131

122:                                              ; preds = %119
  %123 = load i32, ptr %8, align 4, !tbaa !9
  %124 = and i32 %123, 1
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %131

126:                                              ; preds = %122
  %127 = call i64 @osal_monotime()
  %128 = load i32, ptr %9, align 4, !tbaa !9
  %129 = call i64 @osal_16dot16_to_monotime(i32 noundef %128)
  %130 = add i64 %127, %129
  br label %132

131:                                              ; preds = %122, %119
  br label %132

132:                                              ; preds = %131, %126
  %133 = phi i64 [ %130, %126 ], [ 0, %131 ]
  store i64 %133, ptr %13, align 8, !tbaa !17
  %134 = load i32, ptr %8, align 4, !tbaa !9
  %135 = and i32 %134, 16
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %139

137:                                              ; preds = %132
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  call void @munlock_all(ptr noundef %138)
  br label %139

139:                                              ; preds = %137, %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #11
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %147

142:                                              ; preds = %139
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MDBX_txn, ptr %143, i32 0, i32 6
  %145 = getelementptr inbounds %struct.geo, ptr %144, i32 0, i32 5
  %146 = load i32, ptr %145, align 8, !tbaa !18
  store i32 %146, ptr %14, align 4, !tbaa !9
  br label %155

147:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #11
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  call void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8 %15, ptr noundef %148)
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  call void @meta_recent(ptr dead_on_unwind writable sret(%struct.meta_ptr) align 8 %16, ptr noundef %149, ptr noundef %15)
  %150 = getelementptr inbounds %struct.meta_ptr, ptr %16, i32 0, i32 1
  %151 = load ptr, ptr %150, align 8, !tbaa !18
  %152 = getelementptr inbounds %struct.meta, ptr %151, i32 0, i32 5
  %153 = getelementptr inbounds %struct.geo, ptr %152, i32 0, i32 5
  %154 = load volatile i32, ptr %153, align 4, !tbaa !18
  store i32 %154, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #11
  br label %155

155:                                              ; preds = %147, %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #11
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = load i32, ptr %14, align 4, !tbaa !9
  %158 = zext i32 %157 to i64
  %159 = call i64 @pgno_align2os_bytes(ptr noundef %156, i64 noundef %158) #12
  store i64 %159, ptr %17, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #11
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = load i64, ptr %17, align 8, !tbaa !17
  %162 = call i32 @bytes2pgno(ptr noundef %160, i64 noundef %161) #12
  store i32 %162, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #11
  store i32 0, ptr %19, align 4, !tbaa !9
  %163 = load i32, ptr %8, align 4, !tbaa !9
  %164 = and i32 %163, 8
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %263

166:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #11
  %167 = load i64, ptr %17, align 8, !tbaa !17
  %168 = call i64 @estimate_rss(i64 noundef %167)
  store i64 %168, ptr %20, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #11
  %169 = call i32 @getrlimit64(i32 noundef 5, ptr noundef %21) #11
  %170 = icmp eq i32 %169, 0
  br i1 %170, label %171, label %212

171:                                              ; preds = %166
  %172 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 0
  %173 = load i64, ptr %172, align 8, !tbaa !19
  %174 = load i64, ptr %20, align 8, !tbaa !17
  %175 = icmp ult i64 %173, %174
  br i1 %175, label %176, label %212

176:                                              ; preds = %171
  %177 = load i64, ptr %20, align 8, !tbaa !17
  %178 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 0
  store i64 %177, ptr %178, align 8, !tbaa !19
  %179 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 1
  %180 = load i64, ptr %179, align 8, !tbaa !21
  %181 = load i64, ptr %20, align 8, !tbaa !17
  %182 = icmp ult i64 %180, %181
  br i1 %182, label %183, label %186

183:                                              ; preds = %176
  %184 = load i64, ptr %20, align 8, !tbaa !17
  %185 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 1
  store i64 %184, ptr %185, align 8, !tbaa !21
  br label %186

186:                                              ; preds = %183, %176
  %187 = call i32 @setrlimit64(i32 noundef 5, ptr noundef %21) #11
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %189, label %211

189:                                              ; preds = %186
  %190 = call ptr @__errno_location() #13
  %191 = load i32, ptr %190, align 4, !tbaa !9
  store i32 %191, ptr %19, align 4, !tbaa !9
  br label %192

192:                                              ; preds = %189
  %193 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !22
  %194 = zext i8 %193 to i32
  %195 = icmp sle i32 2, %194
  %196 = xor i1 %195, true
  %197 = xor i1 %196, true
  %198 = zext i1 %197 to i32
  %199 = sext i32 %198 to i64
  %200 = call i64 @llvm.expect.i64(i64 %199, i64 0)
  %201 = icmp ne i64 %200, 0
  br i1 %201, label %202, label %208

202:                                              ; preds = %192
  %203 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 0
  %204 = load i64, ptr %203, align 8, !tbaa !19
  %205 = getelementptr inbounds %struct.rlimit, ptr %21, i32 0, i32 1
  %206 = load i64, ptr %205, align 8, !tbaa !21
  %207 = load i32, ptr %19, align 4, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 199, ptr noundef @.str.1, ptr noundef @.str.2, i64 noundef %204, i64 noundef %206, i32 noundef %207)
  br label %208

208:                                              ; preds = %202, %192
  br label %209

209:                                              ; preds = %208
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210, %186
  br label %212

212:                                              ; preds = %211, %171, %166
  %213 = load i32, ptr %8, align 4, !tbaa !9
  %214 = and i32 %213, 4
  %215 = icmp ne i32 %214, 0
  br i1 %215, label %216, label %261

216:                                              ; preds = %212
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #11
  %217 = call i32 @getrlimit64(i32 noundef 8, ptr noundef %22) #11
  %218 = icmp eq i32 %217, 0
  br i1 %218, label %219, label %260

219:                                              ; preds = %216
  %220 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 0
  %221 = load i64, ptr %220, align 8, !tbaa !19
  %222 = load i64, ptr %20, align 8, !tbaa !17
  %223 = icmp ult i64 %221, %222
  br i1 %223, label %224, label %260

224:                                              ; preds = %219
  %225 = load i64, ptr %20, align 8, !tbaa !17
  %226 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 0
  store i64 %225, ptr %226, align 8, !tbaa !19
  %227 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 1
  %228 = load i64, ptr %227, align 8, !tbaa !21
  %229 = load i64, ptr %20, align 8, !tbaa !17
  %230 = icmp ult i64 %228, %229
  br i1 %230, label %231, label %234

231:                                              ; preds = %224
  %232 = load i64, ptr %20, align 8, !tbaa !17
  %233 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 1
  store i64 %232, ptr %233, align 8, !tbaa !21
  br label %234

234:                                              ; preds = %231, %224
  %235 = call i32 @setrlimit64(i32 noundef 8, ptr noundef %22) #11
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %259

237:                                              ; preds = %234
  %238 = call ptr @__errno_location() #13
  %239 = load i32, ptr %238, align 4, !tbaa !9
  store i32 %239, ptr %19, align 4, !tbaa !9
  br label %240

240:                                              ; preds = %237
  %241 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !22
  %242 = zext i8 %241 to i32
  %243 = icmp sle i32 2, %242
  %244 = xor i1 %243, true
  %245 = xor i1 %244, true
  %246 = zext i1 %245 to i32
  %247 = sext i32 %246 to i64
  %248 = call i64 @llvm.expect.i64(i64 %247, i64 0)
  %249 = icmp ne i64 %248, 0
  br i1 %249, label %250, label %256

250:                                              ; preds = %240
  %251 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 0
  %252 = load i64, ptr %251, align 8, !tbaa !19
  %253 = getelementptr inbounds %struct.rlimit, ptr %22, i32 0, i32 1
  %254 = load i64, ptr %253, align 8, !tbaa !21
  %255 = load i32, ptr %19, align 4, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 213, ptr noundef @.str.1, ptr noundef @.str.3, i64 noundef %252, i64 noundef %254, i32 noundef %255)
  br label %256

256:                                              ; preds = %250, %240
  br label %257

257:                                              ; preds = %256
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258, %234
  br label %260

260:                                              ; preds = %259, %219, %216
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #11
  br label %261

261:                                              ; preds = %260, %212
  %262 = load i64, ptr %20, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #11
  br label %263

263:                                              ; preds = %261, %155
  %264 = load i32, ptr %8, align 4, !tbaa !9
  %265 = and i32 %264, 4
  %266 = icmp ne i32 %265, 0
  br i1 %266, label %267, label %313

267:                                              ; preds = %263
  %268 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 7), align 4, !tbaa !25
  %269 = icmp uge i32 %268, 67371008
  br i1 %269, label %270, label %313

270:                                              ; preds = %267
  %271 = load ptr, ptr %6, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.MDBX_env, ptr %271, i32 0, i32 14
  %273 = call i32 @atomic_load32(ptr noundef %272, i32 noundef 1)
  %274 = load i32, ptr %18, align 4, !tbaa !9
  %275 = icmp ult i32 %273, %274
  br i1 %275, label %276, label %313

276:                                              ; preds = %270
  %277 = load ptr, ptr %6, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.MDBX_env, ptr %277, i32 0, i32 3
  %279 = getelementptr inbounds %struct.osal_mmap, ptr %278, i32 0, i32 0
  %280 = load ptr, ptr %279, align 8, !tbaa !18
  %281 = load i64, ptr %17, align 8, !tbaa !17
  %282 = call i32 @mlock2(ptr noundef %280, i64 noundef %281, i32 noundef 1) #11
  %283 = icmp ne i32 %282, 0
  br i1 %283, label %284, label %303

284:                                              ; preds = %276
  %285 = call ptr @__errno_location() #13
  %286 = load i32, ptr %285, align 4, !tbaa !9
  store i32 %286, ptr %19, align 4, !tbaa !9
  br label %287

287:                                              ; preds = %284
  %288 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !22
  %289 = zext i8 %288 to i32
  %290 = icmp sle i32 2, %289
  %291 = xor i1 %290, true
  %292 = xor i1 %291, true
  %293 = zext i1 %292 to i32
  %294 = sext i32 %293 to i64
  %295 = call i64 @llvm.expect.i64(i64 %294, i64 0)
  %296 = icmp ne i64 %295, 0
  br i1 %296, label %297, label %300

297:                                              ; preds = %287
  %298 = load i64, ptr %17, align 8, !tbaa !17
  %299 = load i32, ptr %19, align 4, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 228, ptr noundef @.str.4, i64 noundef %298, ptr noundef @.str.5, i32 noundef %299)
  br label %300

300:                                              ; preds = %297, %287
  br label %301

301:                                              ; preds = %300
  br label %302

302:                                              ; preds = %301
  br label %306

303:                                              ; preds = %276
  %304 = load ptr, ptr %6, align 8, !tbaa !5
  %305 = load i32, ptr %18, align 4, !tbaa !9
  call void @update_mlcnt(ptr noundef %304, i32 noundef %305, i1 noundef zeroext true)
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %306

306:                                              ; preds = %303, %302
  %307 = load i32, ptr %19, align 4, !tbaa !9
  %308 = icmp ne i32 %307, 22
  br i1 %308, label %309, label %312

309:                                              ; preds = %306
  %310 = load i32, ptr %8, align 4, !tbaa !9
  %311 = sub i32 %310, 4
  store i32 %311, ptr %8, align 4, !tbaa !9
  br label %312

312:                                              ; preds = %309, %306
  br label %313

313:                                              ; preds = %312, %270, %267, %263
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #11
  store i32 38, ptr %23, align 4, !tbaa !9
  %314 = load ptr, ptr %6, align 8, !tbaa !5
  %315 = load i32, ptr %14, align 4, !tbaa !9
  %316 = call i32 @dxb_set_readahead(ptr noundef %314, i32 noundef %315, i1 noundef zeroext true, i1 noundef zeroext true)
  store i32 %316, ptr %23, align 4, !tbaa !9
  %317 = load i32, ptr %23, align 4, !tbaa !9
  %318 = icmp ne i32 %317, 0
  br i1 %318, label %319, label %324

319:                                              ; preds = %313
  %320 = load i32, ptr %19, align 4, !tbaa !9
  %321 = icmp eq i32 %320, 0
  br i1 %321, label %322, label %324

322:                                              ; preds = %319
  %323 = load i32, ptr %23, align 4, !tbaa !9
  store i32 %323, ptr %19, align 4, !tbaa !9
  br label %324

324:                                              ; preds = %322, %319, %313
  %325 = load i32, ptr %8, align 4, !tbaa !9
  %326 = and i32 %325, 1
  %327 = icmp ne i32 %326, 0
  br i1 %327, label %328, label %454

328:                                              ; preds = %324
  %329 = load i32, ptr %19, align 4, !tbaa !9
  %330 = icmp eq i32 %329, 0
  br i1 %330, label %334, label %331

331:                                              ; preds = %328
  %332 = load i32, ptr %19, align 4, !tbaa !9
  %333 = icmp eq i32 %332, 38
  br i1 %333, label %334, label %454

334:                                              ; preds = %331, %328
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #11
  %335 = load ptr, ptr %6, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.MDBX_env, ptr %335, i32 0, i32 3
  %337 = getelementptr inbounds %struct.osal_mmap, ptr %336, i32 0, i32 0
  %338 = load ptr, ptr %337, align 8, !tbaa !18
  store ptr %338, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #11
  store i64 0, ptr %25, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #11
  store i64 42, ptr %26, align 8, !tbaa !17
  %339 = load i32, ptr %8, align 4, !tbaa !9
  %340 = and i32 %339, 2
  %341 = icmp ne i32 %340, 0
  br i1 %341, label %342, label %425

342:                                              ; preds = %334
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #11
  %343 = call i32 (ptr, i32, ...) @open64(ptr noundef @.str.6, i32 noundef 1)
  store i32 %343, ptr %27, align 4, !tbaa !9
  %344 = load i32, ptr %27, align 4, !tbaa !9
  %345 = icmp slt i32 %344, 0
  %346 = xor i1 %345, true
  %347 = xor i1 %346, true
  %348 = zext i1 %347 to i32
  %349 = sext i32 %348 to i64
  %350 = call i64 @llvm.expect.i64(i64 %349, i64 0)
  %351 = icmp ne i64 %350, 0
  br i1 %351, label %352, label %355

352:                                              ; preds = %342
  %353 = call ptr @__errno_location() #13
  %354 = load i32, ptr %353, align 4, !tbaa !9
  store i32 %354, ptr %19, align 4, !tbaa !9
  br label %424

355:                                              ; preds = %342
  call void @llvm.lifetime.start.p0(i64 1024, ptr %28) #11
  br label %356

356:                                              ; preds = %420, %355
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #11
  store i32 0, ptr %29, align 4, !tbaa !9
  br label %357

357:                                              ; preds = %382, %356
  %358 = load i32, ptr %29, align 4, !tbaa !9
  %359 = icmp ult i32 %358, 64
  br i1 %359, label %360, label %364

360:                                              ; preds = %357
  %361 = load i64, ptr %25, align 8, !tbaa !17
  %362 = load i64, ptr %17, align 8, !tbaa !17
  %363 = icmp ult i64 %361, %362
  br label %364

364:                                              ; preds = %360, %357
  %365 = phi i1 [ false, %357 ], [ %363, %360 ]
  br i1 %365, label %366, label %385

366:                                              ; preds = %364
  %367 = load ptr, ptr %24, align 8, !tbaa !5
  %368 = load i64, ptr %25, align 8, !tbaa !17
  %369 = getelementptr inbounds i8, ptr %367, i64 %368
  %370 = load i32, ptr %29, align 4, !tbaa !9
  %371 = zext i32 %370 to i64
  %372 = getelementptr inbounds [64 x %struct.iovec], ptr %28, i64 0, i64 %371
  %373 = getelementptr inbounds %struct.iovec, ptr %372, i32 0, i32 0
  store ptr %369, ptr %373, align 16, !tbaa !26
  %374 = load i32, ptr %29, align 4, !tbaa !9
  %375 = zext i32 %374 to i64
  %376 = getelementptr inbounds [64 x %struct.iovec], ptr %28, i64 0, i64 %375
  %377 = getelementptr inbounds %struct.iovec, ptr %376, i32 0, i32 1
  store i64 1, ptr %377, align 8, !tbaa !28
  %378 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !29
  %379 = zext i32 %378 to i64
  %380 = load i64, ptr %25, align 8, !tbaa !17
  %381 = add i64 %380, %379
  store i64 %381, ptr %25, align 8, !tbaa !17
  br label %382

382:                                              ; preds = %366
  %383 = load i32, ptr %29, align 4, !tbaa !9
  %384 = add i32 %383, 1
  store i32 %384, ptr %29, align 4, !tbaa !9
  br label %357, !llvm.loop !30

385:                                              ; preds = %364
  %386 = load i32, ptr %27, align 4, !tbaa !9
  %387 = getelementptr inbounds [64 x %struct.iovec], ptr %28, i64 0, i64 0
  %388 = load i32, ptr %29, align 4, !tbaa !9
  %389 = call i64 @writev(i32 noundef %386, ptr noundef %387, i32 noundef %388)
  %390 = icmp slt i64 %389, 0
  %391 = xor i1 %390, true
  %392 = xor i1 %391, true
  %393 = zext i1 %392 to i32
  %394 = sext i32 %393 to i64
  %395 = call i64 @llvm.expect.i64(i64 %394, i64 0)
  %396 = icmp ne i64 %395, 0
  br i1 %396, label %397, label %404

397:                                              ; preds = %385
  %398 = call ptr @__errno_location() #13
  %399 = load i32, ptr %398, align 4, !tbaa !9
  store i32 %399, ptr %19, align 4, !tbaa !9
  %400 = load i32, ptr %19, align 4, !tbaa !9
  %401 = icmp eq i32 %400, 14
  br i1 %401, label %402, label %403

402:                                              ; preds = %397
  store i32 12, ptr %19, align 4, !tbaa !9
  br label %403

403:                                              ; preds = %402, %397
  store i32 8, ptr %11, align 4
  br label %418

404:                                              ; preds = %385
  %405 = load i64, ptr %25, align 8, !tbaa !17
  %406 = load i64, ptr %17, align 8, !tbaa !17
  %407 = icmp uge i64 %405, %406
  br i1 %407, label %408, label %409

408:                                              ; preds = %404
  store i32 0, ptr %19, align 4, !tbaa !9
  store i32 8, ptr %11, align 4
  br label %418

409:                                              ; preds = %404
  %410 = load i32, ptr %9, align 4, !tbaa !9
  %411 = icmp ne i32 %410, 0
  br i1 %411, label %412, label %417

412:                                              ; preds = %409
  %413 = call i64 @osal_monotime()
  %414 = load i64, ptr %13, align 8, !tbaa !17
  %415 = icmp ugt i64 %413, %414
  br i1 %415, label %416, label %417

416:                                              ; preds = %412
  store i32 -1, ptr %19, align 4, !tbaa !9
  store i32 8, ptr %11, align 4
  br label %418

417:                                              ; preds = %412, %409
  store i32 0, ptr %11, align 4
  br label %418

418:                                              ; preds = %417, %416, %408, %403
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #11
  %419 = load i32, ptr %11, align 4
  switch i32 %419, label %506 [
    i32 0, label %420
    i32 8, label %421
  ]

420:                                              ; preds = %418
  br label %356

421:                                              ; preds = %418
  %422 = load i32, ptr %27, align 4, !tbaa !9
  %423 = call i32 @close(i32 noundef %422)
  call void @llvm.lifetime.end.p0(i64 1024, ptr %28) #11
  br label %424

424:                                              ; preds = %421, %352
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #11
  br label %452

425:                                              ; preds = %334
  br label %426

426:                                              ; preds = %450, %425
  %427 = load ptr, ptr %24, align 8, !tbaa !5
  %428 = load i64, ptr %25, align 8, !tbaa !17
  %429 = getelementptr inbounds i8, ptr %427, i64 %428
  %430 = load volatile i8, ptr %429, align 1, !tbaa !18
  %431 = zext i8 %430 to i64
  %432 = load i64, ptr %26, align 8, !tbaa !17
  %433 = add i64 %432, %431
  store i64 %433, ptr %26, align 8, !tbaa !17
  %434 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !29
  %435 = zext i32 %434 to i64
  %436 = load i64, ptr %25, align 8, !tbaa !17
  %437 = add i64 %436, %435
  store i64 %437, ptr %25, align 8, !tbaa !17
  %438 = load i64, ptr %25, align 8, !tbaa !17
  %439 = load i64, ptr %17, align 8, !tbaa !17
  %440 = icmp uge i64 %438, %439
  br i1 %440, label %441, label %442

441:                                              ; preds = %426
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %451

442:                                              ; preds = %426
  %443 = load i32, ptr %9, align 4, !tbaa !9
  %444 = icmp ne i32 %443, 0
  br i1 %444, label %445, label %450

445:                                              ; preds = %442
  %446 = call i64 @osal_monotime()
  %447 = load i64, ptr %13, align 8, !tbaa !17
  %448 = icmp ugt i64 %446, %447
  br i1 %448, label %449, label %450

449:                                              ; preds = %445
  store i32 -1, ptr %19, align 4, !tbaa !9
  br label %451

450:                                              ; preds = %445, %442
  br label %426

451:                                              ; preds = %449, %441
  br label %452

452:                                              ; preds = %451, %424
  %453 = load i64, ptr %26, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #11
  br label %454

454:                                              ; preds = %452, %331, %324
  %455 = load i32, ptr %8, align 4, !tbaa !9
  %456 = and i32 %455, 4
  %457 = icmp ne i32 %456, 0
  br i1 %457, label %458, label %501

458:                                              ; preds = %454
  %459 = load i32, ptr %19, align 4, !tbaa !9
  %460 = icmp eq i32 %459, 0
  br i1 %460, label %464, label %461

461:                                              ; preds = %458
  %462 = load i32, ptr %19, align 4, !tbaa !9
  %463 = icmp eq i32 %462, 38
  br i1 %463, label %464, label %501

464:                                              ; preds = %461, %458
  %465 = load ptr, ptr %6, align 8, !tbaa !5
  %466 = getelementptr inbounds %struct.MDBX_env, ptr %465, i32 0, i32 14
  %467 = call i32 @atomic_load32(ptr noundef %466, i32 noundef 1)
  %468 = load i32, ptr %18, align 4, !tbaa !9
  %469 = icmp ult i32 %467, %468
  br i1 %469, label %470, label %501

470:                                              ; preds = %464
  %471 = load ptr, ptr %6, align 8, !tbaa !5
  %472 = getelementptr inbounds %struct.MDBX_env, ptr %471, i32 0, i32 3
  %473 = getelementptr inbounds %struct.osal_mmap, ptr %472, i32 0, i32 0
  %474 = load ptr, ptr %473, align 8, !tbaa !18
  %475 = load i64, ptr %17, align 8, !tbaa !17
  %476 = call i32 @mlock(ptr noundef %474, i64 noundef %475) #11
  %477 = icmp eq i32 %476, 0
  br i1 %477, label %478, label %481

478:                                              ; preds = %470
  %479 = load ptr, ptr %6, align 8, !tbaa !5
  %480 = load i32, ptr %18, align 4, !tbaa !9
  call void @update_mlcnt(ptr noundef %479, i32 noundef %480, i1 noundef zeroext true)
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %500

481:                                              ; preds = %470
  %482 = call ptr @__errno_location() #13
  %483 = load i32, ptr %482, align 4, !tbaa !9
  store i32 %483, ptr %19, align 4, !tbaa !9
  br label %484

484:                                              ; preds = %481
  %485 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !22
  %486 = zext i8 %485 to i32
  %487 = icmp sle i32 2, %486
  %488 = xor i1 %487, true
  %489 = xor i1 %488, true
  %490 = zext i1 %489 to i32
  %491 = sext i32 %490 to i64
  %492 = call i64 @llvm.expect.i64(i64 %491, i64 0)
  %493 = icmp ne i64 %492, 0
  br i1 %493, label %494, label %497

494:                                              ; preds = %484
  %495 = load i64, ptr %17, align 8, !tbaa !17
  %496 = load i32, ptr %19, align 4, !tbaa !9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 310, ptr noundef @.str.7, ptr noundef @.str.8, i64 noundef %495, i32 noundef %496)
  br label %497

497:                                              ; preds = %494, %484
  br label %498

498:                                              ; preds = %497
  br label %499

499:                                              ; preds = %498
  br label %500

500:                                              ; preds = %499, %478
  br label %501

501:                                              ; preds = %500, %464, %461, %454
  %502 = load i32, ptr %19, align 4, !tbaa !9
  %503 = call i32 @log_if_error(i32 noundef %502, ptr noundef @__func__.mdbx_env_warmup, i32 noundef 317)
  store i32 %503, ptr %5, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #11
  br label %504

504:                                              ; preds = %501, %112, %74, %54, %43
  %505 = load i32, ptr %5, align 4
  ret i32 %505

506:                                              ; preds = %418, %112, %74
  unreachable
}

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

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

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

declare i64 @osal_monotime() #5

declare i64 @osal_16dot16_to_monotime(i32 noundef) #5

declare void @munlock_all(ptr noundef) #5

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @pgno_align2os_bytes(ptr noundef, i64 noundef) #6

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i32 @bytes2pgno(ptr noundef, i64 noundef) #7

; Function Attrs: nounwind uwtable
declare hidden i64 @estimate_rss(i64 noundef) #8

; Function Attrs: nounwind
declare i32 @getrlimit64(i32 noundef, ptr noundef) #9

; Function Attrs: nounwind
declare i32 @setrlimit64(i32 noundef, ptr noundef) #9

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #10

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

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

; Function Attrs: nounwind
declare i32 @mlock2(ptr noundef, i64 noundef, i32 noundef) #9

declare void @update_mlcnt(ptr noundef, i32 noundef, i1 noundef zeroext) #5

declare i32 @dxb_set_readahead(ptr noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) #5

declare i32 @open64(ptr noundef, i32 noundef, ...) #5

declare i64 @writev(i32 noundef, ptr noundef, i32 noundef) #5

declare i32 @close(i32 noundef) #5

; Function Attrs: nounwind
declare i32 @mlock(ptr noundef, i64 noundef) #9

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 80}
!12 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !16, i64 128, !6, i64 160, !7, i64 168}
!13 = !{!"long", !7, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!13, !13, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !13, i64 0}
!20 = !{!"rlimit", !13, i64 0, !13, i64 8}
!21 = !{!20, !13, i64 8}
!22 = !{!23, !7, i64 26}
!23 = !{!"libmdbx_globals", !7, i64 0, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !24, i64 27, !10, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!24 = !{!"_Bool", !7, i64 0}
!25 = !{!23, !10, i64 28}
!26 = !{!27, !6, i64 0}
!27 = !{!"iovec", !6, i64 0, !13, i64 8}
!28 = !{!27, !13, i64 8}
!29 = !{!23, !10, i64 16}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.16, i64 }
%union.anon.16 = type { ptr }
%struct.rlimit = type { i64, i64 }
%struct.iovec = type { ptr, i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@__func__.mdbx_env_warmup = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_env_warmup(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca %struct.troika, align 8
  %6 = alloca %struct.meta_ptr, align 8
  %7 = alloca %struct.rlimit, align 8
  %8 = alloca %struct.rlimit, align 8
  %9 = alloca [64 x %struct.iovec], align 16
  %10 = icmp eq ptr %0, null
  %11 = icmp eq ptr %1, null
  %12 = and i1 %10, %11
  br i1 %12, label %13, label %15, !prof !5

13:                                               ; preds = %4
  %14 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 138)
  br label %202

15:                                               ; preds = %4
  %16 = icmp ugt i32 %2, 31
  br i1 %16, label %17, label %19, !prof !5

17:                                               ; preds = %15
  %18 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 141)
  br label %202

19:                                               ; preds = %15
  br i1 %11, label %.thread, label %20

20:                                               ; preds = %19
  %21 = tail call i32 @check_txn(ptr noundef nonnull %1, i32 noundef 3)
  %.not143.not = icmp eq i32 %21, 0
  br i1 %.not143.not, label %.thread, label %22, !prof !6

22:                                               ; preds = %20
  %23 = tail call i32 @log_if_error(i32 noundef %21, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 146)
  br label %202

.thread:                                          ; preds = %20, %19
  br i1 %10, label %34, label %24

24:                                               ; preds = %.thread
  %25 = tail call i32 @check_env(ptr noundef nonnull %0, i1 noundef zeroext false)
  %.not145 = icmp eq i32 %25, 0
  br i1 %.not145, label %28, label %26, !prof !6

26:                                               ; preds = %24
  %27 = tail call i32 @log_if_error(i32 noundef %25, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 151)
  br label %202

28:                                               ; preds = %24
  br i1 %11, label %.thread174, label %29

29:                                               ; preds = %28
  %30 = getelementptr inbounds i8, ptr %1, i64 80
  %31 = load ptr, ptr %30, align 8, !tbaa !7
  %.not146 = icmp eq ptr %31, %0
  br i1 %.not146, label %.thread174, label %32, !prof !6

32:                                               ; preds = %29
  %33 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 153)
  br label %202

34:                                               ; preds = %.thread
  %35 = getelementptr inbounds i8, ptr %1, i64 80
  %36 = load ptr, ptr %35, align 8, !tbaa !7
  br label %.thread174

.thread174:                                       ; preds = %28, %29, %34
  %.0118 = phi ptr [ %36, %34 ], [ %0, %29 ], [ %0, %28 ]
  %.not147 = icmp eq i32 %3, 0
  %37 = and i32 %2, 1
  %.not148 = icmp eq i32 %37, 0
  %or.cond163 = or i1 %.not147, %.not148
  br i1 %or.cond163, label %42, label %38

38:                                               ; preds = %.thread174
  %39 = tail call i64 @osal_monotime() #11
  %40 = tail call i64 @osal_16dot16_to_monotime(i32 noundef %3) #11
  %41 = add i64 %40, %39
  br label %42

42:                                               ; preds = %.thread174, %38
  %43 = phi i64 [ %41, %38 ], [ 0, %.thread174 ]
  %.not149 = icmp ult i32 %2, 16
  br i1 %.not149, label %45, label %44

44:                                               ; preds = %42
  tail call void @munlock_all(ptr noundef %.0118) #11
  br label %45

45:                                               ; preds = %44, %42
  br i1 %11, label %49, label %46

46:                                               ; preds = %45
  %47 = getelementptr inbounds i8, ptr %1, i64 56
  %48 = load i32, ptr %47, align 8, !tbaa !17
  br label %54

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #11
  call void @meta_tap(ptr dead_on_unwind nonnull writable sret(%struct.troika) align 8 %5, ptr noundef %.0118) #11
  call void @meta_recent(ptr dead_on_unwind nonnull writable sret(%struct.meta_ptr) align 8 %6, ptr noundef %.0118, ptr noundef nonnull %5)
  %50 = getelementptr inbounds i8, ptr %6, i64 8
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = getelementptr inbounds i8, ptr %51, i64 36
  %53 = load volatile i32, ptr %52, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #11
  br label %54

54:                                               ; preds = %49, %46
  %.0127 = phi i32 [ %48, %46 ], [ %53, %49 ]
  %55 = zext i32 %.0127 to i64
  %56 = call i64 @pgno_align2os_bytes(ptr noundef %.0118, i64 noundef %55) #12
  %57 = call i32 @bytes2pgno(ptr noundef %.0118, i64 noundef %56) #12
  %58 = and i32 %2, 8
  %.not150 = icmp eq i32 %58, 0
  br i1 %.not150, label %._crit_edge204, label %59

._crit_edge204:                                   ; preds = %54
  %.pre205 = and i32 %2, 4
  br label %104

59:                                               ; preds = %54
  %60 = call i64 @estimate_rss(i64 noundef %56)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #11
  %61 = call i32 @getrlimit64(i32 noundef 5, ptr noundef nonnull %7) #11
  %62 = icmp eq i32 %61, 0
  %63 = load i64, ptr %7, align 8
  %64 = icmp ult i64 %63, %60
  %or.cond165 = select i1 %62, i1 %64, i1 false
  br i1 %or.cond165, label %65, label %80

65:                                               ; preds = %59
  store i64 %60, ptr %7, align 8, !tbaa !18
  %66 = getelementptr inbounds i8, ptr %7, i64 8
  %67 = load i64, ptr %66, align 8, !tbaa !20
  %68 = icmp ult i64 %67, %60
  br i1 %68, label %69, label %70

69:                                               ; preds = %65
  store i64 %60, ptr %66, align 8, !tbaa !20
  br label %70

70:                                               ; preds = %69, %65
  %71 = call i32 @setrlimit64(i32 noundef 5, ptr noundef nonnull %7) #11
  %.not151 = icmp eq i32 %71, 0
  br i1 %.not151, label %80, label %72

72:                                               ; preds = %70
  %73 = tail call ptr @__errno_location() #13
  %74 = load i32, ptr %73, align 4, !tbaa !21
  %75 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !22
  %76 = icmp ugt i8 %75, 1
  br i1 %76, label %77, label %80, !prof !5

77:                                               ; preds = %72
  %78 = load i64, ptr %7, align 8, !tbaa !18
  %79 = load i64, ptr %66, align 8, !tbaa !20
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 199, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i64 noundef %78, i64 noundef %79, i32 noundef %74) #11
  br label %80

80:                                               ; preds = %70, %77, %72, %59
  %.0120 = phi i32 [ %74, %77 ], [ %74, %72 ], [ 0, %70 ], [ 0, %59 ]
  %81 = and i32 %2, 4
  %.not152 = icmp eq i32 %81, 0
  br i1 %.not152, label %103, label %82

82:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #11
  %83 = call i32 @getrlimit64(i32 noundef 8, ptr noundef nonnull %8) #11
  %84 = icmp eq i32 %83, 0
  %85 = load i64, ptr %8, align 8
  %86 = icmp ult i64 %85, %60
  %or.cond167 = select i1 %84, i1 %86, i1 false
  br i1 %or.cond167, label %87, label %102

87:                                               ; preds = %82
  store i64 %60, ptr %8, align 8, !tbaa !18
  %88 = getelementptr inbounds i8, ptr %8, i64 8
  %89 = load i64, ptr %88, align 8, !tbaa !20
  %90 = icmp ult i64 %89, %60
  br i1 %90, label %91, label %92

91:                                               ; preds = %87
  store i64 %60, ptr %88, align 8, !tbaa !20
  br label %92

92:                                               ; preds = %91, %87
  %93 = call i32 @setrlimit64(i32 noundef 8, ptr noundef nonnull %8) #11
  %.not153 = icmp eq i32 %93, 0
  br i1 %.not153, label %102, label %94

94:                                               ; preds = %92
  %95 = tail call ptr @__errno_location() #13
  %96 = load i32, ptr %95, align 4, !tbaa !21
  %97 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !22
  %98 = icmp ugt i8 %97, 1
  br i1 %98, label %99, label %102, !prof !5

99:                                               ; preds = %94
  %100 = load i64, ptr %8, align 8, !tbaa !18
  %101 = load i64, ptr %88, align 8, !tbaa !20
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 213, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3, i64 noundef %100, i64 noundef %101, i32 noundef %96) #11
  br label %102

102:                                              ; preds = %92, %99, %94, %82
  %.1121 = phi i32 [ %96, %99 ], [ %96, %94 ], [ %.0120, %92 ], [ %.0120, %82 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #11
  br label %103

103:                                              ; preds = %102, %80
  %.2122 = phi i32 [ %.1121, %102 ], [ %.0120, %80 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #11
  br label %104

104:                                              ; preds = %._crit_edge204, %103
  %.pre-phi = phi i32 [ %.pre205, %._crit_edge204 ], [ %81, %103 ]
  %.3123 = phi i32 [ 0, %._crit_edge204 ], [ %.2122, %103 ]
  %105 = icmp ne i32 %.pre-phi, 0
  %106 = load i32, ptr getelementptr inbounds (i8, ptr @globals, i64 28), align 4
  %107 = icmp ugt i32 %106, 67371007
  %or.cond = select i1 %105, i1 %107, i1 false
  br i1 %or.cond, label %108, label %125

108:                                              ; preds = %104
  %109 = getelementptr inbounds i8, ptr %.0118, i64 124
  %110 = call i32 @atomic_load32(ptr noundef nonnull %109, i32 noundef 1)
  %111 = icmp ult i32 %110, %57
  br i1 %111, label %112, label %125

112:                                              ; preds = %108
  %113 = getelementptr inbounds i8, ptr %.0118, i64 16
  %114 = load ptr, ptr %113, align 8, !tbaa !17
  %115 = call i32 @mlock2(ptr noundef %114, i64 noundef %56, i32 noundef 1) #11
  %.not154 = icmp eq i32 %115, 0
  br i1 %.not154, label %.thread178, label %116

116:                                              ; preds = %112
  %117 = tail call ptr @__errno_location() #13
  %118 = load i32, ptr %117, align 4, !tbaa !21
  %.fr = freeze i32 %118
  %119 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !22
  %120 = icmp ugt i8 %119, 1
  br i1 %120, label %121, label %123, !prof !5

121:                                              ; preds = %116
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 228, ptr noundef nonnull @.str.4, i64 noundef %56, ptr noundef nonnull @.str.5, i32 noundef %.fr) #11
  br label %123

.thread178:                                       ; preds = %112
  call void @update_mlcnt(ptr noundef nonnull %.0118, i32 noundef %57, i1 noundef zeroext true) #11
  %122 = add nsw i32 %2, -4
  br label %125

123:                                              ; preds = %116, %121
  %.not155 = icmp eq i32 %.fr, 22
  %124 = add nsw i32 %2, -4
  %spec.select = select i1 %.not155, i32 %2, i32 %124
  br label %125

125:                                              ; preds = %123, %.thread178, %108, %104
  %.5 = phi i32 [ %.3123, %108 ], [ %.3123, %104 ], [ 0, %.thread178 ], [ %.fr, %123 ]
  %.0119 = phi i32 [ %2, %108 ], [ %2, %104 ], [ %122, %.thread178 ], [ %spec.select, %123 ]
  %126 = call i32 @dxb_set_readahead(ptr noundef %.0118, i32 noundef %.0127, i1 noundef zeroext true, i1 noundef zeroext true) #11
  %127 = icmp ne i32 %126, 0
  %128 = icmp eq i32 %.5, 0
  %or.cond3 = select i1 %127, i1 %128, i1 false
  %spec.select169 = select i1 %or.cond3, i32 %126, i32 %.5
  %129 = and i32 %.0119, 1
  %.not156 = icmp eq i32 %129, 0
  br i1 %.not156, label %.loopexit, label %130

130:                                              ; preds = %125
  switch i32 %spec.select169, label %.loopexit [
    i32 38, label %131
    i32 0, label %131
  ]

131:                                              ; preds = %130, %130
  %132 = getelementptr inbounds i8, ptr %.0118, i64 16
  %133 = load ptr, ptr %132, align 8, !tbaa !17
  %134 = and i32 %.0119, 2
  %.not157 = icmp eq i32 %134, 0
  br i1 %.not157, label %.preheader, label %138

.preheader:                                       ; preds = %131
  %135 = load volatile i8, ptr %133, align 1, !tbaa !17
  %136 = load i32, ptr getelementptr inbounds (i8, ptr @globals, i64 16), align 8, !tbaa !25
  %137 = zext i32 %136 to i64
  %.not158194 = icmp ugt i64 %56, %137
  br i1 %.not158194, label %.lr.ph195, label %.loopexit

138:                                              ; preds = %131
  %139 = call i32 (ptr, i32, ...) @open64(ptr noundef nonnull @.str.6, i32 noundef 1) #11
  %140 = icmp slt i32 %139, 0
  br i1 %140, label %141, label %144, !prof !5

141:                                              ; preds = %138
  %142 = tail call ptr @__errno_location() #13
  %143 = load i32, ptr %142, align 4, !tbaa !21
  br label %.loopexit

144:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %9) #11
  %.not = icmp eq i64 %56, 0
  br i1 %.not, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %144, %168
  %.0115217 = phi i64 [ %151, %168 ], [ 0, %144 ]
  %145 = load i32, ptr getelementptr inbounds (i8, ptr @globals, i64 16), align 8, !tbaa !25
  %146 = zext i32 %145 to i64
  br label %147

147:                                              ; preds = %.lr.ph, %147
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %147 ]
  %.1116190 = phi i64 [ %.0115217, %.lr.ph ], [ %151, %147 ]
  %148 = getelementptr inbounds i8, ptr %133, i64 %.1116190
  %149 = getelementptr inbounds [64 x %struct.iovec], ptr %9, i64 0, i64 %indvars.iv
  store ptr %148, ptr %149, align 16, !tbaa !26
  %150 = getelementptr inbounds i8, ptr %149, i64 8
  store i64 1, ptr %150, align 8, !tbaa !28
  %151 = add i64 %.1116190, %146
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %152 = icmp ult i64 %indvars.iv, 63
  %153 = icmp ult i64 %151, %56
  %154 = select i1 %152, i1 %153, i1 false
  br i1 %154, label %147, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %147
  %155 = trunc nuw nsw i64 %indvars.iv.next to i32
  %156 = call i64 @writev(i32 noundef %139, ptr noundef nonnull %9, i32 noundef %155) #11
  %157 = icmp slt i64 %156, 0
  br i1 %157, label %.loopexit214, label %163, !prof !5

._crit_edge.thread:                               ; preds = %168, %144
  %158 = call i64 @writev(i32 noundef %139, ptr noundef nonnull %9, i32 noundef 0) #11
  %159 = icmp slt i64 %158, 0
  br i1 %159, label %.loopexit214, label %.loopexit189, !prof !5

.loopexit214:                                     ; preds = %._crit_edge, %._crit_edge.thread
  %160 = tail call ptr @__errno_location() #13
  %161 = load i32, ptr %160, align 4, !tbaa !21
  %162 = icmp eq i32 %161, 14
  %spec.store.select = select i1 %162, i32 12, i32 %161
  br label %.loopexit189

163:                                              ; preds = %._crit_edge
  br i1 %153, label %164, label %.loopexit189

164:                                              ; preds = %163
  br i1 %.not147, label %168, label %165

165:                                              ; preds = %164
  %166 = call i64 @osal_monotime() #11
  %167 = icmp ugt i64 %166, %43
  br i1 %167, label %.loopexit189, label %168

168:                                              ; preds = %164, %165
  %169 = icmp ult i64 %151, %56
  br i1 %169, label %.lr.ph, label %._crit_edge.thread

.loopexit189:                                     ; preds = %163, %165, %._crit_edge.thread, %.loopexit214
  %.8.ph = phi i32 [ %spec.store.select, %.loopexit214 ], [ 0, %._crit_edge.thread ], [ 0, %163 ], [ -1, %165 ]
  %170 = call i32 @close(i32 noundef %139) #11
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %9) #11
  br label %.loopexit

.lr.ph195:                                        ; preds = %.preheader, %176
  %171 = phi i32 [ %177, %176 ], [ %136, %.preheader ]
  %172 = phi i64 [ %181, %176 ], [ %137, %.preheader ]
  br i1 %.not147, label %176, label %173

173:                                              ; preds = %.lr.ph195
  %174 = call i64 @osal_monotime() #11
  %175 = icmp ugt i64 %174, %43
  br i1 %175, label %.loopexit, label %._crit_edge203

._crit_edge203:                                   ; preds = %173
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @globals, i64 16), align 8, !tbaa !25
  br label %176

176:                                              ; preds = %._crit_edge203, %.lr.ph195
  %177 = phi i32 [ %.pre, %._crit_edge203 ], [ %171, %.lr.ph195 ]
  %178 = getelementptr inbounds i8, ptr %133, i64 %172
  %179 = load volatile i8, ptr %178, align 1, !tbaa !17
  %180 = zext i32 %177 to i64
  %181 = add i64 %172, %180
  %.not158 = icmp ult i64 %181, %56
  br i1 %.not158, label %.lr.ph195, label %.loopexit

.loopexit:                                        ; preds = %173, %176, %.preheader, %.loopexit189, %141, %130, %125
  %.11 = phi i32 [ %spec.select169, %130 ], [ %spec.select169, %125 ], [ %143, %141 ], [ %.8.ph, %.loopexit189 ], [ 0, %.preheader ], [ -1, %173 ], [ 0, %176 ]
  %182 = and i32 %.0119, 4
  %.not160 = icmp eq i32 %182, 0
  br i1 %.not160, label %200, label %183

183:                                              ; preds = %.loopexit
  switch i32 %.11, label %200 [
    i32 38, label %184
    i32 0, label %184
  ]

184:                                              ; preds = %183, %183
  %185 = getelementptr inbounds i8, ptr %.0118, i64 124
  %186 = call i32 @atomic_load32(ptr noundef nonnull %185, i32 noundef 1)
  %187 = icmp ult i32 %186, %57
  br i1 %187, label %188, label %200

188:                                              ; preds = %184
  %189 = getelementptr inbounds i8, ptr %.0118, i64 16
  %190 = load ptr, ptr %189, align 8, !tbaa !17
  %191 = call i32 @mlock(ptr noundef %190, i64 noundef %56) #11
  %192 = icmp eq i32 %191, 0
  br i1 %192, label %193, label %194

193:                                              ; preds = %188
  call void @update_mlcnt(ptr noundef nonnull %.0118, i32 noundef %57, i1 noundef zeroext true) #11
  br label %200

194:                                              ; preds = %188
  %195 = tail call ptr @__errno_location() #13
  %196 = load i32, ptr %195, align 4, !tbaa !21
  %197 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !22
  %198 = icmp ugt i8 %197, 1
  br i1 %198, label %199, label %200, !prof !5

199:                                              ; preds = %194
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 2, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 310, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, i64 noundef %56, i32 noundef %196) #11
  br label %200

200:                                              ; preds = %183, %193, %199, %194, %184, %.loopexit
  %.12 = phi i32 [ 0, %193 ], [ %196, %199 ], [ %196, %194 ], [ %.11, %184 ], [ %.11, %183 ], [ %.11, %.loopexit ]
  %201 = call i32 @log_if_error(i32 noundef %.12, ptr noundef nonnull @__func__.mdbx_env_warmup, i32 noundef 317)
  br label %202

202:                                              ; preds = %26, %32, %22, %200, %17, %13
  %.3 = phi i32 [ %14, %13 ], [ %18, %17 ], [ %23, %22 ], [ %201, %200 ], [ %27, %26 ], [ %33, %32 ]
  ret i32 %.3
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr 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 #2

declare i64 @osal_monotime() local_unnamed_addr #4

declare i64 @osal_16dot16_to_monotime(i32 noundef) local_unnamed_addr #4

declare void @munlock_all(ptr noundef) local_unnamed_addr #4

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i64 @pgno_align2os_bytes(ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i32 @bytes2pgno(ptr noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare hidden i64 @estimate_rss(i64 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @getrlimit64(i32 noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: nounwind
declare i32 @setrlimit64(i32 noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #9

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

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

; Function Attrs: nounwind
declare i32 @mlock2(ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #8

declare void @update_mlcnt(ptr noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #4

declare i32 @dxb_set_readahead(ptr noundef, i32 noundef, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: nofree
declare noundef i32 @open64(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #10

declare i64 @writev(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @close(i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @mlock(ptr noundef, i64 noundef) local_unnamed_addr #8

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!7 = !{!8, !13, i64 80}
!8 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !12, i64 8, !12, i64 16, !13, i64 24, !13, i64 32, !14, i64 40, !12, i64 64, !12, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !16, i64 128, !13, i64 160, !10, i64 168}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !9, i64 4, !9, i64 8, !10, i64 12, !10, i64 16}
!15 = !{!"short", !10, i64 0}
!16 = !{!"MDBX_canary", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!17 = !{!10, !10, i64 0}
!18 = !{!19, !12, i64 0}
!19 = !{!"rlimit", !12, i64 0, !12, i64 8}
!20 = !{!19, !12, i64 8}
!21 = !{!9, !9, i64 0}
!22 = !{!23, !10, i64 26}
!23 = !{!"libmdbx_globals", !10, i64 0, !9, i64 16, !9, i64 20, !10, i64 24, !10, i64 25, !10, i64 26, !24, i64 27, !9, i64 28, !10, i64 32, !10, i64 40, !12, i64 80, !13, i64 88}
!24 = !{!"_Bool", !10, i64 0}
!25 = !{!23, !9, i64 16}
!26 = !{!27, !13, i64 0}
!27 = !{!"iovec", !13, i64 0, !12, i64 8}
!28 = !{!27, !12, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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