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

; 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.16 }
%struct.anon.16 = 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.cursor_couple = type { %struct.MDBX_cursor, ptr, %struct.inner_cursor }
%struct.MDBX_cursor = type { i32, %union.anon, i8, i8, ptr, ptr, ptr, ptr, ptr, [32 x ptr], [32 x i16], ptr, ptr }
%union.anon = type { i16 }
%struct.inner_cursor = type { %struct.MDBX_cursor, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%struct.iovec = type { ptr, i64 }
%struct.MDBX_stat = type { i32, i32, i64, i64, i64, i64, 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.2 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.0, %union.anon.1 }
%union.anon.0 = type { i32 }
%union.anon.1 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.2 = type { %struct.anon.4 }
%struct.anon.4 = type { %struct.troika, ptr, %struct.anon.5, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.6 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.5 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.6 = type { %struct.anon.7 }
%struct.anon.7 = type { i64, ptr }
%struct.anon = type { i8, i8 }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.9, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.10, %struct.anon.14, i8, ptr, ptr, ptr, %struct.anon.15, %union.pthread_mutex_t, i32, i32, ptr, %struct.osal_ioring, %union.pthread_mutex_t, [71 x %union.mdbx_atomic_uint64_t] }
%struct.osal_mmap = type { %union.anon.8, i32, i64, i64, i64 }
%union.anon.8 = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.9 = type { ptr, ptr, ptr, ptr }
%struct.anon.10 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.11, %union.anon.12 }
%struct.anon.11 = type { i16, i16, i16, i16 }
%union.anon.12 = type { i32 }
%struct.anon.14 = type { i64, i64, i64, i64, i64 }
%struct.anon.15 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.kvx = type { %struct.clc2, %struct.iovec }
%struct.clc2 = type { %struct.clc, %struct.clc }
%struct.clc = type { ptr, i64, i64 }

@globals = external global %struct.libmdbx_globals, align 8
@__func__.mdbx_enumerate_tables = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

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

declare i32 @cursor_init(ptr noundef, ptr noundef, i64 noundef) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

; Function Attrs: nounwind uwtable
declare hidden void @stat_get(ptr noundef, ptr noundef, i64 noundef) #6

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_enumerate_tables(ptr noundef %0, ptr noundef %1, ptr noundef %2) #7 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.cursor_couple, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.tree, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %struct.iovec, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca %struct.MDBX_stat, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  %21 = xor i1 %20, true
  %22 = xor i1 %21, true
  %23 = xor i1 %22, true
  %24 = zext i1 %23 to i32
  %25 = sext i32 %24 to i64
  %26 = call i64 @llvm.expect.i64(i64 %25, i64 0)
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %3
  %29 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_enumerate_tables, i32 noundef 263)
  store i32 %29, ptr %4, align 4
  br label %238

30:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call i32 @check_txn(ptr noundef %31, i32 noundef 51)
  store i32 %32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  %35 = xor i1 %34, true
  %36 = xor i1 %35, true
  %37 = zext i1 %36 to i32
  %38 = sext i32 %37 to i64
  %39 = call i64 @llvm.expect.i64(i64 %38, i64 0)
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %30
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = call i32 @log_if_error(i32 noundef %42, ptr noundef @__func__.mdbx_enumerate_tables, i32 noundef 267)
  store i32 %43, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %237

44:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 824, ptr %10) #9
  %45 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = call i32 @cursor_init(ptr noundef %45, ptr noundef %46, i64 noundef 1)
  store i32 %47, ptr %8, align 4, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 0
  %50 = xor i1 %49, true
  %51 = xor i1 %50, true
  %52 = zext i1 %51 to i32
  %53 = sext i32 %52 to i64
  %54 = call i64 @llvm.expect.i64(i64 %53, i64 0)
  %55 = icmp ne i64 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %44
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = call i32 @log_if_error(i32 noundef %57, ptr noundef @__func__.mdbx_enumerate_tables, i32 noundef 272)
  store i32 %58, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %236

59:                                               ; preds = %44
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.MDBX_txn, ptr %60, i32 0, i32 14
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds ptr, ptr %62, i64 1
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %66 = getelementptr inbounds %struct.MDBX_cursor, ptr %65, i32 0, i32 11
  store ptr %64, ptr %66, align 8, !tbaa !17
  %67 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.MDBX_txn, ptr %68, i32 0, i32 14
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds ptr, ptr %70, i64 1
  store ptr %67, ptr %71, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %73 = call i32 @outer_first(ptr noundef %72, ptr noundef null, ptr noundef null)
  store i32 %73, ptr %8, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %215, %59
  %75 = load i32, ptr %8, align 4, !tbaa !9
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %218

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %78 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %79 = getelementptr inbounds %struct.MDBX_cursor, ptr %78, i32 0, i32 9
  %80 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %81 = getelementptr inbounds %struct.MDBX_cursor, ptr %80, i32 0, i32 1
  %82 = getelementptr inbounds %struct.anon, ptr %81, i32 0, i32 1
  %83 = load i8, ptr %82, align 1, !tbaa !22
  %84 = sext i8 %83 to i64
  %85 = getelementptr inbounds [32 x ptr], ptr %79, i64 0, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %88 = getelementptr inbounds %struct.MDBX_cursor, ptr %87, i32 0, i32 10
  %89 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %90 = getelementptr inbounds %struct.MDBX_cursor, ptr %89, i32 0, i32 1
  %91 = getelementptr inbounds %struct.anon, ptr %90, i32 0, i32 1
  %92 = load i8, ptr %91, align 1, !tbaa !22
  %93 = sext i8 %92 to i64
  %94 = getelementptr inbounds [32 x i16], ptr %88, i64 0, i64 %93
  %95 = load i16, ptr %94, align 2, !tbaa !23
  %96 = zext i16 %95 to i64
  %97 = call ptr @page_node(ptr noundef %86, i64 noundef %96) #10
  store ptr %97, ptr %11, align 8, !tbaa !5
  %98 = load ptr, ptr %11, align 8, !tbaa !5
  %99 = call zeroext i8 @node_flags(ptr noundef %98) #10
  %100 = zext i8 %99 to i32
  %101 = icmp ne i32 %100, 2
  br i1 %101, label %102, label %103

102:                                              ; preds = %77
  store i32 4, ptr %9, align 4
  br label %212

103:                                              ; preds = %77
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = call i64 @node_ds(ptr noundef %104) #10
  %106 = icmp ne i64 %105, 48
  %107 = xor i1 %106, true
  %108 = xor i1 %107, true
  %109 = zext i1 %108 to i32
  %110 = sext i32 %109 to i64
  %111 = call i64 @llvm.expect.i64(i64 %110, i64 0)
  %112 = icmp ne i64 %111, 0
  br i1 %112, label %113, label %131

113:                                              ; preds = %103
  br label %114

114:                                              ; preds = %113
  %115 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !24
  %116 = zext i8 %115 to i32
  %117 = icmp sle i32 1, %116
  %118 = xor i1 %117, true
  %119 = xor i1 %118, true
  %120 = zext i1 %119 to i32
  %121 = sext i32 %120 to i64
  %122 = call i64 @llvm.expect.i64(i64 %121, i64 0)
  %123 = icmp ne i64 %122, 0
  br i1 %123, label %124, label %128

124:                                              ; preds = %114
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = call i64 @node_ds(ptr noundef %125) #10
  %127 = trunc i64 %126 to i32
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_enumerate_tables, i32 noundef 283, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef -30796, ptr noundef @.str.4, i32 noundef %127)
  br label %128

128:                                              ; preds = %124, %114
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  store i32 -30796, ptr %8, align 4, !tbaa !9
  store i32 2, ptr %9, align 4
  br label %212

131:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = call ptr @node_data(ptr noundef %132) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 1 %133, i64 48, i1 false)
  store ptr %12, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #9
  %134 = getelementptr inbounds %struct.iovec, ptr %14, i32 0, i32 0
  %135 = load ptr, ptr %11, align 8, !tbaa !5
  %136 = call ptr @node_key(ptr noundef %135) #10
  store ptr %136, ptr %134, align 8, !tbaa !27
  %137 = getelementptr inbounds %struct.iovec, ptr %14, i32 0, i32 1
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = call i64 @node_ks(ptr noundef %138) #10
  store i64 %139, ptr %137, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.MDBX_txn, ptr %140, i32 0, i32 9
  %142 = load ptr, ptr %141, align 8, !tbaa !30
  store ptr %142, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  store i64 2, ptr %17, align 8, !tbaa !31
  br label %143

143:                                              ; preds = %192, %131
  %144 = load i64, ptr %17, align 8, !tbaa !31
  %145 = load ptr, ptr %15, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.MDBX_env, ptr %145, i32 0, i32 42
  %147 = load i32, ptr %146, align 8, !tbaa !32
  %148 = zext i32 %147 to i64
  %149 = icmp ult i64 %144, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %143
  store i32 7, ptr %9, align 4
  br label %195

151:                                              ; preds = %143
  %152 = load i64, ptr %17, align 8, !tbaa !31
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.MDBX_txn, ptr %153, i32 0, i32 2
  %155 = load i64, ptr %154, align 8, !tbaa !41
  %156 = icmp uge i64 %152, %155
  br i1 %156, label %167, label %157

157:                                              ; preds = %151
  %158 = load ptr, ptr %15, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.MDBX_env, ptr %158, i32 0, i32 26
  %160 = load ptr, ptr %159, align 8, !tbaa !42
  %161 = load i64, ptr %17, align 8, !tbaa !31
  %162 = getelementptr inbounds i8, ptr %160, i64 %161
  %163 = load i8, ptr %162, align 1, !tbaa !22
  %164 = zext i8 %163 to i32
  %165 = and i32 %164, 128
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %168, label %167

167:                                              ; preds = %157, %151
  br label %192

168:                                              ; preds = %157
  %169 = load ptr, ptr %15, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.MDBX_env, ptr %169, i32 0, i32 25
  %171 = load ptr, ptr %170, align 8, !tbaa !43
  %172 = getelementptr inbounds %struct.kvx, ptr %171, i64 1
  %173 = getelementptr inbounds %struct.kvx, ptr %172, i32 0, i32 0
  %174 = getelementptr inbounds %struct.clc2, ptr %173, i32 0, i32 0
  %175 = getelementptr inbounds %struct.clc, ptr %174, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8, !tbaa !44
  %177 = load ptr, ptr %15, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.MDBX_env, ptr %177, i32 0, i32 25
  %179 = load ptr, ptr %178, align 8, !tbaa !43
  %180 = load i64, ptr %17, align 8, !tbaa !31
  %181 = getelementptr inbounds %struct.kvx, ptr %179, i64 %180
  %182 = getelementptr inbounds %struct.kvx, ptr %181, i32 0, i32 1
  %183 = call i32 %176(ptr noundef %14, ptr noundef %182)
  %184 = icmp ne i32 %183, 0
  br i1 %184, label %185, label %186

185:                                              ; preds = %168
  br label %192

186:                                              ; preds = %168
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = load i64, ptr %17, align 8, !tbaa !31
  %189 = call ptr @dbi_dig(ptr noundef %187, i64 noundef %188, ptr noundef %12)
  store ptr %189, ptr %13, align 8, !tbaa !5
  %190 = load i64, ptr %17, align 8, !tbaa !31
  %191 = trunc i64 %190 to i32
  store i32 %191, ptr %16, align 4, !tbaa !9
  store i32 7, ptr %9, align 4
  br label %195

192:                                              ; preds = %185, %167
  %193 = load i64, ptr %17, align 8, !tbaa !31
  %194 = add i64 %193, 1
  store i64 %194, ptr %17, align 8, !tbaa !31
  br label %143, !llvm.loop !48

195:                                              ; preds = %186, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %196

196:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #9
  %197 = load ptr, ptr %13, align 8, !tbaa !5
  call void @stat_get(ptr noundef %197, ptr noundef %18, i64 noundef 48)
  %198 = load ptr, ptr %6, align 8, !tbaa !5
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = load ptr, ptr %13, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.tree, ptr %201, i32 0, i32 0
  %203 = load i16, ptr %202, align 4, !tbaa !50
  %204 = zext i16 %203 to i32
  %205 = load i32, ptr %16, align 4, !tbaa !9
  %206 = call i32 %198(ptr noundef %199, ptr noundef %200, ptr noundef %14, i32 noundef %204, ptr noundef %18, i32 noundef %205)
  store i32 %206, ptr %8, align 4, !tbaa !9
  %207 = load i32, ptr %8, align 4, !tbaa !9
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %210

209:                                              ; preds = %196
  store i32 10, ptr %9, align 4
  br label %211

210:                                              ; preds = %196
  store i32 0, ptr %9, align 4
  br label %211

211:                                              ; preds = %210, %209
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #9
  br label %212

212:                                              ; preds = %211, %130, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  %213 = load i32, ptr %9, align 4
  switch i32 %213, label %236 [
    i32 0, label %214
    i32 4, label %215
    i32 2, label %218
    i32 10, label %226
  ]

214:                                              ; preds = %212
  br label %215

215:                                              ; preds = %214, %212
  %216 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %217 = call i32 @outer_next(ptr noundef %216, ptr noundef null, ptr noundef null, i32 noundef 11)
  store i32 %217, ptr %8, align 4, !tbaa !9
  br label %74, !llvm.loop !51

218:                                              ; preds = %212, %74
  %219 = load i32, ptr %8, align 4, !tbaa !9
  %220 = icmp eq i32 %219, -30798
  br i1 %220, label %221, label %222

221:                                              ; preds = %218
  br label %224

222:                                              ; preds = %218
  %223 = load i32, ptr %8, align 4, !tbaa !9
  br label %224

224:                                              ; preds = %222, %221
  %225 = phi i32 [ 0, %221 ], [ %223, %222 ]
  store i32 %225, ptr %8, align 4, !tbaa !9
  br label %226

226:                                              ; preds = %224, %212
  %227 = getelementptr inbounds %struct.cursor_couple, ptr %10, i32 0, i32 0
  %228 = getelementptr inbounds %struct.MDBX_cursor, ptr %227, i32 0, i32 11
  %229 = load ptr, ptr %228, align 8, !tbaa !17
  %230 = load ptr, ptr %5, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.MDBX_txn, ptr %230, i32 0, i32 14
  %232 = load ptr, ptr %231, align 8, !tbaa !11
  %233 = getelementptr inbounds ptr, ptr %232, i64 1
  store ptr %229, ptr %233, align 8, !tbaa !5
  %234 = load i32, ptr %8, align 4, !tbaa !9
  %235 = call i32 @log_if_error(i32 noundef %234, ptr noundef @__func__.mdbx_enumerate_tables, i32 noundef 314)
  store i32 %235, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %236

236:                                              ; preds = %226, %212, %56
  call void @llvm.lifetime.end.p0(i64 824, ptr %10) #9
  br label %237

237:                                              ; preds = %236, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %238

238:                                              ; preds = %237, %28
  %239 = load i32, ptr %4, align 4
  ret i32 %239
}

declare i32 @outer_first(ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden zeroext i8 @node_flags(ptr noalias noundef) #8

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @node_ds(ptr noalias noundef) #8

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden ptr @node_data(ptr noalias noundef) #8

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden ptr @node_key(ptr noalias noundef) #8

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @node_ks(ptr noalias noundef) #8

declare ptr @dbi_dig(ptr noundef, i64 noundef, ptr noundef) #3

declare i32 @outer_next(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

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

!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 120}
!12 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !16, i64 128, !6, i64 160, !7, i64 168}
!13 = !{!"long", !7, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!18, !6, i64 368}
!18 = !{!"cursor_couple", !19, i64 0, !6, i64 384, !20, i64 392}
!19 = !{!"MDBX_cursor", !10, i64 0, !7, i64 4, !7, i64 6, !7, i64 7, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !7, i64 48, !7, i64 304, !6, i64 368, !6, i64 376}
!20 = !{!"inner_cursor", !19, i64 0, !21, i64 384}
!21 = !{!"tree", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !13, i64 32, !13, i64 40}
!22 = !{!7, !7, i64 0}
!23 = !{!15, !15, i64 0}
!24 = !{!25, !7, i64 26}
!25 = !{!"libmdbx_globals", !7, i64 0, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !26, i64 27, !10, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!26 = !{!"_Bool", !7, i64 0}
!27 = !{!28, !6, i64 0}
!28 = !{!"iovec", !6, i64 0, !13, i64 8}
!29 = !{!28, !13, i64 8}
!30 = !{!12, !6, i64 80}
!31 = !{!13, !13, i64 0}
!32 = !{!33, !10, i64 440}
!33 = !{!"MDBX_env", !7, i64 0, !10, i64 4, !10, i64 8, !34, i64 16, !10, i64 56, !10, i64 60, !34, i64 64, !6, i64 104, !15, i64 112, !15, i64 114, !15, i64 116, !15, i64 118, !15, i64 120, !15, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !15, i64 130, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !35, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !13, i64 256, !36, i64 264, !38, i64 320, !26, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !39, i64 392, !7, i64 400, !10, i64 440, !10, i64 444, !6, i64 448, !40, i64 456, !7, i64 496, !7, i64 536}
!34 = !{!"osal_mmap", !7, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!35 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!36 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !13, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !10, i64 28, !10, i64 32, !26, i64 36, !26, i64 37, !26, i64 38, !37, i64 40, !7, i64 48}
!37 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6}
!38 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!39 = !{!"", !13, i64 0}
!40 = !{!"osal_ioring", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!41 = !{!12, !13, i64 8}
!42 = !{!33, !6, i64 208}
!43 = !{!33, !6, i64 200}
!44 = !{!45, !6, i64 0}
!45 = !{!"kvx", !46, i64 0, !28, i64 48}
!46 = !{!"clc2", !47, i64 0, !47, i64 24}
!47 = !{!"clc", !6, i64 0, !13, i64 8, !13, i64 16}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}
!50 = !{!21, !15, i64 0}
!51 = distinct !{!51, !49}


; 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.16 }
%struct.anon.16 = 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.cursor_couple = type { %struct.MDBX_cursor, ptr, %struct.inner_cursor }
%struct.MDBX_cursor = type { i32, %union.anon, i8, i8, ptr, ptr, ptr, ptr, ptr, [32 x ptr], [32 x i16], ptr, ptr }
%union.anon = type { i16 }
%struct.inner_cursor = type { %struct.MDBX_cursor, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%struct.iovec = type { ptr, i64 }
%struct.MDBX_stat = type { i32, i32, i64, i64, i64, i64, i64 }
%struct.kvx = type { %struct.clc2, %struct.iovec }
%struct.clc2 = type { %struct.clc, %struct.clc }
%struct.clc = type { ptr, i64, i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@__func__.mdbx_enumerate_tables = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

declare i32 @cursor_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; Function Attrs: nounwind uwtable
declare hidden void @stat_get(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: cold nounwind optsize uwtable
define dso_local i32 @mdbx_enumerate_tables(ptr noundef %0, ptr noundef readonly %1, ptr noundef %2) local_unnamed_addr #6 {
  %4 = alloca %struct.cursor_couple, align 8
  %5 = alloca %struct.tree, align 4
  %6 = alloca %struct.iovec, align 8
  %7 = alloca %struct.MDBX_stat, align 8
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %8, label %10, !prof !5

8:                                                ; preds = %3
  %9 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_enumerate_tables, i32 noundef 263)
  br label %89

10:                                               ; preds = %3
  %11 = tail call i32 @check_txn(ptr noundef %0, i32 noundef 51)
  %.not53 = icmp eq i32 %11, 0
  br i1 %.not53, label %14, label %12, !prof !6

12:                                               ; preds = %10
  %13 = tail call i32 @log_if_error(i32 noundef %11, ptr noundef nonnull @__func__.mdbx_enumerate_tables, i32 noundef 267)
  br label %89

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 824, ptr nonnull %4) #8
  %15 = call i32 @cursor_init(ptr noundef nonnull %4, ptr noundef %0, i64 noundef 1) #8
  %.not54 = icmp eq i32 %15, 0
  br i1 %.not54, label %18, label %16, !prof !6

16:                                               ; preds = %14
  %17 = call i32 @log_if_error(i32 noundef %15, ptr noundef nonnull @__func__.mdbx_enumerate_tables, i32 noundef 272)
  br label %.loopexit62

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 120
  %20 = load ptr, ptr %19, align 8, !tbaa !7
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %4, i64 368
  store ptr %22, ptr %23, align 8, !tbaa !18
  store ptr %4, ptr %21, align 8, !tbaa !17
  %24 = call i32 @outer_first(ptr noundef nonnull %4, ptr noundef null, ptr noundef null) #8
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %.lr.ph67, label %._crit_edge

.lr.ph67:                                         ; preds = %18
  %26 = getelementptr inbounds i8, ptr %4, i64 48
  %27 = getelementptr inbounds i8, ptr %4, i64 5
  %28 = getelementptr inbounds i8, ptr %4, i64 304
  %29 = getelementptr inbounds i8, ptr %6, i64 8
  %30 = getelementptr inbounds i8, ptr %0, i64 80
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  br label %32

32:                                               ; preds = %.lr.ph67, %select.unfold
  %33 = load i8, ptr %27, align 1, !tbaa !23
  %34 = sext i8 %33 to i64
  %35 = getelementptr inbounds [32 x ptr], ptr %26, i64 0, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !17
  %37 = getelementptr inbounds [32 x i16], ptr %28, i64 0, i64 %34
  %38 = load i16, ptr %37, align 2, !tbaa !24
  %39 = zext i16 %38 to i64
  %40 = call ptr @page_node(ptr noundef %36, i64 noundef %39) #9
  %41 = call zeroext i8 @node_flags(ptr noundef %40) #9
  %.not55 = icmp eq i8 %41, 2
  br i1 %.not55, label %42, label %select.unfold

42:                                               ; preds = %32
  %43 = call i64 @node_ds(ptr noundef %40) #9
  %.not56 = icmp eq i64 %43, 48
  br i1 %.not56, label %48, label %44, !prof !6

44:                                               ; preds = %42
  %45 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !25
  %.not61 = icmp eq i8 %45, 0
  br i1 %.not61, label %.loopexit63, label %46, !prof !6

46:                                               ; preds = %44
  %47 = trunc i64 %43 to i32
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_enumerate_tables, i32 noundef 283, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef -30796, ptr noundef nonnull @.str.4, i32 noundef %47) #8
  br label %.loopexit63

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #8
  %49 = call ptr @node_data(ptr noundef %40) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(48) %5, ptr noundef nonnull align 1 dereferenceable(48) %49, i64 48, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #8
  %50 = call ptr @node_key(ptr noundef %40) #9
  store ptr %50, ptr %6, align 8, !tbaa !28
  %51 = call i64 @node_ks(ptr noundef %40) #9
  store i64 %51, ptr %29, align 8, !tbaa !30
  %52 = load ptr, ptr %30, align 8, !tbaa !31
  %53 = getelementptr inbounds i8, ptr %52, i64 440
  %54 = load i32, ptr %53, align 8, !tbaa !32
  %55 = icmp ugt i32 %54, 2
  br i1 %55, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %48
  %56 = getelementptr inbounds i8, ptr %52, i64 208
  %57 = getelementptr inbounds i8, ptr %52, i64 200
  br label %58

58:                                               ; preds = %.lr.ph, %74
  %59 = phi i32 [ %54, %.lr.ph ], [ %75, %74 ]
  %.066 = phi i64 [ 2, %.lr.ph ], [ %76, %74 ]
  %60 = load i64, ptr %31, align 8, !tbaa !41
  %.not57 = icmp ult i64 %.066, %60
  br i1 %.not57, label %61, label %74

61:                                               ; preds = %58
  %62 = load ptr, ptr %56, align 8, !tbaa !42
  %63 = getelementptr inbounds i8, ptr %62, i64 %.066
  %64 = load i8, ptr %63, align 1, !tbaa !23
  %.not58 = icmp sgt i8 %64, -1
  br i1 %.not58, label %74, label %65

65:                                               ; preds = %61
  %66 = load ptr, ptr %57, align 8, !tbaa !43
  %67 = getelementptr inbounds i8, ptr %66, i64 64
  %68 = load ptr, ptr %67, align 8, !tbaa !44
  %69 = getelementptr inbounds %struct.kvx, ptr %66, i64 %.066, i32 1
  %70 = call i32 %68(ptr noundef nonnull %6, ptr noundef nonnull %69) #8
  %.not59 = icmp eq i32 %70, 0
  br i1 %.not59, label %71, label %._crit_edge73

._crit_edge73:                                    ; preds = %65
  %.pre = load i32, ptr %53, align 8, !tbaa !32
  br label %74

71:                                               ; preds = %65
  %72 = call ptr @dbi_dig(ptr noundef nonnull %0, i64 noundef %.066, ptr noundef nonnull %5) #8
  %73 = trunc nuw i64 %.066 to i32
  br label %.loopexit

74:                                               ; preds = %._crit_edge73, %58, %61
  %75 = phi i32 [ %.pre, %._crit_edge73 ], [ %59, %58 ], [ %59, %61 ]
  %76 = add nuw nsw i64 %.066, 1
  %77 = zext i32 %75 to i64
  %78 = icmp ult i64 %76, %77
  br i1 %78, label %58, label %.loopexit, !llvm.loop !48

.loopexit:                                        ; preds = %74, %48, %71
  %.044 = phi ptr [ %72, %71 ], [ %5, %48 ], [ %5, %74 ]
  %.042 = phi i32 [ %73, %71 ], [ 0, %48 ], [ 0, %74 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #8
  call void @stat_get(ptr noundef %.044, ptr noundef nonnull %7, i64 noundef 48)
  %79 = load i16, ptr %.044, align 4, !tbaa !50
  %80 = zext i16 %79 to i32
  %81 = call i32 %1(ptr noundef %2, ptr noundef nonnull %0, ptr noundef nonnull %6, i32 noundef %80, ptr noundef nonnull %7, i32 noundef %.042) #8
  %.not60 = icmp eq i32 %81, 0
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #8
  br i1 %.not60, label %select.unfold, label %.loopexit63

select.unfold:                                    ; preds = %.loopexit, %32
  %82 = call i32 @outer_next(ptr noundef nonnull %4, ptr noundef null, ptr noundef null, i32 noundef 11) #8
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %32, label %._crit_edge, !llvm.loop !51

._crit_edge:                                      ; preds = %select.unfold, %18
  %.247 = phi i32 [ %24, %18 ], [ %82, %select.unfold ]
  %.247.fr = freeze i32 %.247
  %84 = icmp eq i32 %.247.fr, -30798
  %spec.select = select i1 %84, i32 0, i32 %.247.fr
  br label %.loopexit63

.loopexit63:                                      ; preds = %.loopexit, %._crit_edge, %46, %44
  %.3 = phi i32 [ -30796, %44 ], [ -30796, %46 ], [ %spec.select, %._crit_edge ], [ %81, %.loopexit ]
  %85 = load ptr, ptr %23, align 8, !tbaa !18
  %86 = load ptr, ptr %19, align 8, !tbaa !7
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  store ptr %85, ptr %87, align 8, !tbaa !17
  %88 = call i32 @log_if_error(i32 noundef %.3, ptr noundef nonnull @__func__.mdbx_enumerate_tables, i32 noundef 314)
  br label %.loopexit62

.loopexit62:                                      ; preds = %.loopexit63, %16
  %.043 = phi i32 [ %17, %16 ], [ %88, %.loopexit63 ]
  call void @llvm.lifetime.end.p0(i64 824, ptr nonnull %4) #8
  br label %89

89:                                               ; preds = %12, %.loopexit62, %8
  %.2 = phi i32 [ %9, %8 ], [ %13, %12 ], [ %.043, %.loopexit62 ]
  ret i32 %.2
}

declare i32 @outer_first(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i8 @node_flags(ptr noalias noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @node_ds(ptr noalias noundef) local_unnamed_addr #7

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden ptr @node_data(ptr noalias noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden ptr @node_key(ptr noalias noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden i64 @node_ks(ptr noalias noundef) local_unnamed_addr #7

declare ptr @dbi_dig(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @outer_next(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

!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 120}
!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 = !{!13, !13, i64 0}
!18 = !{!19, !13, i64 368}
!19 = !{!"cursor_couple", !20, i64 0, !13, i64 384, !21, i64 392}
!20 = !{!"MDBX_cursor", !9, i64 0, !10, i64 4, !10, i64 6, !10, i64 7, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !10, i64 48, !10, i64 304, !13, i64 368, !13, i64 376}
!21 = !{!"inner_cursor", !20, i64 0, !22, i64 384}
!22 = !{!"tree", !15, i64 0, !15, i64 2, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !12, i64 24, !12, i64 32, !12, i64 40}
!23 = !{!10, !10, i64 0}
!24 = !{!15, !15, i64 0}
!25 = !{!26, !10, i64 26}
!26 = !{!"libmdbx_globals", !10, i64 0, !9, i64 16, !9, i64 20, !10, i64 24, !10, i64 25, !10, i64 26, !27, i64 27, !9, i64 28, !10, i64 32, !10, i64 40, !12, i64 80, !13, i64 88}
!27 = !{!"_Bool", !10, i64 0}
!28 = !{!29, !13, i64 0}
!29 = !{!"iovec", !13, i64 0, !12, i64 8}
!30 = !{!29, !12, i64 8}
!31 = !{!8, !13, i64 80}
!32 = !{!33, !9, i64 440}
!33 = !{!"MDBX_env", !10, i64 0, !9, i64 4, !9, i64 8, !34, i64 16, !9, i64 56, !9, i64 60, !34, i64 64, !13, i64 104, !15, i64 112, !15, i64 114, !15, i64 116, !15, i64 118, !15, i64 120, !15, i64 122, !10, i64 124, !10, i64 128, !10, i64 129, !15, i64 130, !9, i64 132, !9, i64 136, !9, i64 140, !9, i64 144, !35, i64 152, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !13, i64 216, !9, i64 224, !9, i64 228, !9, i64 232, !13, i64 240, !13, i64 248, !12, i64 256, !36, i64 264, !38, i64 320, !27, i64 360, !13, i64 368, !13, i64 376, !13, i64 384, !39, i64 392, !10, i64 400, !9, i64 440, !9, i64 444, !13, i64 448, !40, i64 456, !10, i64 496, !10, i64 536}
!34 = !{!"osal_mmap", !10, i64 0, !9, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!35 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!36 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !12, i64 16, !10, i64 24, !10, i64 25, !10, i64 26, !10, i64 27, !9, i64 28, !9, i64 32, !27, i64 36, !27, i64 37, !27, i64 38, !37, i64 40, !10, i64 48}
!37 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6}
!38 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!39 = !{!"", !12, i64 0}
!40 = !{!"osal_ioring", !9, i64 0, !9, i64 4, !9, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!41 = !{!8, !12, i64 8}
!42 = !{!33, !13, i64 208}
!43 = !{!33, !13, i64 200}
!44 = !{!45, !13, i64 0}
!45 = !{!"kvx", !46, i64 0, !29, i64 48}
!46 = !{!"clc2", !47, i64 0, !47, i64 24}
!47 = !{!"clc", !13, i64 0, !12, i64 8, !12, i64 16}
!48 = distinct !{!48, !49}
!49 = !{!"llvm.loop.mustprogress"}
!50 = !{!22, !15, i64 0}
!51 = distinct !{!51, !49}


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