; LLVM IR from erthink/libmdbx :: src (node)

; 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.0 }
%struct.anon.0 = 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.page_get_result = type { ptr, i32 }
%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.anon = type { i8, i8 }
%struct.page = type <{ i64, i16, i16, %union.anon.2, i32, [0 x i16] }>
%union.anon.2 = type { i32 }
%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.6 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.4, %union.anon.5 }
%union.anon.4 = type { i32 }
%union.anon.5 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.6 = type { %struct.anon.8 }
%struct.anon.8 = type { %struct.troika, ptr, %struct.anon.9, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.10 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.9 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.10 = type { %struct.anon.11 }
%struct.anon.11 = type { i64, ptr }
%struct.MDBX_env = type { %union.mdbx_atomic_uint32_t, i32, i32, %struct.osal_mmap, i32, i32, %struct.osal_mmap, ptr, i16, i16, i16, i16, i16, i16, %union.mdbx_atomic_uint32_t, i8, i8, i16, i32, i32, i32, i32, %struct.anon.13, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.14, %struct.anon.18, i8, ptr, ptr, ptr, %struct.anon.19, %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.12, i32, i64, i64, i64 }
%union.anon.12 = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.13 = type { ptr, ptr, ptr, ptr }
%struct.anon.14 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.15, %union.anon.16 }
%struct.anon.15 = type { i16, i16, i16, i16 }
%union.anon.16 = type { i32 }
%struct.anon.18 = type { i64, i64, i64, i64, i64 }
%struct.anon.19 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%struct.anon.3 = type { i16, i16 }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__.node_add_leaf = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [49 x i8], align 1

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

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

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @is_subpage(ptr noundef) #4

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @page_numkeys(ptr noundef) #4

; 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) #5

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @node_set_flags(ptr noalias noundef, i8 noundef zeroext) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @poke_u8(ptr noalias noundef, i8 noundef zeroext) #6

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

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

; Function Attrs: hot nounwind uwtable
define dso_local i32 @node_add_leaf(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #7 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca [510 x i8], align 16
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.page_get_result, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %5
  %26 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %27 = zext i8 %26 to i32
  %28 = and i32 %27, 1
  %29 = icmp ne i32 %28, 0
  %30 = xor i1 %29, true
  %31 = xor i1 %30, true
  %32 = zext i1 %31 to i32
  %33 = sext i32 %32 to i64
  %34 = call i64 @llvm.expect.i64(i64 %33, i64 1)
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %50

36:                                               ; preds = %25
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  %40 = xor i1 %39, true
  %41 = xor i1 %40, true
  %42 = xor i1 %41, true
  %43 = zext i1 %42 to i32
  %44 = sext i32 %43 to i64
  %45 = call i64 @llvm.expect.i64(i64 %44, i64 0)
  %46 = icmp ne i64 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %37
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str, ptr noundef @__func__.node_add_leaf, i32 noundef 89) #9
  unreachable

48:                                               ; preds = %37
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49, %25
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %54 = zext i8 %53 to i32
  %55 = and i32 %54, 1
  %56 = icmp ne i32 %55, 0
  %57 = xor i1 %56, true
  %58 = xor i1 %57, true
  %59 = zext i1 %58 to i32
  %60 = sext i32 %59 to i64
  %61 = call i64 @llvm.expect.i64(i64 %60, i64 1)
  %62 = icmp ne i64 %61, 0
  br i1 %62, label %63, label %77

63:                                               ; preds = %52
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  %67 = xor i1 %66, true
  %68 = xor i1 %67, true
  %69 = xor i1 %68, true
  %70 = zext i1 %69 to i32
  %71 = sext i32 %70 to i64
  %72 = call i64 @llvm.expect.i64(i64 %71, i64 0)
  %73 = icmp ne i64 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %64
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.12, ptr noundef @__func__.node_add_leaf, i32 noundef 90) #9
  unreachable

75:                                               ; preds = %64
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76, %52
  br label %78

78:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.MDBX_cursor, ptr %79, i32 0, i32 9
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.MDBX_cursor, ptr %81, i32 0, i32 1
  %83 = getelementptr inbounds %struct.anon, ptr %82, i32 0, i32 1
  %84 = load i8, ptr %83, align 1, !tbaa !16
  %85 = sext i8 %84 to i64
  %86 = getelementptr inbounds [32 x ptr], ptr %80, i64 0, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !5
  store ptr %87, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 510, ptr %13) #10
  br label %88

88:                                               ; preds = %78
  %89 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !17
  %90 = zext i8 %89 to i32
  %91 = icmp sle i32 5, %90
  %92 = xor i1 %91, true
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i32
  %95 = sext i32 %94 to i64
  %96 = call i64 @llvm.expect.i64(i64 %95, i64 0)
  %97 = icmp ne i64 %96, 0
  br i1 %97, label %98, label %128

98:                                               ; preds = %88
  %99 = load ptr, ptr %12, align 8, !tbaa !5
  %100 = call zeroext i1 @is_subpage(ptr noundef %99) #11
  %101 = zext i1 %100 to i64
  %102 = select i1 %100, ptr @.str.2, ptr @.str.3
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.page, ptr %103, i32 0, i32 4
  %105 = load i32, ptr %104, align 1, !tbaa !11
  %106 = load i64, ptr %8, align 8, !tbaa !9
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %113

109:                                              ; preds = %98
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.iovec, ptr %110, i32 0, i32 1
  %112 = load i64, ptr %111, align 8, !tbaa !18
  br label %114

113:                                              ; preds = %98
  br label %114

114:                                              ; preds = %113, %109
  %115 = phi i64 [ %112, %109 ], [ 0, %113 ]
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %122

118:                                              ; preds = %114
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.iovec, ptr %119, i32 0, i32 1
  %121 = load i64, ptr %120, align 8, !tbaa !18
  br label %123

122:                                              ; preds = %114
  br label %123

123:                                              ; preds = %122, %118
  %124 = phi i64 [ %121, %118 ], [ 0, %122 ]
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds [510 x i8], ptr %13, i64 0, i64 0
  %127 = call ptr @mdbx_dump_val(ptr noundef %125, ptr noundef %126, i64 noundef 255)
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.node_add_leaf, i32 noundef 95, ptr noundef @.str.13, ptr noundef %102, i32 noundef %105, i64 noundef %106, i64 noundef %115, i64 noundef %124, ptr noundef %127)
  br label %128

128:                                              ; preds = %123, %88
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  %132 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %133 = zext i8 %132 to i32
  %134 = and i32 %133, 1
  %135 = icmp ne i32 %134, 0
  %136 = xor i1 %135, true
  %137 = xor i1 %136, true
  %138 = zext i1 %137 to i32
  %139 = sext i32 %138 to i64
  %140 = call i64 @llvm.expect.i64(i64 %139, i64 1)
  %141 = icmp ne i64 %140, 0
  br i1 %141, label %142, label %167

142:                                              ; preds = %131
  br label %143

143:                                              ; preds = %142
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %149

146:                                              ; preds = %143
  %147 = load ptr, ptr %10, align 8, !tbaa !5
  %148 = icmp ne ptr %147, null
  br label %149

149:                                              ; preds = %146, %143
  %150 = phi i1 [ false, %143 ], [ %148, %146 ]
  %151 = xor i1 %150, true
  %152 = xor i1 %151, true
  %153 = xor i1 %152, true
  %154 = zext i1 %153 to i32
  %155 = sext i32 %154 to i64
  %156 = call i64 @llvm.expect.i64(i64 %155, i64 0)
  %157 = icmp ne i64 %156, 0
  br i1 %157, label %158, label %164

158:                                              ; preds = %149
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.MDBX_cursor, ptr %159, i32 0, i32 5
  %161 = load ptr, ptr %160, align 8, !tbaa !20
  %162 = getelementptr inbounds %struct.MDBX_txn, ptr %161, i32 0, i32 9
  %163 = load ptr, ptr %162, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %163, ptr noundef @.str.14, ptr noundef @__func__.node_add_leaf, i32 noundef 96) #9
  unreachable

164:                                              ; preds = %149
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166, %131
  br label %168

168:                                              ; preds = %167
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %172 = zext i8 %171 to i32
  %173 = and i32 %172, 1
  %174 = icmp ne i32 %173, 0
  %175 = xor i1 %174, true
  %176 = xor i1 %175, true
  %177 = zext i1 %176 to i32
  %178 = sext i32 %177 to i64
  %179 = call i64 @llvm.expect.i64(i64 %178, i64 1)
  %180 = icmp ne i64 %179, 0
  br i1 %180, label %181, label %203

181:                                              ; preds = %170
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %12, align 8, !tbaa !5
  %184 = call zeroext i8 @page_type_compat(ptr noundef %183) #11
  %185 = zext i8 %184 to i32
  %186 = icmp eq i32 %185, 2
  %187 = xor i1 %186, true
  %188 = xor i1 %187, true
  %189 = xor i1 %188, true
  %190 = zext i1 %189 to i32
  %191 = sext i32 %190 to i64
  %192 = call i64 @llvm.expect.i64(i64 %191, i64 0)
  %193 = icmp ne i64 %192, 0
  br i1 %193, label %194, label %200

194:                                              ; preds = %182
  %195 = load ptr, ptr %7, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.MDBX_cursor, ptr %195, i32 0, i32 5
  %197 = load ptr, ptr %196, align 8, !tbaa !20
  %198 = getelementptr inbounds %struct.MDBX_txn, ptr %197, i32 0, i32 9
  %199 = load ptr, ptr %198, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %199, ptr noundef @.str.15, ptr noundef @__func__.node_add_leaf, i32 noundef 97) #9
  unreachable

200:                                              ; preds = %182
  br label %201

201:                                              ; preds = %200
  br label %202

202:                                              ; preds = %201
  br label %203

203:                                              ; preds = %202, %170
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #10
  %206 = load i32, ptr %11, align 4, !tbaa !11
  %207 = and i32 %206, 1
  %208 = icmp ne i32 %207, 0
  %209 = xor i1 %208, true
  %210 = xor i1 %209, true
  %211 = zext i1 %210 to i32
  %212 = sext i32 %211 to i64
  %213 = call i64 @llvm.expect.i64(i64 %212, i64 0)
  %214 = icmp ne i64 %213, 0
  br i1 %214, label %215, label %258

215:                                              ; preds = %205
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.iovec, ptr %216, i32 0, i32 1
  %218 = load i64, ptr %217, align 8, !tbaa !18
  %219 = call i64 @node_size_len(i64 noundef %218, i64 noundef 0) #12
  %220 = add i64 %219, 4
  %221 = add i64 %220, 2
  store i64 %221, ptr %15, align 8, !tbaa !9
  br label %222

222:                                              ; preds = %215
  %223 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %224 = zext i8 %223 to i32
  %225 = and i32 %224, 1
  %226 = icmp ne i32 %225, 0
  %227 = xor i1 %226, true
  %228 = xor i1 %227, true
  %229 = zext i1 %228 to i32
  %230 = sext i32 %229 to i64
  %231 = call i64 @llvm.expect.i64(i64 %230, i64 1)
  %232 = icmp ne i64 %231, 0
  br i1 %232, label %233, label %255

233:                                              ; preds = %222
  br label %234

234:                                              ; preds = %233
  %235 = load ptr, ptr %12, align 8, !tbaa !5
  %236 = call i64 @page_room(ptr noundef %235) #11
  %237 = load i64, ptr %15, align 8, !tbaa !9
  %238 = icmp uge i64 %236, %237
  %239 = xor i1 %238, true
  %240 = xor i1 %239, true
  %241 = xor i1 %240, true
  %242 = zext i1 %241 to i32
  %243 = sext i32 %242 to i64
  %244 = call i64 @llvm.expect.i64(i64 %243, i64 0)
  %245 = icmp ne i64 %244, 0
  br i1 %245, label %246, label %252

246:                                              ; preds = %234
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.MDBX_cursor, ptr %247, i32 0, i32 5
  %249 = load ptr, ptr %248, align 8, !tbaa !20
  %250 = getelementptr inbounds %struct.MDBX_txn, ptr %249, i32 0, i32 9
  %251 = load ptr, ptr %250, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %251, ptr noundef @.str.16, ptr noundef @__func__.node_add_leaf, i32 noundef 105) #9
  unreachable

252:                                              ; preds = %234
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254, %222
  br label %256

256:                                              ; preds = %255
  br label %257

257:                                              ; preds = %256
  br label %582

258:                                              ; preds = %205
  %259 = load ptr, ptr %9, align 8, !tbaa !5
  %260 = load ptr, ptr %10, align 8, !tbaa !5
  %261 = call i64 @node_size(ptr noundef %259, ptr noundef %260) #11
  %262 = load ptr, ptr %7, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.MDBX_cursor, ptr %262, i32 0, i32 5
  %264 = load ptr, ptr %263, align 8, !tbaa !20
  %265 = getelementptr inbounds %struct.MDBX_txn, ptr %264, i32 0, i32 9
  %266 = load ptr, ptr %265, align 8, !tbaa !22
  %267 = getelementptr inbounds %struct.MDBX_env, ptr %266, i32 0, i32 8
  %268 = load i16, ptr %267, align 8, !tbaa !27
  %269 = zext i16 %268 to i64
  %270 = icmp ugt i64 %261, %269
  %271 = xor i1 %270, true
  %272 = xor i1 %271, true
  %273 = zext i1 %272 to i32
  %274 = sext i32 %273 to i64
  %275 = call i64 @llvm.expect.i64(i64 %274, i64 0)
  %276 = icmp ne i64 %275, 0
  br i1 %276, label %277, label %491

277:                                              ; preds = %258
  %278 = load ptr, ptr %7, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.MDBX_cursor, ptr %278, i32 0, i32 6
  %280 = load ptr, ptr %279, align 8, !tbaa !36
  %281 = getelementptr inbounds %struct.tree, ptr %280, i32 0, i32 0
  %282 = load i16, ptr %281, align 4, !tbaa !37
  %283 = zext i16 %282 to i32
  %284 = and i32 %283, 4
  %285 = icmp ne i32 %284, 0
  %286 = xor i1 %285, true
  %287 = xor i1 %286, true
  %288 = zext i1 %287 to i32
  %289 = sext i32 %288 to i64
  %290 = call i64 @llvm.expect.i64(i64 %289, i64 0)
  %291 = icmp ne i64 %290, 0
  br i1 %291, label %292, label %313

292:                                              ; preds = %277
  br label %293

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

303:                                              ; preds = %293
  %304 = load ptr, ptr %7, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.MDBX_cursor, ptr %304, i32 0, i32 6
  %306 = load ptr, ptr %305, align 8, !tbaa !36
  %307 = getelementptr inbounds %struct.tree, ptr %306, i32 0, i32 0
  %308 = load i16, ptr %307, align 4, !tbaa !37
  %309 = zext i16 %308 to i32
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.node_add_leaf, i32 noundef 109, ptr noundef @.str.17, ptr noundef @.str.18, i32 noundef %309)
  br label %310

310:                                              ; preds = %303, %293
  br label %311

311:                                              ; preds = %310
  br label %312

312:                                              ; preds = %311
  store i32 -30779, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %782

313:                                              ; preds = %277
  %314 = load i32, ptr %11, align 4, !tbaa !11
  %315 = and i32 %314, 6
  %316 = icmp ne i32 %315, 0
  %317 = xor i1 %316, true
  %318 = xor i1 %317, true
  %319 = zext i1 %318 to i32
  %320 = sext i32 %319 to i64
  %321 = call i64 @llvm.expect.i64(i64 %320, i64 0)
  %322 = icmp ne i64 %321, 0
  br i1 %322, label %323, label %339

323:                                              ; preds = %313
  br label %324

324:                                              ; preds = %323
  %325 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !17
  %326 = zext i8 %325 to i32
  %327 = icmp sle i32 1, %326
  %328 = xor i1 %327, true
  %329 = xor i1 %328, true
  %330 = zext i1 %329 to i32
  %331 = sext i32 %330 to i64
  %332 = call i64 @llvm.expect.i64(i64 %331, i64 0)
  %333 = icmp ne i64 %332, 0
  br i1 %333, label %334, label %336

334:                                              ; preds = %324
  %335 = load i32, ptr %11, align 4, !tbaa !11
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.node_add_leaf, i32 noundef 113, ptr noundef @.str.17, ptr noundef @.str.19, i32 noundef %335)
  br label %336

336:                                              ; preds = %334, %324
  br label %337

337:                                              ; preds = %336
  br label %338

338:                                              ; preds = %337
  store i32 -30779, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %782

339:                                              ; preds = %313
  br label %340

340:                                              ; preds = %339
  %341 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %342 = zext i8 %341 to i32
  %343 = and i32 %342, 1
  %344 = icmp ne i32 %343, 0
  %345 = xor i1 %344, true
  %346 = xor i1 %345, true
  %347 = zext i1 %346 to i32
  %348 = sext i32 %347 to i64
  %349 = call i64 @llvm.expect.i64(i64 %348, i64 1)
  %350 = icmp ne i64 %349, 0
  br i1 %350, label %351, label %380

351:                                              ; preds = %340
  br label %352

352:                                              ; preds = %351
  %353 = load ptr, ptr %12, align 8, !tbaa !5
  %354 = call i64 @page_room(ptr noundef %353) #11
  %355 = load ptr, ptr %7, align 8, !tbaa !5
  %356 = getelementptr inbounds %struct.MDBX_cursor, ptr %355, i32 0, i32 5
  %357 = load ptr, ptr %356, align 8, !tbaa !20
  %358 = getelementptr inbounds %struct.MDBX_txn, ptr %357, i32 0, i32 9
  %359 = load ptr, ptr %358, align 8, !tbaa !22
  %360 = load ptr, ptr %9, align 8, !tbaa !5
  %361 = load ptr, ptr %10, align 8, !tbaa !5
  %362 = call i64 @leaf_size(ptr noundef %359, ptr noundef %360, ptr noundef %361) #11
  %363 = icmp uge i64 %354, %362
  %364 = xor i1 %363, true
  %365 = xor i1 %364, true
  %366 = xor i1 %365, true
  %367 = zext i1 %366 to i32
  %368 = sext i32 %367 to i64
  %369 = call i64 @llvm.expect.i64(i64 %368, i64 0)
  %370 = icmp ne i64 %369, 0
  br i1 %370, label %371, label %377

371:                                              ; preds = %352
  %372 = load ptr, ptr %7, align 8, !tbaa !5
  %373 = getelementptr inbounds %struct.MDBX_cursor, ptr %372, i32 0, i32 5
  %374 = load ptr, ptr %373, align 8, !tbaa !20
  %375 = getelementptr inbounds %struct.MDBX_txn, ptr %374, i32 0, i32 9
  %376 = load ptr, ptr %375, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %376, ptr noundef @.str.20, ptr noundef @__func__.node_add_leaf, i32 noundef 116) #9
  unreachable

377:                                              ; preds = %352
  br label %378

378:                                              ; preds = %377
  br label %379

379:                                              ; preds = %378
  br label %380

380:                                              ; preds = %379, %340
  br label %381

381:                                              ; preds = %380
  br label %382

382:                                              ; preds = %381
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  %383 = load ptr, ptr %7, align 8, !tbaa !5
  %384 = getelementptr inbounds %struct.MDBX_cursor, ptr %383, i32 0, i32 5
  %385 = load ptr, ptr %384, align 8, !tbaa !20
  %386 = getelementptr inbounds %struct.MDBX_txn, ptr %385, i32 0, i32 9
  %387 = load ptr, ptr %386, align 8, !tbaa !22
  %388 = load ptr, ptr %10, align 8, !tbaa !5
  %389 = getelementptr inbounds %struct.iovec, ptr %388, i32 0, i32 1
  %390 = load i64, ptr %389, align 8, !tbaa !18
  %391 = call i32 @largechunk_npages(ptr noundef %387, i64 noundef %390) #11
  store i32 %391, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #10
  %392 = load ptr, ptr %7, align 8, !tbaa !5
  %393 = load i32, ptr %17, align 4, !tbaa !11
  %394 = zext i32 %393 to i64
  %395 = call { ptr, i32 } @page_new_large(ptr noundef %392, i64 noundef %394)
  %396 = getelementptr inbounds { ptr, i32 }, ptr %18, i32 0, i32 0
  %397 = extractvalue { ptr, i32 } %395, 0
  store ptr %397, ptr %396, align 8
  %398 = getelementptr inbounds { ptr, i32 }, ptr %18, i32 0, i32 1
  %399 = extractvalue { ptr, i32 } %395, 1
  store i32 %399, ptr %398, align 8
  %400 = getelementptr inbounds %struct.page_get_result, ptr %18, i32 0, i32 1
  %401 = load i32, ptr %400, align 8, !tbaa !39
  %402 = icmp ne i32 %401, 0
  %403 = xor i1 %402, true
  %404 = xor i1 %403, true
  %405 = zext i1 %404 to i32
  %406 = sext i32 %405 to i64
  %407 = call i64 @llvm.expect.i64(i64 %406, i64 0)
  %408 = icmp ne i64 %407, 0
  br i1 %408, label %409, label %412

409:                                              ; preds = %382
  %410 = getelementptr inbounds %struct.page_get_result, ptr %18, i32 0, i32 1
  %411 = load i32, ptr %410, align 8, !tbaa !39
  store i32 %411, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %488

412:                                              ; preds = %382
  %413 = getelementptr inbounds %struct.page_get_result, ptr %18, i32 0, i32 0
  %414 = load ptr, ptr %413, align 8, !tbaa !41
  store ptr %414, ptr %14, align 8, !tbaa !5
  br label %415

415:                                              ; preds = %412
  %416 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !17
  %417 = zext i8 %416 to i32
  %418 = icmp sle i32 5, %417
  %419 = xor i1 %418, true
  %420 = xor i1 %419, true
  %421 = zext i1 %420 to i32
  %422 = sext i32 %421 to i64
  %423 = call i64 @llvm.expect.i64(i64 %422, i64 0)
  %424 = icmp ne i64 %423, 0
  br i1 %424, label %425, label %435

425:                                              ; preds = %415
  %426 = load ptr, ptr %14, align 8, !tbaa !5
  %427 = getelementptr inbounds %struct.page, ptr %426, i32 0, i32 3
  %428 = load i32, ptr %427, align 1, !tbaa !16
  %429 = load ptr, ptr %14, align 8, !tbaa !5
  %430 = getelementptr inbounds %struct.page, ptr %429, i32 0, i32 4
  %431 = load i32, ptr %430, align 1, !tbaa !11
  %432 = load ptr, ptr %10, align 8, !tbaa !5
  %433 = getelementptr inbounds %struct.iovec, ptr %432, i32 0, i32 1
  %434 = load i64, ptr %433, align 8, !tbaa !18
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.node_add_leaf, i32 noundef 123, ptr noundef @.str.21, i32 noundef %428, i32 noundef %431, i64 noundef %434)
  br label %435

435:                                              ; preds = %425, %415
  br label %436

436:                                              ; preds = %435
  br label %437

437:                                              ; preds = %436
  %438 = load i32, ptr %11, align 4, !tbaa !11
  %439 = or i32 %438, 1
  store i32 %439, ptr %11, align 4, !tbaa !11
  %440 = load ptr, ptr %9, align 8, !tbaa !5
  %441 = getelementptr inbounds %struct.iovec, ptr %440, i32 0, i32 1
  %442 = load i64, ptr %441, align 8, !tbaa !18
  %443 = call i64 @node_size_len(i64 noundef %442, i64 noundef 0) #12
  %444 = add i64 %443, 4
  %445 = add i64 %444, 2
  store i64 %445, ptr %15, align 8, !tbaa !9
  br label %446

446:                                              ; preds = %437
  %447 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %448 = zext i8 %447 to i32
  %449 = and i32 %448, 1
  %450 = icmp ne i32 %449, 0
  %451 = xor i1 %450, true
  %452 = xor i1 %451, true
  %453 = zext i1 %452 to i32
  %454 = sext i32 %453 to i64
  %455 = call i64 @llvm.expect.i64(i64 %454, i64 1)
  %456 = icmp ne i64 %455, 0
  br i1 %456, label %457, label %485

457:                                              ; preds = %446
  br label %458

458:                                              ; preds = %457
  %459 = load i64, ptr %15, align 8, !tbaa !9
  %460 = load ptr, ptr %7, align 8, !tbaa !5
  %461 = getelementptr inbounds %struct.MDBX_cursor, ptr %460, i32 0, i32 5
  %462 = load ptr, ptr %461, align 8, !tbaa !20
  %463 = getelementptr inbounds %struct.MDBX_txn, ptr %462, i32 0, i32 9
  %464 = load ptr, ptr %463, align 8, !tbaa !22
  %465 = load ptr, ptr %9, align 8, !tbaa !5
  %466 = load ptr, ptr %10, align 8, !tbaa !5
  %467 = call i64 @leaf_size(ptr noundef %464, ptr noundef %465, ptr noundef %466) #11
  %468 = icmp eq i64 %459, %467
  %469 = xor i1 %468, true
  %470 = xor i1 %469, true
  %471 = xor i1 %470, true
  %472 = zext i1 %471 to i32
  %473 = sext i32 %472 to i64
  %474 = call i64 @llvm.expect.i64(i64 %473, i64 0)
  %475 = icmp ne i64 %474, 0
  br i1 %475, label %476, label %482

476:                                              ; preds = %458
  %477 = load ptr, ptr %7, align 8, !tbaa !5
  %478 = getelementptr inbounds %struct.MDBX_cursor, ptr %477, i32 0, i32 5
  %479 = load ptr, ptr %478, align 8, !tbaa !20
  %480 = getelementptr inbounds %struct.MDBX_txn, ptr %479, i32 0, i32 9
  %481 = load ptr, ptr %480, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %481, ptr noundef @.str.22, ptr noundef @__func__.node_add_leaf, i32 noundef 126) #9
  unreachable

482:                                              ; preds = %458
  br label %483

483:                                              ; preds = %482
  br label %484

484:                                              ; preds = %483
  br label %485

485:                                              ; preds = %484, %446
  br label %486

486:                                              ; preds = %485
  br label %487

487:                                              ; preds = %486
  store i32 0, ptr %16, align 4
  br label %488

488:                                              ; preds = %487, %409
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  %489 = load i32, ptr %16, align 4
  switch i32 %489, label %782 [
    i32 0, label %490
  ]

490:                                              ; preds = %488
  br label %581

491:                                              ; preds = %258
  br label %492

492:                                              ; preds = %491
  %493 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %494 = zext i8 %493 to i32
  %495 = and i32 %494, 1
  %496 = icmp ne i32 %495, 0
  %497 = xor i1 %496, true
  %498 = xor i1 %497, true
  %499 = zext i1 %498 to i32
  %500 = sext i32 %499 to i64
  %501 = call i64 @llvm.expect.i64(i64 %500, i64 1)
  %502 = icmp ne i64 %501, 0
  br i1 %502, label %503, label %532

503:                                              ; preds = %492
  br label %504

504:                                              ; preds = %503
  %505 = load ptr, ptr %12, align 8, !tbaa !5
  %506 = call i64 @page_room(ptr noundef %505) #11
  %507 = load ptr, ptr %7, align 8, !tbaa !5
  %508 = getelementptr inbounds %struct.MDBX_cursor, ptr %507, i32 0, i32 5
  %509 = load ptr, ptr %508, align 8, !tbaa !20
  %510 = getelementptr inbounds %struct.MDBX_txn, ptr %509, i32 0, i32 9
  %511 = load ptr, ptr %510, align 8, !tbaa !22
  %512 = load ptr, ptr %9, align 8, !tbaa !5
  %513 = load ptr, ptr %10, align 8, !tbaa !5
  %514 = call i64 @leaf_size(ptr noundef %511, ptr noundef %512, ptr noundef %513) #11
  %515 = icmp uge i64 %506, %514
  %516 = xor i1 %515, true
  %517 = xor i1 %516, true
  %518 = xor i1 %517, true
  %519 = zext i1 %518 to i32
  %520 = sext i32 %519 to i64
  %521 = call i64 @llvm.expect.i64(i64 %520, i64 0)
  %522 = icmp ne i64 %521, 0
  br i1 %522, label %523, label %529

523:                                              ; preds = %504
  %524 = load ptr, ptr %7, align 8, !tbaa !5
  %525 = getelementptr inbounds %struct.MDBX_cursor, ptr %524, i32 0, i32 5
  %526 = load ptr, ptr %525, align 8, !tbaa !20
  %527 = getelementptr inbounds %struct.MDBX_txn, ptr %526, i32 0, i32 9
  %528 = load ptr, ptr %527, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %528, ptr noundef @.str.20, ptr noundef @__func__.node_add_leaf, i32 noundef 128) #9
  unreachable

529:                                              ; preds = %504
  br label %530

530:                                              ; preds = %529
  br label %531

531:                                              ; preds = %530
  br label %532

532:                                              ; preds = %531, %492
  br label %533

533:                                              ; preds = %532
  br label %534

534:                                              ; preds = %533
  %535 = load ptr, ptr %9, align 8, !tbaa !5
  %536 = load ptr, ptr %10, align 8, !tbaa !5
  %537 = call i64 @node_size(ptr noundef %535, ptr noundef %536) #11
  %538 = add i64 %537, 2
  store i64 %538, ptr %15, align 8, !tbaa !9
  br label %539

539:                                              ; preds = %534
  %540 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %541 = zext i8 %540 to i32
  %542 = and i32 %541, 1
  %543 = icmp ne i32 %542, 0
  %544 = xor i1 %543, true
  %545 = xor i1 %544, true
  %546 = zext i1 %545 to i32
  %547 = sext i32 %546 to i64
  %548 = call i64 @llvm.expect.i64(i64 %547, i64 1)
  %549 = icmp ne i64 %548, 0
  br i1 %549, label %550, label %578

550:                                              ; preds = %539
  br label %551

551:                                              ; preds = %550
  %552 = load i64, ptr %15, align 8, !tbaa !9
  %553 = load ptr, ptr %7, align 8, !tbaa !5
  %554 = getelementptr inbounds %struct.MDBX_cursor, ptr %553, i32 0, i32 5
  %555 = load ptr, ptr %554, align 8, !tbaa !20
  %556 = getelementptr inbounds %struct.MDBX_txn, ptr %555, i32 0, i32 9
  %557 = load ptr, ptr %556, align 8, !tbaa !22
  %558 = load ptr, ptr %9, align 8, !tbaa !5
  %559 = load ptr, ptr %10, align 8, !tbaa !5
  %560 = call i64 @leaf_size(ptr noundef %557, ptr noundef %558, ptr noundef %559) #11
  %561 = icmp eq i64 %552, %560
  %562 = xor i1 %561, true
  %563 = xor i1 %562, true
  %564 = xor i1 %563, true
  %565 = zext i1 %564 to i32
  %566 = sext i32 %565 to i64
  %567 = call i64 @llvm.expect.i64(i64 %566, i64 0)
  %568 = icmp ne i64 %567, 0
  br i1 %568, label %569, label %575

569:                                              ; preds = %551
  %570 = load ptr, ptr %7, align 8, !tbaa !5
  %571 = getelementptr inbounds %struct.MDBX_cursor, ptr %570, i32 0, i32 5
  %572 = load ptr, ptr %571, align 8, !tbaa !20
  %573 = getelementptr inbounds %struct.MDBX_txn, ptr %572, i32 0, i32 9
  %574 = load ptr, ptr %573, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %574, ptr noundef @.str.22, ptr noundef @__func__.node_add_leaf, i32 noundef 130) #9
  unreachable

575:                                              ; preds = %551
  br label %576

576:                                              ; preds = %575
  br label %577

577:                                              ; preds = %576
  br label %578

578:                                              ; preds = %577, %539
  br label %579

579:                                              ; preds = %578
  br label %580

580:                                              ; preds = %579
  br label %581

581:                                              ; preds = %580, %490
  br label %582

582:                                              ; preds = %581, %257
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #10
  %583 = load ptr, ptr %12, align 8, !tbaa !5
  %584 = call i64 @page_numkeys(ptr noundef %583) #11
  store i64 %584, ptr %19, align 8, !tbaa !9
  br label %585

585:                                              ; preds = %582
  %586 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !13
  %587 = zext i8 %586 to i32
  %588 = and i32 %587, 1
  %589 = icmp ne i32 %588, 0
  %590 = xor i1 %589, true
  %591 = xor i1 %590, true
  %592 = zext i1 %591 to i32
  %593 = sext i32 %592 to i64
  %594 = call i64 @llvm.expect.i64(i64 %593, i64 1)
  %595 = icmp ne i64 %594, 0
  br i1 %595, label %596, label %617

596:                                              ; preds = %585
  br label %597

597:                                              ; preds = %596
  %598 = load i64, ptr %19, align 8, !tbaa !9
  %599 = load i64, ptr %8, align 8, !tbaa !9
  %600 = icmp uge i64 %598, %599
  %601 = xor i1 %600, true
  %602 = xor i1 %601, true
  %603 = xor i1 %602, true
  %604 = zext i1 %603 to i32
  %605 = sext i32 %604 to i64
  %606 = call i64 @llvm.expect.i64(i64 %605, i64 0)
  %607 = icmp ne i64 %606, 0
  br i1 %607, label %608, label %614

608:                                              ; preds = %597
  %609 = load ptr, ptr %7, align 8, !tbaa !5
  %610 = getelementptr inbounds %struct.MDBX_cursor, ptr %609, i32 0, i32 5
  %611 = load ptr, ptr %610, align 8, !tbaa !20
  %612 = getelementptr inbounds %struct.MDBX_txn, ptr %611, i32 0, i32 9
  %613 = load ptr, ptr %612, align 8, !tbaa !22
  call void @mdbx_assert_fail(ptr noundef %613, ptr noundef @.str.8, ptr noundef @__func__.node_add_leaf, i32 noundef 135) #9
  unreachable

614:                                              ; preds = %597
  br label %615

615:                                              ; preds = %614
  br label %616

616:                                              ; preds = %615
  br label %617

617:                                              ; preds = %616, %585
  br label %618

618:                                              ; preds = %617
  br label %619

619:                                              ; preds = %618
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #10
  %620 = load i64, ptr %19, align 8, !tbaa !9
  store i64 %620, ptr %20, align 8, !tbaa !9
  br label %621

621:                                              ; preds = %637, %619
  %622 = load i64, ptr %20, align 8, !tbaa !9
  %623 = load i64, ptr %8, align 8, !tbaa !9
  %624 = icmp ugt i64 %622, %623
  br i1 %624, label %626, label %625

625:                                              ; preds = %621
  store i32 50, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #10
  br label %640

626:                                              ; preds = %621
  %627 = load ptr, ptr %12, align 8, !tbaa !5
  %628 = getelementptr inbounds %struct.page, ptr %627, i32 0, i32 5
  %629 = load i64, ptr %20, align 8, !tbaa !9
  %630 = sub i64 %629, 1
  %631 = getelementptr inbounds [0 x i16], ptr %628, i64 0, i64 %630
  %632 = load i16, ptr %631, align 1, !tbaa !42
  %633 = load ptr, ptr %12, align 8, !tbaa !5
  %634 = getelementptr inbounds %struct.page, ptr %633, i32 0, i32 5
  %635 = load i64, ptr %20, align 8, !tbaa !9
  %636 = getelementptr inbounds [0 x i16], ptr %634, i64 0, i64 %635
  store i16 %632, ptr %636, align 1, !tbaa !42
  br label %637

637:                                              ; preds = %626
  %638 = load i64, ptr %20, align 8, !tbaa !9
  %639 = add i64 %638, -1
  store i64 %639, ptr %20, align 8, !tbaa !9
  br label %621, !llvm.loop !43

640:                                              ; preds = %625
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #10
  %641 = load ptr, ptr %12, align 8, !tbaa !5
  %642 = getelementptr inbounds %struct.page, ptr %641, i32 0, i32 3
  %643 = getelementptr inbounds %struct.anon.3, ptr %642, i32 0, i32 0
  %644 = load i16, ptr %643, align 1, !tbaa !16
  %645 = zext i16 %644 to i64
  %646 = add i64 %645, 2
  store i64 %646, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #10
  %647 = load ptr, ptr %12, align 8, !tbaa !5
  %648 = getelementptr inbounds %struct.page, ptr %647, i32 0, i32 3
  %649 = getelementptr inbounds %struct.anon.3, ptr %648, i32 0, i32 1
  %650 = load i16, ptr %649, align 1, !tbaa !16
  %651 = zext i16 %650 to i64
  %652 = load i64, ptr %15, align 8, !tbaa !9
  %653 = sub i64 %652, 2
  %654 = sub i64 %651, %653
  store i64 %654, ptr %22, align 8, !tbaa !9
  %655 = load i64, ptr %21, align 8, !tbaa !9
  %656 = load i64, ptr %22, align 8, !tbaa !9
  %657 = icmp sgt i64 %655, %656
  %658 = xor i1 %657, true
  %659 = xor i1 %658, true
  %660 = zext i1 %659 to i32
  %661 = sext i32 %660 to i64
  %662 = call i64 @llvm.expect.i64(i64 %661, i64 0)
  %663 = icmp ne i64 %662, 0
  br i1 %663, label %664, label %671

664:                                              ; preds = %640
  %665 = load ptr, ptr %7, align 8, !tbaa !5
  %666 = getelementptr inbounds %struct.MDBX_cursor, ptr %665, i32 0, i32 5
  %667 = load ptr, ptr %666, align 8, !tbaa !20
  %668 = getelementptr inbounds %struct.MDBX_txn, ptr %667, i32 0, i32 1
  %669 = load i32, ptr %668, align 4, !tbaa !45
  %670 = or i32 %669, 2
  store i32 %670, ptr %668, align 4, !tbaa !45
  store i32 -30786, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %781

671:                                              ; preds = %640
  %672 = load i64, ptr %21, align 8, !tbaa !9
  %673 = trunc i64 %672 to i16
  %674 = load ptr, ptr %12, align 8, !tbaa !5
  %675 = getelementptr inbounds %struct.page, ptr %674, i32 0, i32 3
  %676 = getelementptr inbounds %struct.anon.3, ptr %675, i32 0, i32 0
  store i16 %673, ptr %676, align 1, !tbaa !16
  %677 = load i64, ptr %22, align 8, !tbaa !9
  %678 = trunc i64 %677 to i16
  %679 = load ptr, ptr %12, align 8, !tbaa !5
  %680 = getelementptr inbounds %struct.page, ptr %679, i32 0, i32 3
  %681 = getelementptr inbounds %struct.anon.3, ptr %680, i32 0, i32 1
  store i16 %678, ptr %681, align 1, !tbaa !16
  %682 = load ptr, ptr %12, align 8, !tbaa !5
  %683 = getelementptr inbounds %struct.page, ptr %682, i32 0, i32 5
  %684 = load i64, ptr %8, align 8, !tbaa !9
  %685 = getelementptr inbounds [0 x i16], ptr %683, i64 0, i64 %684
  store i16 %678, ptr %685, align 1, !tbaa !42
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #10
  %686 = load ptr, ptr %12, align 8, !tbaa !5
  %687 = load i64, ptr %8, align 8, !tbaa !9
  %688 = call ptr @page_node(ptr noundef %686, i64 noundef %687) #11
  store ptr %688, ptr %23, align 8, !tbaa !5
  %689 = load ptr, ptr %23, align 8, !tbaa !5
  %690 = load ptr, ptr %9, align 8, !tbaa !5
  %691 = getelementptr inbounds %struct.iovec, ptr %690, i32 0, i32 1
  %692 = load i64, ptr %691, align 8, !tbaa !18
  call void @node_set_ks(ptr noundef %689, i64 noundef %692)
  %693 = load ptr, ptr %23, align 8, !tbaa !5
  %694 = load i32, ptr %11, align 4, !tbaa !11
  %695 = trunc i32 %694 to i8
  call void @node_set_flags(ptr noundef %693, i8 noundef zeroext %695)
  %696 = load ptr, ptr %23, align 8, !tbaa !5
  %697 = ptrtoint ptr %696 to i64
  %698 = add nsw i64 %697, 5
  %699 = inttoptr i64 %698 to ptr
  call void @poke_u8(ptr noundef %699, i8 noundef zeroext 0)
  %700 = load ptr, ptr %23, align 8, !tbaa !5
  %701 = load ptr, ptr %10, align 8, !tbaa !5
  %702 = getelementptr inbounds %struct.iovec, ptr %701, i32 0, i32 1
  %703 = load i64, ptr %702, align 8, !tbaa !18
  call void @node_set_ds(ptr noundef %700, i64 noundef %703)
  %704 = load ptr, ptr %23, align 8, !tbaa !5
  %705 = call ptr @node_key(ptr noundef %704) #11
  %706 = load ptr, ptr %9, align 8, !tbaa !5
  %707 = getelementptr inbounds %struct.iovec, ptr %706, i32 0, i32 0
  %708 = load ptr, ptr %707, align 8, !tbaa !46
  %709 = load ptr, ptr %9, align 8, !tbaa !5
  %710 = getelementptr inbounds %struct.iovec, ptr %709, i32 0, i32 1
  %711 = load i64, ptr %710, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %705, ptr align 1 %708, i64 %711, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #10
  %712 = load ptr, ptr %23, align 8, !tbaa !5
  %713 = call ptr @node_data(ptr noundef %712) #11
  store ptr %713, ptr %24, align 8, !tbaa !5
  %714 = load ptr, ptr %14, align 8, !tbaa !5
  %715 = icmp eq ptr %714, null
  %716 = xor i1 %715, true
  %717 = xor i1 %716, true
  %718 = zext i1 %717 to i32
  %719 = sext i32 %718 to i64
  %720 = call i64 @llvm.expect.i64(i64 %719, i64 1)
  %721 = icmp ne i64 %720, 0
  br i1 %721, label %722, label %738

722:                                              ; preds = %671
  %723 = load i32, ptr %11, align 4, !tbaa !11
  %724 = and i32 %723, 1
  %725 = icmp ne i32 %724, 0
  %726 = xor i1 %725, true
  %727 = xor i1 %726, true
  %728 = zext i1 %727 to i32
  %729 = sext i32 %728 to i64
  %730 = call i64 @llvm.expect.i64(i64 %729, i64 0)
  %731 = icmp ne i64 %730, 0
  br i1 %731, label %732, label %737

732:                                              ; preds = %722
  %733 = load ptr, ptr %24, align 8, !tbaa !5
  %734 = load ptr, ptr %10, align 8, !tbaa !5
  %735 = getelementptr inbounds %struct.iovec, ptr %734, i32 0, i32 0
  %736 = load ptr, ptr %735, align 8, !tbaa !46
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %733, ptr align 1 %736, i64 4, i1 false)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %780

737:                                              ; preds = %722
  br label %745

738:                                              ; preds = %671
  %739 = load ptr, ptr %24, align 8, !tbaa !5
  %740 = load ptr, ptr %14, align 8, !tbaa !5
  %741 = getelementptr inbounds %struct.page, ptr %740, i32 0, i32 4
  %742 = load i32, ptr %741, align 1, !tbaa !11
  call void @poke_pgno(ptr noundef %739, i32 noundef %742)
  %743 = load ptr, ptr %14, align 8, !tbaa !5
  %744 = call ptr @page_data(ptr noundef %743) #11
  store ptr %744, ptr %24, align 8, !tbaa !5
  br label %745

745:                                              ; preds = %738, %737
  %746 = load i32, ptr %11, align 4, !tbaa !11
  %747 = and i32 %746, 65536
  %748 = icmp ne i32 %747, 0
  %749 = xor i1 %748, true
  %750 = xor i1 %749, true
  %751 = zext i1 %750 to i32
  %752 = sext i32 %751 to i64
  %753 = call i64 @llvm.expect.i64(i64 %752, i64 0)
  %754 = icmp ne i64 %753, 0
  br i1 %754, label %755, label %759

755:                                              ; preds = %745
  %756 = load ptr, ptr %24, align 8, !tbaa !5
  %757 = load ptr, ptr %10, align 8, !tbaa !5
  %758 = getelementptr inbounds %struct.iovec, ptr %757, i32 0, i32 0
  store ptr %756, ptr %758, align 8, !tbaa !46
  br label %779

759:                                              ; preds = %745
  %760 = load ptr, ptr %10, align 8, !tbaa !5
  %761 = getelementptr inbounds %struct.iovec, ptr %760, i32 0, i32 1
  %762 = load i64, ptr %761, align 8, !tbaa !18
  %763 = icmp ne i64 %762, 0
  %764 = xor i1 %763, true
  %765 = xor i1 %764, true
  %766 = zext i1 %765 to i32
  %767 = sext i32 %766 to i64
  %768 = call i64 @llvm.expect.i64(i64 %767, i64 1)
  %769 = icmp ne i64 %768, 0
  br i1 %769, label %770, label %778

770:                                              ; preds = %759
  %771 = load ptr, ptr %24, align 8, !tbaa !5
  %772 = load ptr, ptr %10, align 8, !tbaa !5
  %773 = getelementptr inbounds %struct.iovec, ptr %772, i32 0, i32 0
  %774 = load ptr, ptr %773, align 8, !tbaa !46
  %775 = load ptr, ptr %10, align 8, !tbaa !5
  %776 = getelementptr inbounds %struct.iovec, ptr %775, i32 0, i32 1
  %777 = load i64, ptr %776, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %771, ptr align 1 %774, i64 %777, i1 false)
  br label %778

778:                                              ; preds = %770, %759
  br label %779

779:                                              ; preds = %778, %755
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %780

780:                                              ; preds = %779, %732
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #10
  br label %781

781:                                              ; preds = %780, %664
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #10
  br label %782

782:                                              ; preds = %781, %488, %338, %312
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 510, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  %783 = load i32, ptr %6, align 4
  ret i32 %783
}

; Function Attrs: inlinehint nounwind willreturn memory(none) uwtable
declare hidden i64 @node_size_len(i64 noundef, i64 noundef) #8

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i64 @page_room(ptr noundef) #4

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

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

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

declare { ptr, i32 } @page_new_large(ptr noundef, i64 noundef) #3

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @poke_pgno(ptr noalias noundef, i32 noundef) #6

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden ptr @page_data(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { hot 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 = { inlinehint nounwind willreturn memory(none) 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 = { noreturn }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !7, i64 25}
!14 = !{!"libmdbx_globals", !7, i64 0, !12, i64 16, !12, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !15, i64 27, !12, i64 28, !7, i64 32, !7, i64 40, !10, i64 80, !6, i64 88}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!14, !7, i64 26}
!18 = !{!19, !10, i64 8}
!19 = !{!"iovec", !6, i64 0, !10, i64 8}
!20 = !{!21, !6, i64 16}
!21 = !{!"MDBX_cursor", !12, 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}
!22 = !{!23, !6, i64 80}
!23 = !{!"MDBX_txn", !12, i64 0, !12, i64 4, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !24, i64 40, !10, i64 64, !10, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !26, i64 128, !6, i64 160, !7, i64 168}
!24 = !{!"geo", !25, i64 0, !25, i64 2, !12, i64 4, !12, i64 8, !7, i64 12, !7, i64 16}
!25 = !{!"short", !7, i64 0}
!26 = !{!"MDBX_canary", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!27 = !{!28, !25, i64 112}
!28 = !{!"MDBX_env", !7, i64 0, !12, i64 4, !12, i64 8, !29, i64 16, !12, i64 56, !12, i64 60, !29, i64 64, !6, i64 104, !25, i64 112, !25, i64 114, !25, i64 116, !25, i64 118, !25, i64 120, !25, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !25, i64 130, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !30, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !12, i64 224, !12, i64 228, !12, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !31, i64 264, !33, i64 320, !15, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !34, i64 392, !7, i64 400, !12, i64 440, !12, i64 444, !6, i64 448, !35, i64 456, !7, i64 496, !7, i64 536}
!29 = !{!"osal_mmap", !7, i64 0, !12, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!30 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!31 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !10, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !12, i64 28, !12, i64 32, !15, i64 36, !15, i64 37, !15, i64 38, !32, i64 40, !7, i64 48}
!32 = !{!"", !25, i64 0, !25, i64 2, !25, i64 4, !25, i64 6}
!33 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!34 = !{!"", !10, i64 0}
!35 = !{!"osal_ioring", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!36 = !{!21, !6, i64 24}
!37 = !{!38, !25, i64 0}
!38 = !{!"tree", !25, i64 0, !25, i64 2, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !10, i64 24, !10, i64 32, !10, i64 40}
!39 = !{!40, !12, i64 8}
!40 = !{!"page_get_result", !6, i64 0, !12, i64 8}
!41 = !{!40, !6, i64 0}
!42 = !{!25, !25, i64 0}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!23, !12, i64 4}
!46 = !{!19, !6, i64 0}


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

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

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__.node_add_leaf = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [49 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: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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 zeroext i1 @is_subpage(ptr noundef) local_unnamed_addr #3

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

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

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

; 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) #4

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @node_set_flags(ptr noalias noundef, i8 noundef zeroext) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @poke_u8(ptr noalias noundef, i8 noundef zeroext) local_unnamed_addr #5

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

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

; Function Attrs: hot nounwind uwtable
define dso_local i32 @node_add_leaf(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #6 {
  %6 = alloca [510 x i8], align 16
  %7 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %8 = and i8 %7, 1
  %.not = icmp ne i8 %8, 0
  %.not128 = icmp eq ptr %2, null
  %or.cond = and i1 %.not128, %.not
  br i1 %or.cond, label %9, label %10, !prof !13

9:                                                ; preds = %5
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 89) #8
  unreachable

10:                                               ; preds = %5
  %.not130 = icmp eq ptr %3, null
  %or.cond160 = and i1 %.not130, %.not
  br i1 %or.cond160, label %11, label %12, !prof !13

11:                                               ; preds = %10
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.12, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 90) #8
  unreachable

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = getelementptr inbounds i8, ptr %0, i64 5
  %15 = load i8, ptr %14, align 1, !tbaa !14
  %16 = sext i8 %15 to i64
  %17 = getelementptr inbounds [32 x ptr], ptr %13, i64 0, i64 %16
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 510, ptr nonnull %6) #9
  %19 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !16
  %20 = icmp ugt i8 %19, 4
  br i1 %20, label %21, label %37, !prof !17

21:                                               ; preds = %12
  %22 = tail call zeroext i1 @is_subpage(ptr noundef %18) #10
  %23 = select i1 %22, ptr @.str.2, ptr @.str.3
  %24 = getelementptr inbounds i8, ptr %18, i64 16
  %25 = load i32, ptr %24, align 1, !tbaa !18
  br i1 %.not130, label %29, label %26

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %3, i64 8
  %28 = load i64, ptr %27, align 8, !tbaa !19
  br label %29

29:                                               ; preds = %21, %26
  %30 = phi i64 [ %28, %26 ], [ 0, %21 ]
  br i1 %.not128, label %34, label %31

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %2, i64 8
  %33 = load i64, ptr %32, align 8, !tbaa !19
  br label %34

34:                                               ; preds = %29, %31
  %35 = phi i64 [ %33, %31 ], [ 0, %29 ]
  %36 = call ptr @mdbx_dump_val(ptr noundef %2, ptr noundef nonnull %6, i64 noundef 255) #9
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 95, ptr noundef nonnull @.str.13, ptr noundef nonnull %23, i32 noundef %25, i64 noundef %1, i64 noundef %30, i64 noundef %35, ptr noundef %36) #9
  %.pre = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  br label %37

37:                                               ; preds = %12, %34
  %38 = phi i8 [ %7, %12 ], [ %.pre, %34 ]
  %39 = and i8 %38, 1
  %.not133 = icmp eq i8 %39, 0
  br i1 %.not133, label %.thread, label %40, !prof !17

40:                                               ; preds = %37
  %.not136 = or i1 %.not128, %.not130
  br i1 %.not136, label %41, label %46, !prof !17

41:                                               ; preds = %40
  %42 = getelementptr inbounds i8, ptr %0, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %43, i64 80
  %45 = load ptr, ptr %44, align 8, !tbaa !23
  call void @mdbx_assert_fail(ptr noundef %45, ptr noundef nonnull @.str.14, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 96) #8
  unreachable

46:                                               ; preds = %40
  %47 = call zeroext i8 @page_type_compat(ptr noundef %18) #10
  %.not138 = icmp eq i8 %47, 2
  br i1 %.not138, label %.thread, label %48, !prof !28

48:                                               ; preds = %46
  %49 = getelementptr inbounds i8, ptr %0, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = getelementptr inbounds i8, ptr %50, i64 80
  %52 = load ptr, ptr %51, align 8, !tbaa !23
  call void @mdbx_assert_fail(ptr noundef %52, ptr noundef nonnull @.str.15, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 97) #8
  unreachable

.thread:                                          ; preds = %37, %46
  %53 = and i32 %4, 1
  %.not139 = icmp eq i32 %53, 0
  br i1 %.not139, label %66, label %54, !prof !28

54:                                               ; preds = %.thread
  %55 = getelementptr inbounds i8, ptr %2, i64 8
  %56 = load i64, ptr %55, align 8, !tbaa !19
  %57 = call i64 @node_size_len(i64 noundef %56, i64 noundef 0) #11
  %58 = add i64 %57, 6
  br i1 %.not133, label %.thread162.thread, label %59, !prof !17

59:                                               ; preds = %54
  %60 = call i64 @page_room(ptr noundef %18) #10
  %.not154 = icmp ult i64 %60, %58
  br i1 %.not154, label %61, label %.thread162, !prof !17

61:                                               ; preds = %59
  %62 = getelementptr inbounds i8, ptr %0, i64 16
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  %64 = getelementptr inbounds i8, ptr %63, i64 80
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  call void @mdbx_assert_fail(ptr noundef %65, ptr noundef nonnull @.str.16, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 105) #8
  unreachable

66:                                               ; preds = %.thread
  %67 = call i64 @node_size(ptr noundef %2, ptr noundef %3) #10
  %68 = getelementptr inbounds i8, ptr %0, i64 16
  %69 = load ptr, ptr %68, align 8, !tbaa !21
  %70 = getelementptr inbounds i8, ptr %69, i64 80
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  %72 = getelementptr inbounds i8, ptr %71, i64 112
  %73 = load i16, ptr %72, align 8, !tbaa !29
  %74 = zext i16 %73 to i64
  %75 = icmp ugt i64 %67, %74
  br i1 %75, label %76, label %126, !prof !17

76:                                               ; preds = %66
  %77 = getelementptr inbounds i8, ptr %0, i64 24
  %78 = load ptr, ptr %77, align 8, !tbaa !38
  %79 = load i16, ptr %78, align 4, !tbaa !39
  %80 = zext i16 %79 to i32
  %81 = and i32 %80, 4
  %.not144 = icmp eq i32 %81, 0
  br i1 %.not144, label %85, label %82, !prof !28

82:                                               ; preds = %76
  %83 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !16
  %.not152 = icmp eq i8 %83, 0
  br i1 %.not152, label %209, label %84, !prof !28

84:                                               ; preds = %82
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 109, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.18, i32 noundef %80) #9
  br label %209

85:                                               ; preds = %76
  %86 = and i32 %4, 6
  %.not145 = icmp eq i32 %86, 0
  br i1 %.not145, label %90, label %87, !prof !28

87:                                               ; preds = %85
  %88 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !16
  %.not151 = icmp eq i8 %88, 0
  br i1 %.not151, label %209, label %89, !prof !28

89:                                               ; preds = %87
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 113, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.19, i32 noundef %4) #9
  br label %209

90:                                               ; preds = %85
  br i1 %.not133, label %95, label %91, !prof !17

91:                                               ; preds = %90
  %92 = call i64 @page_room(ptr noundef %18) #10
  %93 = call i64 @leaf_size(ptr noundef nonnull %71, ptr noundef %2, ptr noundef %3) #10
  %.not147 = icmp ult i64 %92, %93
  br i1 %.not147, label %94, label %95, !prof !17

94:                                               ; preds = %91
  call void @mdbx_assert_fail(ptr noundef nonnull %71, ptr noundef nonnull @.str.20, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 116) #8
  unreachable

95:                                               ; preds = %91, %90
  %96 = getelementptr inbounds i8, ptr %3, i64 8
  %97 = load i64, ptr %96, align 8, !tbaa !19
  %98 = call i32 @largechunk_npages(ptr noundef nonnull %71, i64 noundef %97) #10
  %99 = zext i32 %98 to i64
  %100 = call { ptr, i32 } @page_new_large(ptr noundef nonnull %0, i64 noundef %99) #9
  %101 = extractvalue { ptr, i32 } %100, 0
  %102 = extractvalue { ptr, i32 } %100, 1
  %.not148 = icmp eq i32 %102, 0
  br i1 %.not148, label %103, label %209, !prof !28

103:                                              ; preds = %95
  %104 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !16
  %105 = icmp ugt i8 %104, 4
  br i1 %105, label %106, label %112, !prof !17

106:                                              ; preds = %103
  %107 = getelementptr inbounds i8, ptr %101, i64 12
  %108 = load i32, ptr %107, align 1, !tbaa !14
  %109 = getelementptr inbounds i8, ptr %101, i64 16
  %110 = load i32, ptr %109, align 1, !tbaa !18
  %111 = load i64, ptr %96, align 8, !tbaa !19
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 123, ptr noundef nonnull @.str.21, i32 noundef %108, i32 noundef %110, i64 noundef %111) #9
  br label %112

112:                                              ; preds = %106, %103
  %113 = or disjoint i32 %4, 1
  %114 = getelementptr inbounds i8, ptr %2, i64 8
  %115 = load i64, ptr %114, align 8, !tbaa !19
  %116 = call i64 @node_size_len(i64 noundef %115, i64 noundef 0) #11
  %117 = add i64 %116, 6
  %118 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %119 = and i8 %118, 1
  %.not149 = icmp eq i8 %119, 0
  br i1 %.not149, label %.thread162.thread, label %120, !prof !17

120:                                              ; preds = %112
  %121 = load ptr, ptr %68, align 8, !tbaa !21
  %122 = getelementptr inbounds i8, ptr %121, i64 80
  %123 = load ptr, ptr %122, align 8, !tbaa !23
  %124 = call i64 @leaf_size(ptr noundef %123, ptr noundef nonnull %2, ptr noundef nonnull %3) #10
  %.not150 = icmp eq i64 %117, %124
  br i1 %.not150, label %.thread162, label %125, !prof !28

125:                                              ; preds = %120
  call void @mdbx_assert_fail(ptr noundef %123, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 126) #8
  unreachable

126:                                              ; preds = %66
  br i1 %.not133, label %.thread166, label %128, !prof !17

.thread166:                                       ; preds = %126
  %127 = add nuw nsw i64 %67, 2
  br label %.thread162.thread

128:                                              ; preds = %126
  %129 = call i64 @page_room(ptr noundef %18) #10
  %130 = call i64 @leaf_size(ptr noundef nonnull %71, ptr noundef %2, ptr noundef %3) #10
  %.not141 = icmp ult i64 %129, %130
  br i1 %.not141, label %131, label %132, !prof !17

131:                                              ; preds = %128
  call void @mdbx_assert_fail(ptr noundef nonnull %71, ptr noundef nonnull @.str.20, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 128) #8
  unreachable

132:                                              ; preds = %128
  %133 = add nuw nsw i64 %67, 2
  %.not143 = icmp eq i64 %133, %130
  br i1 %.not143, label %.thread162, label %134, !prof !28

134:                                              ; preds = %132
  call void @mdbx_assert_fail(ptr noundef nonnull %71, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 130) #8
  unreachable

.thread162.thread:                                ; preds = %112, %.thread166, %54
  %.1120.ph = phi i64 [ %58, %54 ], [ %127, %.thread166 ], [ %117, %112 ]
  %.1117.ph = phi ptr [ null, %54 ], [ null, %.thread166 ], [ %101, %112 ]
  %.1115.ph = phi i32 [ %4, %54 ], [ %4, %.thread166 ], [ %113, %112 ]
  %135 = call i64 @page_numkeys(ptr noundef %18) #10
  br label %.preheader

.thread162:                                       ; preds = %120, %132, %59
  %.1120 = phi i64 [ %117, %120 ], [ %130, %132 ], [ %58, %59 ]
  %.1117 = phi ptr [ %101, %120 ], [ null, %132 ], [ null, %59 ]
  %.1115 = phi i32 [ %113, %120 ], [ %4, %132 ], [ %4, %59 ]
  %136 = call i64 @page_numkeys(ptr noundef %18) #10
  %.not156 = icmp ult i64 %136, %1
  br i1 %.not156, label %149, label %.preheader, !prof !41

.preheader:                                       ; preds = %.thread162.thread, %.thread162
  %137 = phi i64 [ %135, %.thread162.thread ], [ %136, %.thread162 ]
  %.1115177 = phi i32 [ %.1115.ph, %.thread162.thread ], [ %.1115, %.thread162 ]
  %.1117176 = phi ptr [ %.1117.ph, %.thread162.thread ], [ %.1117, %.thread162 ]
  %.1120175 = phi i64 [ %.1120.ph, %.thread162.thread ], [ %.1120, %.thread162 ]
  %138 = icmp ugt i64 %137, %1
  br i1 %138, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %139 = getelementptr inbounds i8, ptr %18, i64 20
  %140 = sub i64 %137, %1
  %min.iters.check = icmp ult i64 %140, 16
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.0118167.ph = phi i64 [ %137, %.lr.ph ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %140, -16
  %ind.end = sub i64 %137, %n.vec
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = sub i64 %137, %index
  %141 = add i64 %offset.idx, -1
  %142 = getelementptr inbounds [0 x i16], ptr %139, i64 0, i64 %141
  %143 = getelementptr inbounds i8, ptr %142, i64 -14
  %144 = getelementptr inbounds i8, ptr %142, i64 -30
  %wide.load = load <8 x i16>, ptr %143, align 1, !tbaa !42
  %wide.load178 = load <8 x i16>, ptr %144, align 1, !tbaa !42
  %145 = getelementptr inbounds [0 x i16], ptr %139, i64 0, i64 %offset.idx
  %146 = getelementptr inbounds i8, ptr %145, i64 -14
  %147 = getelementptr inbounds i8, ptr %145, i64 -30
  store <8 x i16> %wide.load, ptr %146, align 1, !tbaa !42
  store <8 x i16> %wide.load178, ptr %147, align 1, !tbaa !42
  %index.next = add nuw i64 %index, 16
  %148 = icmp eq i64 %index.next, %n.vec
  br i1 %148, label %middle.block, label %vector.body, !llvm.loop !43

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %140, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

149:                                              ; preds = %.thread162
  %150 = getelementptr inbounds i8, ptr %0, i64 16
  %151 = load ptr, ptr %150, align 8, !tbaa !21
  %152 = getelementptr inbounds i8, ptr %151, i64 80
  %153 = load ptr, ptr %152, align 8, !tbaa !23
  call void @mdbx_assert_fail(ptr noundef %153, ptr noundef nonnull @.str.8, ptr noundef nonnull @__func__.node_add_leaf, i32 noundef 135) #8
  unreachable

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.preheader
  %154 = getelementptr inbounds i8, ptr %18, i64 12
  %155 = load i16, ptr %154, align 1, !tbaa !14
  %156 = zext i16 %155 to i64
  %157 = add nuw nsw i64 %156, 2
  %158 = getelementptr inbounds i8, ptr %18, i64 14
  %159 = load i16, ptr %158, align 1, !tbaa !14
  %160 = zext i16 %159 to i64
  %reass.sub = sub i64 %160, %.1120175
  %161 = add i64 %reass.sub, 2
  %162 = icmp sgt i64 %157, %161
  br i1 %162, label %168, label %174, !prof !17

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.0118167 = phi i64 [ %163, %scalar.ph ], [ %.0118167.ph, %scalar.ph.preheader ]
  %163 = add i64 %.0118167, -1
  %164 = getelementptr inbounds [0 x i16], ptr %139, i64 0, i64 %163
  %165 = load i16, ptr %164, align 1, !tbaa !42
  %166 = getelementptr inbounds [0 x i16], ptr %139, i64 0, i64 %.0118167
  store i16 %165, ptr %166, align 1, !tbaa !42
  %167 = icmp ugt i64 %163, %1
  br i1 %167, label %scalar.ph, label %._crit_edge, !llvm.loop !47

168:                                              ; preds = %._crit_edge
  %169 = getelementptr inbounds i8, ptr %0, i64 16
  %170 = load ptr, ptr %169, align 8, !tbaa !21
  %171 = getelementptr inbounds i8, ptr %170, i64 4
  %172 = load i32, ptr %171, align 4, !tbaa !48
  %173 = or i32 %172, 2
  store i32 %173, ptr %171, align 4, !tbaa !48
  br label %209

174:                                              ; preds = %._crit_edge
  %175 = trunc i64 %157 to i16
  store i16 %175, ptr %154, align 1, !tbaa !14
  %176 = trunc i64 %161 to i16
  store i16 %176, ptr %158, align 1, !tbaa !14
  %177 = getelementptr inbounds i8, ptr %18, i64 20
  %178 = getelementptr inbounds [0 x i16], ptr %177, i64 0, i64 %1
  store i16 %176, ptr %178, align 1, !tbaa !42
  %179 = call ptr @page_node(ptr noundef nonnull %18, i64 noundef %1) #10
  %180 = getelementptr inbounds i8, ptr %2, i64 8
  %181 = load i64, ptr %180, align 8, !tbaa !19
  call void @node_set_ks(ptr noundef %179, i64 noundef %181)
  %182 = trunc i32 %.1115177 to i8
  call void @node_set_flags(ptr noundef %179, i8 noundef zeroext %182)
  %183 = ptrtoint ptr %179 to i64
  %184 = add nsw i64 %183, 5
  %185 = inttoptr i64 %184 to ptr
  call void @poke_u8(ptr noundef %185, i8 noundef zeroext 0)
  %186 = getelementptr inbounds i8, ptr %3, i64 8
  %187 = load i64, ptr %186, align 8, !tbaa !19
  call void @node_set_ds(ptr noundef %179, i64 noundef %187)
  %188 = call ptr @node_key(ptr noundef %179) #10
  %189 = load ptr, ptr %2, align 8, !tbaa !49
  %190 = load i64, ptr %180, align 8, !tbaa !19
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %188, ptr align 1 %189, i64 %190, i1 false)
  %191 = call ptr @node_data(ptr noundef %179) #10
  %192 = icmp eq ptr %.1117176, null
  br i1 %192, label %193, label %198, !prof !28

193:                                              ; preds = %174
  %194 = and i32 %.1115177, 1
  %.not157 = icmp eq i32 %194, 0
  br i1 %.not157, label %202, label %195, !prof !28

195:                                              ; preds = %193
  %196 = load ptr, ptr %3, align 8, !tbaa !49
  %197 = load i32, ptr %196, align 1
  store i32 %197, ptr %191, align 1
  br label %209

198:                                              ; preds = %174
  %199 = getelementptr inbounds i8, ptr %.1117176, i64 16
  %200 = load i32, ptr %199, align 1, !tbaa !18
  call void @poke_pgno(ptr noundef %191, i32 noundef %200)
  %201 = call ptr @page_data(ptr noundef nonnull %.1117176) #10
  br label %202

202:                                              ; preds = %193, %198
  %.0 = phi ptr [ %191, %193 ], [ %201, %198 ]
  %203 = and i32 %.1115177, 65536
  %.not158 = icmp eq i32 %203, 0
  br i1 %.not158, label %205, label %204, !prof !28

204:                                              ; preds = %202
  store ptr %.0, ptr %3, align 8, !tbaa !49
  br label %209

205:                                              ; preds = %202
  %206 = load i64, ptr %186, align 8, !tbaa !19
  %.not159 = icmp eq i64 %206, 0
  br i1 %.not159, label %209, label %207, !prof !17

207:                                              ; preds = %205
  %208 = load ptr, ptr %3, align 8, !tbaa !49
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.0, ptr align 1 %208, i64 %206, i1 false)
  br label %209

209:                                              ; preds = %95, %168, %204, %207, %205, %195, %87, %89, %82, %84
  %.3 = phi i32 [ -30779, %84 ], [ -30779, %82 ], [ -30779, %89 ], [ -30779, %87 ], [ -30786, %168 ], [ 0, %204 ], [ 0, %207 ], [ 0, %205 ], [ 0, %195 ], [ %102, %95 ]
  call void @llvm.lifetime.end.p0(i64 510, ptr nonnull %6) #9
  ret i32 %.3
}

; Function Attrs: inlinehint mustprogress nofree nosync nounwind willreturn memory(none) uwtable
declare hidden i64 @node_size_len(i64 noundef, i64 noundef) local_unnamed_addr #7

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

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

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

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

declare { ptr, i32 } @page_new_large(ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @poke_pgno(ptr noalias noundef, i32 noundef) local_unnamed_addr #5

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { hot 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 = { inlinehint mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { 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, !7, i64 25}
!6 = !{!"libmdbx_globals", !7, i64 0, !9, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !9, i64 28, !7, i64 32, !7, i64 40, !11, i64 80, !12, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"branch_weights", i32 2000, i32 4002001}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !12, i64 0}
!16 = !{!6, !7, i64 26}
!17 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!18 = !{!9, !9, i64 0}
!19 = !{!20, !11, i64 8}
!20 = !{!"iovec", !12, i64 0, !11, i64 8}
!21 = !{!22, !12, i64 16}
!22 = !{!"MDBX_cursor", !9, i64 0, !7, i64 4, !7, i64 6, !7, i64 7, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !7, i64 48, !7, i64 304, !12, i64 368, !12, i64 376}
!23 = !{!24, !12, i64 80}
!24 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !25, i64 40, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !27, i64 128, !12, i64 160, !7, i64 168}
!25 = !{!"geo", !26, i64 0, !26, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!26 = !{!"short", !7, i64 0}
!27 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!28 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!29 = !{!30, !26, i64 112}
!30 = !{!"MDBX_env", !7, i64 0, !9, i64 4, !9, i64 8, !31, i64 16, !9, i64 56, !9, i64 60, !31, i64 64, !12, i64 104, !26, i64 112, !26, i64 114, !26, i64 116, !26, i64 118, !26, i64 120, !26, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !26, i64 130, !9, i64 132, !9, i64 136, !9, i64 140, !9, i64 144, !32, i64 152, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !9, i64 224, !9, i64 228, !9, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !33, i64 264, !35, i64 320, !10, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !36, i64 392, !7, i64 400, !9, i64 440, !9, i64 444, !12, i64 448, !37, i64 456, !7, i64 496, !7, i64 536}
!31 = !{!"osal_mmap", !7, i64 0, !9, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!32 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!33 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !11, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !9, i64 28, !9, i64 32, !10, i64 36, !10, i64 37, !10, i64 38, !34, i64 40, !7, i64 48}
!34 = !{!"", !26, i64 0, !26, i64 2, !26, i64 4, !26, i64 6}
!35 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!36 = !{!"", !11, i64 0}
!37 = !{!"osal_ioring", !9, i64 0, !9, i64 4, !9, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!38 = !{!22, !12, i64 24}
!39 = !{!40, !26, i64 0}
!40 = !{!"tree", !26, i64 0, !26, i64 2, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !11, i64 24, !11, i64 32, !11, i64 40}
!41 = !{!"branch_weights", i32 1073205, i32 2146410443}
!42 = !{!26, !26, i64 0}
!43 = distinct !{!43, !44, !45, !46}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!"llvm.loop.isvectorized", i32 1}
!46 = !{!"llvm.loop.unroll.runtime.disable"}
!47 = distinct !{!47, !44, !46, !45}
!48 = !{!24, !9, i64 4}
!49 = !{!20, !12, i64 0}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass