; LLVM IR from erthink/libmdbx :: src (tree-search)

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

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.node_search_result = type { ptr, i8 }
%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.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.4 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.2, %union.anon.3 }
%union.anon.2 = type { i32 }
%union.anon.3 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.4 = type { %struct.anon.6 }
%struct.anon.6 = type { %struct.troika, ptr, %struct.anon.7, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.8 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.7 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.8 = type { %struct.anon.9 }
%struct.anon.9 = type { i64, ptr }
%struct.anon.1 = type { i8, i8 }
%struct.page = type <{ i64, i16, i16, %union.anon.10, i32, [0 x i16] }>
%union.anon.10 = type { i32 }

@globals = external global %struct.libmdbx_globals, align 8
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@__func__.tree_search_finalize = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1

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

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

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

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

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden i32 @node_pgno(ptr noalias noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cursor_push(ptr noundef, ptr noundef, i16 noundef zeroext) #4

; Function Attrs: hot noinline nounwind uwtable
define dso_local i32 @tree_search_finalize(ptr noundef %0, ptr noundef %1, i32 noundef %2) #5 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [510 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca %struct.node_search_result, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %3
  %15 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !11
  %16 = zext i8 %15 to i32
  %17 = and i32 %16, 1
  %18 = icmp ne i32 %17, 0
  %19 = xor i1 %18, true
  %20 = xor i1 %19, true
  %21 = zext i1 %20 to i32
  %22 = sext i32 %21 to i64
  %23 = call i64 @llvm.expect.i64(i64 %22, i64 1)
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %45

25:                                               ; preds = %14
  br label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call zeroext i1 @is_poor(ptr noundef %27) #7
  %29 = xor i1 %28, true
  %30 = xor i1 %29, true
  %31 = xor i1 %30, true
  %32 = xor i1 %31, true
  %33 = zext i1 %32 to i32
  %34 = sext i32 %33 to i64
  %35 = call i64 @llvm.expect.i64(i64 %34, i64 0)
  %36 = icmp ne i64 %35, 0
  br i1 %36, label %37, label %43

37:                                               ; preds = %26
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.MDBX_cursor, ptr %38, i32 0, i32 5
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = getelementptr inbounds %struct.MDBX_txn, ptr %40, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  call void @mdbx_assert_fail(ptr noundef %42, ptr noundef @.str.8, ptr noundef @__func__.tree_search_finalize, i32 noundef 90) #8
  unreachable

43:                                               ; preds = %26
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44, %14
  br label %46

46:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 510, ptr %8) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MDBX_cursor, ptr %47, i32 0, i32 9
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MDBX_cursor, ptr %49, i32 0, i32 1
  %51 = getelementptr inbounds %struct.anon.1, ptr %50, i32 0, i32 1
  %52 = load i8, ptr %51, align 1, !tbaa !22
  %53 = sext i8 %52 to i64
  %54 = getelementptr inbounds [32 x ptr], ptr %48, i64 0, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  store ptr %55, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %56 = load i32, ptr %7, align 4, !tbaa !9
  %57 = and i32 %56, 4
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %46
  br label %64

60:                                               ; preds = %46
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = call i64 @page_numkeys(ptr noundef %61) #7
  %63 = sub i64 %62, 1
  br label %64

64:                                               ; preds = %60, %59
  %65 = phi i64 [ 0, %59 ], [ %63, %60 ]
  store i64 %65, ptr %11, align 8, !tbaa !23
  br label %66

66:                                               ; preds = %277, %64
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = call zeroext i1 @is_branch(ptr noundef %67) #7
  br i1 %68, label %69, label %278

69:                                               ; preds = %66
  br label %70

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

80:                                               ; preds = %70
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.page, ptr %81, i32 0, i32 4
  %83 = load i32, ptr %82, align 1, !tbaa !9
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = call i64 @page_numkeys(ptr noundef %84) #7
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.tree_search_finalize, i32 noundef 96, ptr noundef @.str.9, i32 noundef %83, i64 noundef %85)
  br label %86

86:                                               ; preds = %80, %70
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !11
  %91 = zext i8 %90 to i32
  %92 = and i32 %91, 1
  %93 = icmp ne i32 %92, 0
  %94 = xor i1 %93, true
  %95 = xor i1 %94, true
  %96 = zext i1 %95 to i32
  %97 = sext i32 %96 to i64
  %98 = call i64 @llvm.expect.i64(i64 %97, i64 1)
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %121

100:                                              ; preds = %89
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = call i64 @page_numkeys(ptr noundef %102) #7
  %104 = icmp ugt i64 %103, 1
  %105 = xor i1 %104, true
  %106 = xor i1 %105, true
  %107 = xor i1 %106, true
  %108 = zext i1 %107 to i32
  %109 = sext i32 %108 to i64
  %110 = call i64 @llvm.expect.i64(i64 %109, i64 0)
  %111 = icmp ne i64 %110, 0
  br i1 %111, label %112, label %118

112:                                              ; preds = %101
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.MDBX_cursor, ptr %113, i32 0, i32 5
  %115 = load ptr, ptr %114, align 8, !tbaa !15
  %116 = getelementptr inbounds %struct.MDBX_txn, ptr %115, i32 0, i32 9
  %117 = load ptr, ptr %116, align 8, !tbaa !17
  call void @mdbx_assert_fail(ptr noundef %117, ptr noundef @.str.10, ptr noundef @__func__.tree_search_finalize, i32 noundef 97) #8
  unreachable

118:                                              ; preds = %101
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120, %89
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !24
  %126 = zext i8 %125 to i32
  %127 = icmp sle i32 5, %126
  %128 = xor i1 %127, true
  %129 = xor i1 %128, true
  %130 = zext i1 %129 to i32
  %131 = sext i32 %130 to i64
  %132 = call i64 @llvm.expect.i64(i64 %131, i64 0)
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %138

134:                                              ; preds = %124
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = call ptr @page_node(ptr noundef %135, i64 noundef 0) #7
  %137 = call i32 @node_pgno(ptr noundef %136) #7
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.tree_search_finalize, i32 noundef 98, ptr noundef @.str.11, i32 noundef %137)
  br label %138

138:                                              ; preds = %134, %124
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %7, align 4, !tbaa !9
  %142 = and i32 %141, 12
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %144, label %197

144:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #9
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = call { ptr, i8 } @node_search(ptr noundef %145, ptr noundef %146)
  %148 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %149 = extractvalue { ptr, i8 } %147, 0
  store ptr %149, ptr %148, align 8
  %150 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %151 = extractvalue { ptr, i8 } %147, 1
  store i8 %151, ptr %150, align 8
  %152 = getelementptr inbounds %struct.node_search_result, ptr %12, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !25
  %154 = icmp ne ptr %153, null
  %155 = xor i1 %154, true
  %156 = xor i1 %155, true
  %157 = zext i1 %156 to i32
  %158 = sext i32 %157 to i64
  %159 = call i64 @llvm.expect.i64(i64 %158, i64 1)
  %160 = icmp ne i64 %159, 0
  br i1 %160, label %161, label %178

161:                                              ; preds = %144
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.MDBX_cursor, ptr %162, i32 0, i32 10
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.MDBX_cursor, ptr %164, i32 0, i32 1
  %166 = getelementptr inbounds %struct.anon.1, ptr %165, i32 0, i32 1
  %167 = load i8, ptr %166, align 1, !tbaa !22
  %168 = sext i8 %167 to i64
  %169 = getelementptr inbounds [32 x i16], ptr %163, i64 0, i64 %168
  %170 = load i16, ptr %169, align 2, !tbaa !27
  %171 = zext i16 %170 to i64
  %172 = getelementptr inbounds %struct.node_search_result, ptr %12, i32 0, i32 1
  %173 = load i8, ptr %172, align 8, !tbaa !28, !range !29, !noundef !30
  %174 = trunc i8 %173 to i1
  %175 = zext i1 %174 to i64
  %176 = add nsw i64 %171, %175
  %177 = sub nsw i64 %176, 1
  store i64 %177, ptr %11, align 8, !tbaa !23
  br label %178

178:                                              ; preds = %161, %144
  br label %179

179:                                              ; preds = %178
  %180 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !24
  %181 = zext i8 %180 to i32
  %182 = icmp sle i32 5, %181
  %183 = xor i1 %182, true
  %184 = xor i1 %183, true
  %185 = zext i1 %184 to i32
  %186 = sext i32 %185 to i64
  %187 = call i64 @llvm.expect.i64(i64 %186, i64 0)
  %188 = icmp ne i64 %187, 0
  br i1 %188, label %189, label %194

189:                                              ; preds = %179
  %190 = load i64, ptr %11, align 8, !tbaa !23
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = getelementptr inbounds [510 x i8], ptr %8, i64 0, i64 0
  %193 = call ptr @mdbx_dump_val(ptr noundef %191, ptr noundef %192, i64 noundef 255)
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.tree_search_finalize, i32 noundef 104, ptr noundef @.str.12, i64 noundef %190, ptr noundef %193)
  br label %194

194:                                              ; preds = %189, %179
  br label %195

195:                                              ; preds = %194
  br label %196

196:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #9
  br label %197

197:                                              ; preds = %196, %140
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = load ptr, ptr %10, align 8, !tbaa !5
  %200 = load i64, ptr %11, align 8, !tbaa !23
  %201 = call ptr @page_node(ptr noundef %199, i64 noundef %200) #7
  %202 = call i32 @node_pgno(ptr noundef %201) #7
  %203 = load ptr, ptr %10, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.page, ptr %203, i32 0, i32 0
  %205 = load i64, ptr %204, align 1, !tbaa !23
  %206 = call i32 @page_get(ptr noundef %198, i32 noundef %202, ptr noundef %10, i64 noundef %205)
  store i32 %206, ptr %9, align 4, !tbaa !9
  %207 = load i32, ptr %9, align 4, !tbaa !9
  %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 %216

215:                                              ; preds = %197
  br label %311

216:                                              ; preds = %197
  %217 = load i64, ptr %11, align 8, !tbaa !23
  %218 = trunc i64 %217 to i16
  %219 = load ptr, ptr %5, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.MDBX_cursor, ptr %219, i32 0, i32 10
  %221 = load ptr, ptr %5, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.MDBX_cursor, ptr %221, i32 0, i32 1
  %223 = getelementptr inbounds %struct.anon.1, ptr %222, i32 0, i32 1
  %224 = load i8, ptr %223, align 1, !tbaa !22
  %225 = sext i8 %224 to i64
  %226 = getelementptr inbounds [32 x i16], ptr %220, i64 0, i64 %225
  store i16 %218, ptr %226, align 2, !tbaa !27
  %227 = load i32, ptr %7, align 4, !tbaa !9
  %228 = and i32 %227, 4
  %229 = icmp ne i32 %228, 0
  br i1 %229, label %230, label %231

230:                                              ; preds = %216
  br label %235

231:                                              ; preds = %216
  %232 = load ptr, ptr %10, align 8, !tbaa !5
  %233 = call i64 @page_numkeys(ptr noundef %232) #7
  %234 = sub i64 %233, 1
  br label %235

235:                                              ; preds = %231, %230
  %236 = phi i64 [ 0, %230 ], [ %234, %231 ]
  store i64 %236, ptr %11, align 8, !tbaa !23
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = load ptr, ptr %10, align 8, !tbaa !5
  %239 = load i64, ptr %11, align 8, !tbaa !23
  %240 = trunc i64 %239 to i16
  %241 = call i32 @cursor_push(ptr noundef %237, ptr noundef %238, i16 noundef zeroext %240)
  store i32 %241, ptr %9, align 4, !tbaa !9
  %242 = load i32, ptr %9, align 4, !tbaa !9
  %243 = icmp ne i32 %242, 0
  %244 = xor i1 %243, true
  %245 = xor i1 %244, true
  %246 = zext i1 %245 to i32
  %247 = sext i32 %246 to i64
  %248 = call i64 @llvm.expect.i64(i64 %247, i64 0)
  %249 = icmp ne i64 %248, 0
  br i1 %249, label %250, label %251

250:                                              ; preds = %235
  br label %311

251:                                              ; preds = %235
  %252 = load i32, ptr %7, align 4, !tbaa !9
  %253 = and i32 %252, 1
  %254 = icmp ne i32 %253, 0
  br i1 %254, label %255, label %277

255:                                              ; preds = %251
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  %257 = call i32 @page_touch(ptr noundef %256)
  store i32 %257, ptr %9, align 4, !tbaa !9
  %258 = load i32, ptr %9, align 4, !tbaa !9
  %259 = icmp ne i32 %258, 0
  %260 = xor i1 %259, true
  %261 = xor i1 %260, true
  %262 = zext i1 %261 to i32
  %263 = sext i32 %262 to i64
  %264 = call i64 @llvm.expect.i64(i64 %263, i64 0)
  %265 = icmp ne i64 %264, 0
  br i1 %265, label %266, label %267

266:                                              ; preds = %255
  br label %311

267:                                              ; preds = %255
  %268 = load ptr, ptr %5, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.MDBX_cursor, ptr %268, i32 0, i32 9
  %270 = load ptr, ptr %5, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.MDBX_cursor, ptr %270, i32 0, i32 1
  %272 = getelementptr inbounds %struct.anon.1, ptr %271, i32 0, i32 1
  %273 = load i8, ptr %272, align 1, !tbaa !22
  %274 = sext i8 %273 to i64
  %275 = getelementptr inbounds [32 x ptr], ptr %269, i64 0, i64 %274
  %276 = load ptr, ptr %275, align 8, !tbaa !5
  store ptr %276, ptr %10, align 8, !tbaa !5
  br label %277

277:                                              ; preds = %267, %251
  br label %66, !llvm.loop !31

278:                                              ; preds = %66
  %279 = load ptr, ptr %5, align 8, !tbaa !5
  %280 = load ptr, ptr %10, align 8, !tbaa !5
  %281 = call zeroext i1 @check_leaf_type(ptr noundef %279, ptr noundef %280) #7
  %282 = xor i1 %281, true
  %283 = xor i1 %282, true
  %284 = xor i1 %283, true
  %285 = zext i1 %284 to i32
  %286 = sext i32 %285 to i64
  %287 = call i64 @llvm.expect.i64(i64 %286, i64 0)
  %288 = icmp ne i64 %287, 0
  br i1 %288, label %289, label %314

289:                                              ; preds = %278
  br label %290

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

300:                                              ; preds = %290
  %301 = load ptr, ptr %10, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.page, ptr %301, i32 0, i32 4
  %303 = load i32, ptr %302, align 1, !tbaa !9
  %304 = load ptr, ptr %10, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.page, ptr %304, i32 0, i32 2
  %306 = load i16, ptr %305, align 1, !tbaa !27
  %307 = zext i16 %306 to i32
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.tree_search_finalize, i32 noundef 126, ptr noundef @.str.13, i32 noundef %303, i32 noundef %307)
  br label %308

308:                                              ; preds = %300, %290
  br label %309

309:                                              ; preds = %308
  br label %310

310:                                              ; preds = %309
  store i32 -30796, ptr %9, align 4, !tbaa !9
  br label %311

311:                                              ; preds = %310, %266, %250, %215
  %312 = load ptr, ptr %5, align 8, !tbaa !5
  call void @be_poor(ptr noundef %312)
  %313 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %313, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %335

314:                                              ; preds = %278
  br label %315

315:                                              ; preds = %314
  %316 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !24
  %317 = zext i8 %316 to i32
  %318 = icmp sle i32 5, %317
  %319 = xor i1 %318, true
  %320 = xor i1 %319, true
  %321 = zext i1 %320 to i32
  %322 = sext i32 %321 to i64
  %323 = call i64 @llvm.expect.i64(i64 %322, i64 0)
  %324 = icmp ne i64 %323, 0
  br i1 %324, label %325, label %332

325:                                              ; preds = %315
  %326 = load ptr, ptr %10, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.page, ptr %326, i32 0, i32 4
  %328 = load i32, ptr %327, align 1, !tbaa !9
  %329 = load ptr, ptr %6, align 8, !tbaa !5
  %330 = getelementptr inbounds [510 x i8], ptr %8, i64 0, i64 0
  %331 = call ptr @mdbx_dump_val(ptr noundef %329, ptr noundef %330, i64 noundef 255)
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.tree_search_finalize, i32 noundef 133, ptr noundef @.str.14, i32 noundef %328, ptr noundef %331)
  br label %332

332:                                              ; preds = %325, %315
  br label %333

333:                                              ; preds = %332
  br label %334

334:                                              ; preds = %333
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %335

335:                                              ; preds = %334, %311
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 510, ptr %8) #9
  %336 = load i32, ptr %4, align 4
  ret i32 %336
}

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @be_poor(ptr noundef) #4

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @page_touch(ptr noundef) #4

declare { ptr, i8 } @node_search(ptr noundef, ptr noundef) #6

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

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

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

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

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


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

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

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str.8 = external hidden unnamed_addr constant [13 x i8], align 1
@__func__.tree_search_finalize = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: noreturn
declare void @mdbx_assert_fail(ptr noundef, ptr 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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @is_branch(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 #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cursor_push(ptr noundef, ptr noundef, i16 noundef zeroext) local_unnamed_addr #3

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

8:                                                ; preds = %3
  %9 = tail call zeroext i1 @is_poor(ptr noundef %0) #6
  br i1 %9, label %10, label %15, !prof !13

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %12, i64 80
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  tail call void @mdbx_assert_fail(ptr noundef %14, ptr noundef nonnull @.str.8, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 90) #7
  unreachable

15:                                               ; preds = %3, %8
  call void @llvm.lifetime.start.p0(i64 510, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = getelementptr inbounds i8, ptr %0, i64 5
  %18 = load i8, ptr %17, align 1, !tbaa !21
  %19 = sext i8 %18 to i64
  %20 = getelementptr inbounds [32 x ptr], ptr %16, i64 0, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !22
  store ptr %21, ptr %5, align 8, !tbaa !22
  %22 = and i32 %2, 4
  %.not37 = icmp eq i32 %22, 0
  br i1 %.not37, label %23, label %26

23:                                               ; preds = %15
  %24 = tail call i64 @page_numkeys(ptr noundef %21) #6
  %25 = add i64 %24, -1
  br label %26

26:                                               ; preds = %15, %23
  %27 = phi i64 [ %25, %23 ], [ 0, %15 ]
  %28 = tail call zeroext i1 @is_branch(ptr noundef %21) #6
  br i1 %28, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %26
  %29 = and i32 %2, 12
  %30 = icmp eq i32 %29, 0
  %31 = getelementptr inbounds i8, ptr %0, i64 304
  %32 = and i32 %2, 1
  %.not43 = icmp eq i32 %32, 0
  br label %33

33:                                               ; preds = %.lr.ph, %106
  %34 = phi ptr [ %21, %.lr.ph ], [ %107, %106 ]
  %.03347 = phi i64 [ %27, %.lr.ph ], [ %95, %106 ]
  %35 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  %36 = icmp ugt i8 %35, 4
  br i1 %36, label %37, label %41, !prof !13

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %34, i64 16
  %39 = load i32, ptr %38, align 1, !tbaa !24
  %40 = call i64 @page_numkeys(ptr noundef %34) #6
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 96, ptr noundef nonnull @.str.9, i32 noundef %39, i64 noundef %40) #8
  br label %41

41:                                               ; preds = %33, %37
  %42 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %43 = and i8 %42, 1
  %.not39 = icmp eq i8 %43, 0
  br i1 %.not39, label %53, label %44, !prof !13

44:                                               ; preds = %41
  %45 = load ptr, ptr %5, align 8, !tbaa !22
  %46 = call i64 @page_numkeys(ptr noundef %45) #6
  %47 = icmp ult i64 %46, 2
  br i1 %47, label %48, label %53, !prof !13

48:                                               ; preds = %44
  %49 = getelementptr inbounds i8, ptr %0, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = getelementptr inbounds i8, ptr %50, i64 80
  %52 = load ptr, ptr %51, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %52, ptr noundef nonnull @.str.10, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 97) #7
  unreachable

53:                                               ; preds = %41, %44
  %54 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  %55 = icmp ugt i8 %54, 4
  br i1 %55, label %56, label %60, !prof !13

56:                                               ; preds = %53
  %57 = load ptr, ptr %5, align 8, !tbaa !22
  %58 = call ptr @page_node(ptr noundef %57, i64 noundef 0) #6
  %59 = call i32 @node_pgno(ptr noundef %58) #6
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 98, ptr noundef nonnull @.str.11, i32 noundef %59) #8
  br label %60

60:                                               ; preds = %56, %53
  br i1 %30, label %61, label %80

61:                                               ; preds = %60
  %62 = call { ptr, i8 } @node_search(ptr noundef nonnull %0, ptr noundef %1) #8
  %63 = extractvalue { ptr, i8 } %62, 0
  %.not40 = icmp eq ptr %63, null
  br i1 %.not40, label %75, label %64, !prof !13

64:                                               ; preds = %61
  %65 = extractvalue { ptr, i8 } %62, 1
  %66 = load i8, ptr %17, align 1, !tbaa !21
  %67 = sext i8 %66 to i64
  %68 = getelementptr inbounds [32 x i16], ptr %31, i64 0, i64 %67
  %69 = load i16, ptr %68, align 2, !tbaa !25
  %70 = zext i16 %69 to i64
  %71 = and i8 %65, 1
  %72 = zext nneg i8 %71 to i64
  %73 = add nsw i64 %72, -1
  %74 = add nsw i64 %73, %70
  br label %75

75:                                               ; preds = %61, %64
  %.1 = phi i64 [ %74, %64 ], [ %.03347, %61 ]
  %76 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  %77 = icmp ugt i8 %76, 4
  br i1 %77, label %78, label %80, !prof !13

78:                                               ; preds = %75
  %79 = call ptr @mdbx_dump_val(ptr noundef %1, ptr noundef nonnull %4, i64 noundef 255) #8
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 104, ptr noundef nonnull @.str.12, i64 noundef %.1, ptr noundef %79) #8
  br label %80

80:                                               ; preds = %75, %78, %60
  %.2 = phi i64 [ %.03347, %60 ], [ %.1, %78 ], [ %.1, %75 ]
  %81 = load ptr, ptr %5, align 8, !tbaa !22
  %82 = call ptr @page_node(ptr noundef %81, i64 noundef %.2) #6
  %83 = call i32 @node_pgno(ptr noundef %82) #6
  %84 = load i64, ptr %81, align 1, !tbaa !26
  %85 = call i32 @page_get(ptr noundef nonnull %0, i32 noundef %83, ptr noundef nonnull %5, i64 noundef %84)
  %.not41 = icmp eq i32 %85, 0
  br i1 %.not41, label %86, label %.loopexit, !prof !27

86:                                               ; preds = %80
  %87 = trunc i64 %.2 to i16
  %88 = load i8, ptr %17, align 1, !tbaa !21
  %89 = sext i8 %88 to i64
  %90 = getelementptr inbounds [32 x i16], ptr %31, i64 0, i64 %89
  store i16 %87, ptr %90, align 2, !tbaa !25
  %.pre = load ptr, ptr %5, align 8, !tbaa !22
  br i1 %.not37, label %91, label %94

91:                                               ; preds = %86
  %92 = call i64 @page_numkeys(ptr noundef %.pre) #6
  %93 = add i64 %92, -1
  br label %94

94:                                               ; preds = %86, %91
  %95 = phi i64 [ %93, %91 ], [ 0, %86 ]
  %96 = trunc i64 %95 to i16
  %97 = call i32 @cursor_push(ptr noundef nonnull %0, ptr noundef %.pre, i16 noundef zeroext %96)
  %.not42 = icmp eq i32 %97, 0
  br i1 %.not42, label %98, label %.loopexit, !prof !27

98:                                               ; preds = %94
  br i1 %.not43, label %._crit_edge49, label %99

._crit_edge49:                                    ; preds = %98
  %.pre50 = load ptr, ptr %5, align 8, !tbaa !22
  br label %106

99:                                               ; preds = %98
  %100 = call i32 @page_touch(ptr noundef nonnull %0)
  %.not44 = icmp eq i32 %100, 0
  br i1 %.not44, label %101, label %.loopexit, !prof !27

101:                                              ; preds = %99
  %102 = load i8, ptr %17, align 1, !tbaa !21
  %103 = sext i8 %102 to i64
  %104 = getelementptr inbounds [32 x ptr], ptr %16, i64 0, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !22
  store ptr %105, ptr %5, align 8, !tbaa !22
  br label %106

106:                                              ; preds = %._crit_edge49, %101
  %107 = phi ptr [ %.pre50, %._crit_edge49 ], [ %105, %101 ]
  %108 = call zeroext i1 @is_branch(ptr noundef %107) #6
  br i1 %108, label %33, label %._crit_edge, !llvm.loop !28

._crit_edge:                                      ; preds = %106, %26
  %.lcssa = phi ptr [ %21, %26 ], [ %107, %106 ]
  %109 = call zeroext i1 @check_leaf_type(ptr noundef nonnull %0, ptr noundef %.lcssa) #6
  %110 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  br i1 %109, label %118, label %111, !prof !27

111:                                              ; preds = %._crit_edge
  %.not38 = icmp eq i8 %110, 0
  br i1 %.not38, label %.loopexit, label %112, !prof !27

112:                                              ; preds = %111
  %113 = getelementptr inbounds i8, ptr %.lcssa, i64 16
  %114 = load i32, ptr %113, align 1, !tbaa !24
  %115 = getelementptr inbounds i8, ptr %.lcssa, i64 10
  %116 = load i16, ptr %115, align 1, !tbaa !25
  %117 = zext i16 %116 to i32
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 126, ptr noundef nonnull @.str.13, i32 noundef %114, i32 noundef %117) #8
  br label %.loopexit

.loopexit:                                        ; preds = %99, %94, %80, %111, %112
  %.032 = phi i32 [ -30796, %112 ], [ -30796, %111 ], [ %100, %99 ], [ %97, %94 ], [ %85, %80 ]
  call void @be_poor(ptr noundef %0)
  br label %124

118:                                              ; preds = %._crit_edge
  %119 = icmp ugt i8 %110, 4
  br i1 %119, label %120, label %124, !prof !13

120:                                              ; preds = %118
  %121 = getelementptr inbounds i8, ptr %.lcssa, i64 16
  %122 = load i32, ptr %121, align 1, !tbaa !24
  %123 = call ptr @mdbx_dump_val(ptr noundef %1, ptr noundef nonnull %4, i64 noundef 255) #8
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.tree_search_finalize, i32 noundef 133, ptr noundef nonnull @.str.14, i32 noundef %122, ptr noundef %123) #8
  br label %124

124:                                              ; preds = %118, %120, %.loopexit
  %.0 = phi i32 [ %.032, %.loopexit ], [ 0, %120 ], [ 0, %118 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 510, ptr nonnull %4) #8
  ret i32 %.0
}

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @be_poor(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @is_poor(ptr noundef) local_unnamed_addr #2

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

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

declare { ptr, i8 } @node_search(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @check_leaf_type(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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


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