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

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

@globals = external global %struct.libmdbx_globals, align 8
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@__func__.cursor_touch = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [81 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: inlinehint nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @is_pointed(ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @cursor_is_tracked(ptr noundef) #4

; Function Attrs: hot nounwind uwtable
define dso_local i32 @cursor_touch(ptr noundef %0, ptr noundef %1, ptr noundef %2) #5 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  br label %15

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

26:                                               ; preds = %15
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.MDBX_cursor, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct.MDBX_txn, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !16
  %33 = and i32 %32, 131072
  %34 = icmp eq i32 %33, 0
  %35 = xor i1 %34, true
  %36 = xor i1 %35, true
  %37 = xor i1 %36, true
  %38 = zext i1 %37 to i32
  %39 = sext i32 %38 to i64
  %40 = call i64 @llvm.expect.i64(i64 %39, i64 0)
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %48

42:                                               ; preds = %27
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MDBX_cursor, ptr %43, i32 0, i32 5
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = getelementptr inbounds %struct.MDBX_txn, ptr %45, i32 0, i32 9
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  call void @mdbx_assert_fail(ptr noundef %47, ptr noundef @.str.12, ptr noundef @__func__.cursor_touch, i32 noundef 125) #7
  unreachable

48:                                               ; preds = %27
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49, %15
  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 !9
  %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 %92

63:                                               ; preds = %52
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = call zeroext i1 @is_pointed(ptr noundef %65) #8
  br i1 %66, label %75, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.MDBX_cursor, ptr %68, i32 0, i32 6
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = getelementptr inbounds %struct.tree, ptr %70, i32 0, i32 1
  %72 = load i16, ptr %71, align 2, !tbaa !23
  %73 = zext i16 %72 to i32
  %74 = icmp eq i32 %73, 0
  br label %75

75:                                               ; preds = %67, %64
  %76 = phi i1 [ true, %64 ], [ %74, %67 ]
  %77 = xor i1 %76, true
  %78 = xor i1 %77, true
  %79 = xor i1 %78, true
  %80 = zext i1 %79 to i32
  %81 = sext i32 %80 to i64
  %82 = call i64 @llvm.expect.i64(i64 %81, i64 0)
  %83 = icmp ne i64 %82, 0
  br i1 %83, label %84, label %90

84:                                               ; preds = %75
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.MDBX_cursor, ptr %85, i32 0, i32 5
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = getelementptr inbounds %struct.MDBX_txn, ptr %87, i32 0, i32 9
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  call void @mdbx_assert_fail(ptr noundef %89, ptr noundef @.str.13, ptr noundef @__func__.cursor_touch, i32 noundef 126) #7
  unreachable

90:                                               ; preds = %75
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91, %52
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  %95 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %96 = zext i8 %95 to i32
  %97 = and i32 %96, 1
  %98 = icmp ne i32 %97, 0
  %99 = xor i1 %98, true
  %100 = xor i1 %99, true
  %101 = zext i1 %100 to i32
  %102 = sext i32 %101 to i64
  %103 = call i64 @llvm.expect.i64(i64 %102, i64 1)
  %104 = icmp ne i64 %103, 0
  br i1 %104, label %105, label %124

105:                                              ; preds = %94
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = call zeroext i1 @cursor_is_tracked(ptr noundef %107)
  %109 = xor i1 %108, true
  %110 = xor i1 %109, true
  %111 = xor i1 %110, true
  %112 = zext i1 %111 to i32
  %113 = sext i32 %112 to i64
  %114 = call i64 @llvm.expect.i64(i64 %113, i64 0)
  %115 = icmp ne i64 %114, 0
  br i1 %115, label %116, label %122

116:                                              ; preds = %106
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.MDBX_cursor, ptr %117, i32 0, i32 5
  %119 = load ptr, ptr %118, align 8, !tbaa !14
  %120 = getelementptr inbounds %struct.MDBX_txn, ptr %119, i32 0, i32 9
  %121 = load ptr, ptr %120, align 8, !tbaa !21
  call void @mdbx_assert_fail(ptr noundef %121, ptr noundef @.str.14, ptr noundef @__func__.cursor_touch, i32 noundef 127) #7
  unreachable

122:                                              ; preds = %106
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123, %94
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %128 = zext i8 %127 to i32
  %129 = and i32 %128, 1
  %130 = icmp ne i32 %129, 0
  %131 = xor i1 %130, true
  %132 = xor i1 %131, true
  %133 = zext i1 %132 to i32
  %134 = sext i32 %133 to i64
  %135 = call i64 @llvm.expect.i64(i64 %134, i64 1)
  %136 = icmp ne i64 %135, 0
  br i1 %136, label %137, label %161

137:                                              ; preds = %126
  br label %138

138:                                              ; preds = %137
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.MDBX_cursor, ptr %139, i32 0, i32 5
  %141 = load ptr, ptr %140, align 8, !tbaa !14
  %142 = call zeroext i8 @dbi_state(ptr noundef %141, i64 noundef 0)
  %143 = zext i8 %142 to i32
  %144 = and i32 %143, 144
  %145 = icmp eq i32 %144, 144
  %146 = xor i1 %145, true
  %147 = xor i1 %146, true
  %148 = xor i1 %147, true
  %149 = zext i1 %148 to i32
  %150 = sext i32 %149 to i64
  %151 = call i64 @llvm.expect.i64(i64 %150, i64 0)
  %152 = icmp ne i64 %151, 0
  br i1 %152, label %153, label %159

153:                                              ; preds = %138
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.MDBX_cursor, ptr %154, i32 0, i32 5
  %156 = load ptr, ptr %155, align 8, !tbaa !14
  %157 = getelementptr inbounds %struct.MDBX_txn, ptr %156, i32 0, i32 9
  %158 = load ptr, ptr %157, align 8, !tbaa !21
  call void @mdbx_assert_fail(ptr noundef %158, ptr noundef @.str.15, ptr noundef @__func__.cursor_touch, i32 noundef 129) #7
  unreachable

159:                                              ; preds = %138
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160, %126
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  %164 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %165 = zext i8 %164 to i32
  %166 = and i32 %165, 1
  %167 = icmp ne i32 %166, 0
  %168 = xor i1 %167, true
  %169 = xor i1 %168, true
  %170 = zext i1 %169 to i32
  %171 = sext i32 %170 to i64
  %172 = call i64 @llvm.expect.i64(i64 %171, i64 1)
  %173 = icmp ne i64 %172, 0
  br i1 %173, label %174, label %198

174:                                              ; preds = %163
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.MDBX_cursor, ptr %176, i32 0, i32 5
  %178 = load ptr, ptr %177, align 8, !tbaa !14
  %179 = call zeroext i8 @dbi_state(ptr noundef %178, i64 noundef 1)
  %180 = zext i8 %179 to i32
  %181 = and i32 %180, 144
  %182 = icmp eq i32 %181, 144
  %183 = xor i1 %182, true
  %184 = xor i1 %183, true
  %185 = xor i1 %184, true
  %186 = zext i1 %185 to i32
  %187 = sext i32 %186 to i64
  %188 = call i64 @llvm.expect.i64(i64 %187, i64 0)
  %189 = icmp ne i64 %188, 0
  br i1 %189, label %190, label %196

190:                                              ; preds = %175
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.MDBX_cursor, ptr %191, i32 0, i32 5
  %193 = load ptr, ptr %192, align 8, !tbaa !14
  %194 = getelementptr inbounds %struct.MDBX_txn, ptr %193, i32 0, i32 9
  %195 = load ptr, ptr %194, align 8, !tbaa !21
  call void @mdbx_assert_fail(ptr noundef %195, ptr noundef @.str.16, ptr noundef @__func__.cursor_touch, i32 noundef 130) #7
  unreachable

196:                                              ; preds = %175
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197, %163
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.MDBX_cursor, ptr %200, i32 0, i32 1
  %202 = getelementptr inbounds %struct.anon, ptr %201, i32 0, i32 0
  %203 = load i8, ptr %202, align 4, !tbaa !25
  %204 = sext i8 %203 to i32
  %205 = and i32 %204, 1
  %206 = icmp eq i32 %205, 0
  br i1 %206, label %207, label %304

207:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %208 = load ptr, ptr %5, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.MDBX_cursor, ptr %208, i32 0, i32 5
  %210 = load ptr, ptr %209, align 8, !tbaa !14
  store ptr %210, ptr %8, align 8, !tbaa !5
  %211 = load ptr, ptr %8, align 8, !tbaa !5
  %212 = call i32 @dpl_lru_turn(ptr noundef %211)
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = call ptr @cursor_dbi_state(ptr noundef %213) #8
  %215 = load i8, ptr %214, align 1, !tbaa !25
  %216 = zext i8 %215 to i32
  %217 = and i32 %216, 1
  %218 = icmp eq i32 %217, 0
  %219 = xor i1 %218, true
  %220 = xor i1 %219, true
  %221 = zext i1 %220 to i32
  %222 = sext i32 %221 to i64
  %223 = call i64 @llvm.expect.i64(i64 %222, i64 0)
  %224 = icmp ne i64 %223, 0
  br i1 %224, label %225, label %242

225:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  %226 = load ptr, ptr %5, align 8, !tbaa !5
  %227 = call i32 @touch_dbi(ptr noundef %226)
  store i32 %227, ptr %9, align 4, !tbaa !26
  %228 = load i32, ptr %9, align 4, !tbaa !26
  %229 = icmp ne i32 %228, 0
  %230 = xor i1 %229, true
  %231 = xor i1 %230, true
  %232 = zext i1 %231 to i32
  %233 = sext i32 %232 to i64
  %234 = call i64 @llvm.expect.i64(i64 %233, i64 0)
  %235 = icmp ne i64 %234, 0
  br i1 %235, label %236, label %238

236:                                              ; preds = %225
  %237 = load i32, ptr %9, align 4, !tbaa !26
  store i32 %237, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %239

238:                                              ; preds = %225
  store i32 0, ptr %10, align 4
  br label %239

239:                                              ; preds = %238, %236
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  %240 = load i32, ptr %10, align 4
  switch i32 %240, label %301 [
    i32 0, label %241
  ]

241:                                              ; preds = %239
  br label %242

242:                                              ; preds = %241, %207
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  store i64 35, ptr %11, align 8, !tbaa !27
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = call zeroext i1 @cursor_is_gc(ptr noundef %243) #8
  br i1 %244, label %270, label %245

245:                                              ; preds = %242
  %246 = load ptr, ptr %8, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.MDBX_txn, ptr %246, i32 0, i32 10
  %248 = load ptr, ptr %247, align 8, !tbaa !28
  %249 = getelementptr inbounds %struct.tree, ptr %248, i64 0
  %250 = getelementptr inbounds %struct.tree, ptr %249, i32 0, i32 1
  %251 = load i16, ptr %250, align 2, !tbaa !23
  %252 = zext i16 %251 to i64
  %253 = add i64 %252, 3
  %254 = load i64, ptr %11, align 8, !tbaa !27
  %255 = add i64 %254, %253
  store i64 %255, ptr %11, align 8, !tbaa !27
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  %257 = call zeroext i1 @cursor_is_main(ptr noundef %256) #8
  br i1 %257, label %269, label %258

258:                                              ; preds = %245
  %259 = load ptr, ptr %8, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.MDBX_txn, ptr %259, i32 0, i32 10
  %261 = load ptr, ptr %260, align 8, !tbaa !28
  %262 = getelementptr inbounds %struct.tree, ptr %261, i64 1
  %263 = getelementptr inbounds %struct.tree, ptr %262, i32 0, i32 1
  %264 = load i16, ptr %263, align 2, !tbaa !23
  %265 = zext i16 %264 to i64
  %266 = add i64 %265, 3
  %267 = load i64, ptr %11, align 8, !tbaa !27
  %268 = add i64 %267, %266
  store i64 %268, ptr %11, align 8, !tbaa !27
  br label %269

269:                                              ; preds = %258, %245
  br label %270

270:                                              ; preds = %269, %242
  %271 = load i64, ptr %11, align 8, !tbaa !27
  %272 = load i64, ptr %11, align 8, !tbaa !27
  %273 = add i64 %272, %271
  store i64 %273, ptr %11, align 8, !tbaa !27
  %274 = load ptr, ptr %8, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.MDBX_txn, ptr %274, i32 0, i32 9
  %276 = load ptr, ptr %275, align 8, !tbaa !21
  %277 = load ptr, ptr %6, align 8, !tbaa !5
  %278 = load ptr, ptr %7, align 8, !tbaa !5
  %279 = call i64 @node_size(ptr noundef %277, ptr noundef %278) #8
  %280 = call i32 @bytes2pgno(ptr noundef %276, i64 noundef %279) #8
  %281 = zext i32 %280 to i64
  %282 = add i64 %281, 1
  %283 = load i64, ptr %11, align 8, !tbaa !27
  %284 = add i64 %283, %282
  store i64 %284, ptr %11, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %285 = load ptr, ptr %8, align 8, !tbaa !5
  %286 = load ptr, ptr %5, align 8, !tbaa !5
  %287 = load i64, ptr %11, align 8, !tbaa !27
  %288 = call i32 @txn_spill(ptr noundef %285, ptr noundef %286, i64 noundef %287)
  store i32 %288, ptr %12, align 4, !tbaa !26
  %289 = load i32, ptr %12, align 4, !tbaa !26
  %290 = icmp ne i32 %289, 0
  %291 = xor i1 %290, true
  %292 = xor i1 %291, true
  %293 = zext i1 %292 to i32
  %294 = sext i32 %293 to i64
  %295 = call i64 @llvm.expect.i64(i64 %294, i64 0)
  %296 = icmp ne i64 %295, 0
  br i1 %296, label %297, label %299

297:                                              ; preds = %270
  %298 = load i32, ptr %12, align 4, !tbaa !26
  store i32 %298, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %300

299:                                              ; preds = %270
  store i32 0, ptr %10, align 4
  br label %300

300:                                              ; preds = %299, %297
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %301

301:                                              ; preds = %300, %239
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  %302 = load i32, ptr %10, align 4
  switch i32 %302, label %387 [
    i32 0, label %303
    i32 1, label %385
  ]

303:                                              ; preds = %301
  br label %304

304:                                              ; preds = %303, %199
  %305 = load ptr, ptr %5, align 8, !tbaa !5
  %306 = call zeroext i1 @is_pointed(ptr noundef %305) #8
  %307 = xor i1 %306, true
  %308 = xor i1 %307, true
  %309 = zext i1 %308 to i32
  %310 = sext i32 %309 to i64
  %311 = call i64 @llvm.expect.i64(i64 %310, i64 1)
  %312 = icmp ne i64 %311, 0
  br i1 %312, label %313, label %384

313:                                              ; preds = %304
  %314 = load ptr, ptr %5, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.MDBX_cursor, ptr %314, i32 0, i32 5
  %316 = load ptr, ptr %315, align 8, !tbaa !14
  %317 = getelementptr inbounds %struct.MDBX_txn, ptr %316, i32 0, i32 1
  %318 = load i32, ptr %317, align 4, !tbaa !16
  %319 = and i32 %318, 8
  %320 = icmp ne i32 %319, 0
  br i1 %320, label %335, label %321

321:                                              ; preds = %313
  %322 = load ptr, ptr %5, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct.MDBX_cursor, ptr %322, i32 0, i32 5
  %324 = load ptr, ptr %323, align 8, !tbaa !14
  %325 = load ptr, ptr %5, align 8, !tbaa !5
  %326 = getelementptr inbounds %struct.MDBX_cursor, ptr %325, i32 0, i32 9
  %327 = load ptr, ptr %5, align 8, !tbaa !5
  %328 = getelementptr inbounds %struct.MDBX_cursor, ptr %327, i32 0, i32 1
  %329 = getelementptr inbounds %struct.anon, ptr %328, i32 0, i32 1
  %330 = load i8, ptr %329, align 1, !tbaa !25
  %331 = sext i8 %330 to i64
  %332 = getelementptr inbounds [32 x ptr], ptr %326, i64 0, i64 %331
  %333 = load ptr, ptr %332, align 8, !tbaa !5
  %334 = call zeroext i1 @is_modifable(ptr noundef %324, ptr noundef %333) #8
  br i1 %334, label %384, label %335

335:                                              ; preds = %321, %313
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #9
  %336 = load ptr, ptr %5, align 8, !tbaa !5
  %337 = getelementptr inbounds %struct.MDBX_cursor, ptr %336, i32 0, i32 1
  %338 = getelementptr inbounds %struct.anon, ptr %337, i32 0, i32 1
  %339 = load i8, ptr %338, align 1, !tbaa !25
  store i8 %339, ptr %13, align 1, !tbaa !25
  %340 = load ptr, ptr %5, align 8, !tbaa !5
  %341 = getelementptr inbounds %struct.MDBX_cursor, ptr %340, i32 0, i32 1
  %342 = getelementptr inbounds %struct.anon, ptr %341, i32 0, i32 1
  store i8 0, ptr %342, align 1, !tbaa !25
  br label %343

343:                                              ; preds = %367, %335
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %344 = load ptr, ptr %5, align 8, !tbaa !5
  %345 = call i32 @page_touch(ptr noundef %344)
  store i32 %345, ptr %14, align 4, !tbaa !26
  %346 = load i32, ptr %14, align 4, !tbaa !26
  %347 = icmp ne i32 %346, 0
  %348 = xor i1 %347, true
  %349 = xor i1 %348, true
  %350 = zext i1 %349 to i32
  %351 = sext i32 %350 to i64
  %352 = call i64 @llvm.expect.i64(i64 %351, i64 0)
  %353 = icmp ne i64 %352, 0
  br i1 %353, label %354, label %356

354:                                              ; preds = %343
  %355 = load i32, ptr %14, align 4, !tbaa !26
  store i32 %355, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %364

356:                                              ; preds = %343
  %357 = load ptr, ptr %5, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct.MDBX_cursor, ptr %357, i32 0, i32 1
  %359 = getelementptr inbounds %struct.anon, ptr %358, i32 0, i32 1
  %360 = load i8, ptr %359, align 1, !tbaa !25
  %361 = sext i8 %360 to i32
  %362 = add nsw i32 %361, 1
  %363 = trunc i32 %362 to i8
  store i8 %363, ptr %359, align 1, !tbaa !25
  store i32 0, ptr %10, align 4
  br label %364

364:                                              ; preds = %356, %354
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  %365 = load i32, ptr %10, align 4
  switch i32 %365, label %381 [
    i32 0, label %366
  ]

366:                                              ; preds = %364
  br label %367

367:                                              ; preds = %366
  %368 = load ptr, ptr %5, align 8, !tbaa !5
  %369 = getelementptr inbounds %struct.MDBX_cursor, ptr %368, i32 0, i32 1
  %370 = getelementptr inbounds %struct.anon, ptr %369, i32 0, i32 1
  %371 = load i8, ptr %370, align 1, !tbaa !25
  %372 = sext i8 %371 to i32
  %373 = load i8, ptr %13, align 1, !tbaa !25
  %374 = sext i8 %373 to i32
  %375 = icmp sle i32 %372, %374
  br i1 %375, label %343, label %376, !llvm.loop !29

376:                                              ; preds = %367
  %377 = load i8, ptr %13, align 1, !tbaa !25
  %378 = load ptr, ptr %5, align 8, !tbaa !5
  %379 = getelementptr inbounds %struct.MDBX_cursor, ptr %378, i32 0, i32 1
  %380 = getelementptr inbounds %struct.anon, ptr %379, i32 0, i32 1
  store i8 %377, ptr %380, align 1, !tbaa !25
  store i32 0, ptr %10, align 4
  br label %381

381:                                              ; preds = %376, %364
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #9
  %382 = load i32, ptr %10, align 4
  switch i32 %382, label %387 [
    i32 0, label %383
    i32 1, label %385
  ]

383:                                              ; preds = %381
  br label %384

384:                                              ; preds = %383, %321, %304
  store i32 0, ptr %4, align 4
  br label %385

385:                                              ; preds = %384, %381, %301
  %386 = load i32, ptr %4, align 4
  ret i32 %386

387:                                              ; preds = %381, %301
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @dbi_state(ptr noundef, i64 noundef) #6

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

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

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

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

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

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

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

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

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

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

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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 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 = { 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 = { noreturn }
attributes #8 = { nounwind willreturn memory(read) }
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, !7, i64 25}
!10 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !12, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"MDBX_cursor", !11, 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}
!16 = !{!17, !11, i64 4}
!17 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !18, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !20, i64 128, !6, i64 160, !7, i64 168}
!18 = !{!"geo", !19, i64 0, !19, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!19 = !{!"short", !7, i64 0}
!20 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!21 = !{!17, !6, i64 80}
!22 = !{!15, !6, i64 24}
!23 = !{!24, !19, i64 2}
!24 = !{!"tree", !19, i64 0, !19, i64 2, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !13, i64 24, !13, i64 32, !13, i64 40}
!25 = !{!7, !7, i64 0}
!26 = !{!11, !11, i64 0}
!27 = !{!13, !13, i64 0}
!28 = !{!17, !6, i64 88}
!29 = distinct !{!29, !30}
!30 = !{!"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.8 }
%struct.anon.8 = 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.12 = external hidden unnamed_addr constant [40 x i8], align 1
@__func__.cursor_touch = external hidden unnamed_addr constant [13 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [81 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: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @is_pointed(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @cursor_is_tracked(ptr noundef) local_unnamed_addr #2

; Function Attrs: hot nounwind uwtable
define dso_local i32 @cursor_touch(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #3 {
  %4 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %5 = and i8 %4, 1
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %.thread, label %6, !prof !13

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %8, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !16
  %11 = and i32 %10, 131072
  %.not62 = icmp eq i32 %11, 0
  br i1 %.not62, label %15, label %12, !prof !21

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %8, i64 80
  %14 = load ptr, ptr %13, align 8, !tbaa !22
  tail call void @mdbx_assert_fail(ptr noundef %14, ptr noundef nonnull @.str.12, ptr noundef nonnull @__func__.cursor_touch, i32 noundef 125) #5
  unreachable

15:                                               ; preds = %6
  %16 = tail call zeroext i1 @is_pointed(ptr noundef nonnull %0) #6
  br i1 %16, label %26, label %17

17:                                               ; preds = %15
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  %19 = load ptr, ptr %18, align 8, !tbaa !23
  %20 = getelementptr inbounds i8, ptr %19, i64 2
  %21 = load i16, ptr %20, align 2, !tbaa !24
  %22 = icmp eq i16 %21, 0
  br i1 %22, label %26, label %23, !prof !21

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %8, i64 80
  %25 = load ptr, ptr %24, align 8, !tbaa !22
  tail call void @mdbx_assert_fail(ptr noundef %25, ptr noundef nonnull @.str.13, ptr noundef nonnull @__func__.cursor_touch, i32 noundef 126) #5
  unreachable

26:                                               ; preds = %15, %17
  %27 = tail call zeroext i1 @cursor_is_tracked(ptr noundef nonnull %0)
  br i1 %27, label %.critedge, label %28, !prof !21

28:                                               ; preds = %26
  %29 = load ptr, ptr %7, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %29, i64 80
  %31 = load ptr, ptr %30, align 8, !tbaa !22
  tail call void @mdbx_assert_fail(ptr noundef %31, ptr noundef nonnull @.str.14, ptr noundef nonnull @__func__.cursor_touch, i32 noundef 127) #5
  unreachable

.critedge:                                        ; preds = %26
  %.pre = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %.pre91 = and i8 %.pre, 1
  %32 = icmp eq i8 %.pre91, 0
  br i1 %32, label %.thread, label %33, !prof !26

33:                                               ; preds = %.critedge
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = tail call zeroext i8 @dbi_state(ptr noundef %35, i64 noundef 0)
  %37 = and i8 %36, -112
  %.not66 = icmp eq i8 %37, -112
  br i1 %.not66, label %42, label %38, !prof !21

38:                                               ; preds = %33
  %39 = load ptr, ptr %34, align 8, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %39, i64 80
  %41 = load ptr, ptr %40, align 8, !tbaa !22
  tail call void @mdbx_assert_fail(ptr noundef %41, ptr noundef nonnull @.str.15, ptr noundef nonnull @__func__.cursor_touch, i32 noundef 129) #5
  unreachable

42:                                               ; preds = %33
  %.pre88 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %.pre92 = and i8 %.pre88, 1
  %43 = icmp eq i8 %.pre92, 0
  br i1 %43, label %.thread, label %44, !prof !26

44:                                               ; preds = %42
  %45 = getelementptr inbounds i8, ptr %0, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  %47 = tail call zeroext i8 @dbi_state(ptr noundef %46, i64 noundef 1)
  %48 = and i8 %47, -112
  %.not68 = icmp eq i8 %48, -112
  br i1 %.not68, label %.thread, label %49, !prof !21

49:                                               ; preds = %44
  %50 = load ptr, ptr %45, align 8, !tbaa !14
  %51 = getelementptr inbounds i8, ptr %50, i64 80
  %52 = load ptr, ptr %51, align 8, !tbaa !22
  tail call void @mdbx_assert_fail(ptr noundef %52, ptr noundef nonnull @.str.16, ptr noundef nonnull @__func__.cursor_touch, i32 noundef 130) #5
  unreachable

.thread:                                          ; preds = %3, %.critedge, %42, %44
  %53 = getelementptr inbounds i8, ptr %0, i64 4
  %54 = load i8, ptr %53, align 4, !tbaa !27
  %55 = and i8 %54, 1
  %56 = icmp eq i8 %55, 0
  br i1 %56, label %57, label %93

57:                                               ; preds = %.thread
  %58 = getelementptr inbounds i8, ptr %0, i64 16
  %59 = load ptr, ptr %58, align 8, !tbaa !14
  %60 = tail call i32 @dpl_lru_turn(ptr noundef %59)
  %61 = tail call ptr @cursor_dbi_state(ptr noundef nonnull %0) #6
  %62 = load i8, ptr %61, align 1, !tbaa !27
  %63 = and i8 %62, 1
  %64 = icmp eq i8 %63, 0
  br i1 %64, label %65, label %67, !prof !13

65:                                               ; preds = %57
  %66 = tail call i32 @touch_dbi(ptr noundef nonnull %0)
  %.not69 = icmp eq i32 %66, 0
  br i1 %.not69, label %67, label %.thread76

67:                                               ; preds = %65, %57
  %68 = tail call zeroext i1 @cursor_is_gc(ptr noundef nonnull %0) #6
  br i1 %68, label %83, label %69

69:                                               ; preds = %67
  %70 = getelementptr inbounds i8, ptr %59, i64 88
  %71 = load ptr, ptr %70, align 8, !tbaa !28
  %72 = getelementptr inbounds i8, ptr %71, i64 2
  %73 = load i16, ptr %72, align 2, !tbaa !24
  %74 = zext i16 %73 to i64
  %75 = add nuw nsw i64 %74, 38
  %76 = tail call zeroext i1 @cursor_is_main(ptr noundef nonnull %0) #6
  br i1 %76, label %83, label %77

77:                                               ; preds = %69
  %78 = getelementptr inbounds i8, ptr %71, i64 50
  %79 = load i16, ptr %78, align 2, !tbaa !24
  %80 = zext i16 %79 to i64
  %81 = add nuw nsw i64 %74, 41
  %82 = add nuw nsw i64 %81, %80
  br label %83

83:                                               ; preds = %69, %77, %67
  %.060 = phi i64 [ 35, %67 ], [ %75, %69 ], [ %82, %77 ]
  %84 = shl nuw nsw i64 %.060, 1
  %85 = getelementptr inbounds i8, ptr %59, i64 80
  %86 = load ptr, ptr %85, align 8, !tbaa !22
  %87 = tail call i64 @node_size(ptr noundef %1, ptr noundef %2) #6
  %88 = tail call i32 @bytes2pgno(ptr noundef %86, i64 noundef %87) #6
  %89 = zext i32 %88 to i64
  %90 = or disjoint i64 %84, 1
  %91 = add nuw nsw i64 %90, %89
  %92 = tail call i32 @txn_spill(ptr noundef %59, ptr noundef nonnull %0, i64 noundef %91)
  %.not70 = icmp eq i32 %92, 0
  br i1 %.not70, label %93, label %.thread76, !prof !21

93:                                               ; preds = %83, %.thread
  %94 = tail call zeroext i1 @is_pointed(ptr noundef nonnull %0) #6
  br i1 %94, label %95, label %.thread76, !prof !21

95:                                               ; preds = %93
  %96 = getelementptr inbounds i8, ptr %0, i64 16
  %97 = load ptr, ptr %96, align 8, !tbaa !14
  %98 = getelementptr inbounds i8, ptr %97, i64 4
  %99 = load i32, ptr %98, align 4, !tbaa !16
  %100 = and i32 %99, 8
  %.not71 = icmp eq i32 %100, 0
  br i1 %.not71, label %101, label %._crit_edge89

._crit_edge89:                                    ; preds = %95
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 5
  %.pre90 = load i8, ptr %.phi.trans.insert, align 1, !tbaa !27
  br label %109

101:                                              ; preds = %95
  %102 = getelementptr inbounds i8, ptr %0, i64 48
  %103 = getelementptr inbounds i8, ptr %0, i64 5
  %104 = load i8, ptr %103, align 1, !tbaa !27
  %105 = sext i8 %104 to i64
  %106 = getelementptr inbounds [32 x ptr], ptr %102, i64 0, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !29
  %108 = tail call zeroext i1 @is_modifable(ptr noundef nonnull %97, ptr noundef %107) #6
  br i1 %108, label %.thread76, label %109

109:                                              ; preds = %._crit_edge89, %101
  %110 = phi i8 [ %.pre90, %._crit_edge89 ], [ %104, %101 ]
  %111 = getelementptr inbounds i8, ptr %0, i64 5
  store i8 0, ptr %111, align 1, !tbaa !27
  br label %112

112:                                              ; preds = %114, %109
  %113 = tail call i32 @page_touch(ptr noundef nonnull %0)
  %.not72.not = icmp eq i32 %113, 0
  br i1 %.not72.not, label %114, label %.thread76, !prof !21

114:                                              ; preds = %112
  %115 = load i8, ptr %111, align 1, !tbaa !27
  %116 = add i8 %115, 1
  store i8 %116, ptr %111, align 1, !tbaa !27
  %.not73 = icmp sgt i8 %116, %110
  br i1 %.not73, label %.thread83, label %112, !llvm.loop !30

.thread83:                                        ; preds = %114
  store i8 %110, ptr %111, align 1, !tbaa !27
  br label %.thread76

.thread76:                                        ; preds = %112, %65, %83, %93, %101, %.thread83
  %.7 = phi i32 [ 0, %.thread83 ], [ 0, %101 ], [ 0, %93 ], [ %66, %65 ], [ %92, %83 ], [ %113, %112 ]
  ret i32 %.7
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i8 @dbi_state(ptr noundef, i64 noundef) local_unnamed_addr #4

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

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

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

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

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !9, i64 4}
!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 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!22 = !{!17, !12, i64 80}
!23 = !{!15, !12, i64 24}
!24 = !{!25, !19, i64 2}
!25 = !{!"tree", !19, i64 0, !19, 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}
!26 = !{!"branch_weights", !"expected", i32 0, i32 -2147483648}
!27 = !{!7, !7, i64 0}
!28 = !{!17, !12, i64 88}
!29 = !{!12, !12, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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