; LLVM IR from erthink/libmdbx :: src (page-ops)

; 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.page_get_result = type { ptr, i32 }
%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.page = type <{ i64, i16, i16, %union.anon.10, i32, [0 x i16] }>
%union.anon.10 = type { 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.1 = type { i8, i8 }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%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.shared_lck = type { i64, i32, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, [2 x %union.mdbx_atomic_uint32_t], [16 x i8], %struct.pgops, [16 x i8], %union.pthread_mutex_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, i32, %struct.anon.22, %union.pthread_mutex_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, [16 x i8], [0 x %struct.reader_slot] }
%struct.pgops = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %struct.anon.20 }
%struct.anon.20 = type { %struct.gc_prof_stat, %struct.gc_prof_stat, i32, i32, i32, i32, i32 }
%struct.gc_prof_stat = type { i64, i64, i32, i32, i32, i32, %struct.anon.21 }
%struct.anon.21 = type { i64, i64, i32 }
%struct.anon.22 = type { [4 x i32], [4 x i64] }
%struct.reader_slot = type { %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint64_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint32_t, %union.mdbx_atomic_uint64_t }
%struct.dpl = type { i64, i64, i64, i64, [18 x %struct.dp] }
%struct.dp = type { ptr, i32, i32 }
%struct.inner_cursor = type { %struct.MDBX_cursor, %struct.tree }

@globals = external global %struct.libmdbx_globals, align 8
@.str.19 = external hidden unnamed_addr constant [44 x i8], align 1
@__func__.page_touch_unmodifable = external hidden unnamed_addr constant [23 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [135 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [63 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

declare { ptr, i32 } @gc_alloc_single(ptr noundef) #2

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

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

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

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

; Function Attrs: hot nounwind uwtable
declare dso_local void @page_copy(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: cold nounwind optsize uwtable
declare dso_local { ptr, i32 } @page_unspill(ptr noundef, ptr noundef) #6

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @page_shadow_alloc(ptr noundef, i64 noundef) #7

; Function Attrs: hot nounwind uwtable
declare dso_local i32 @page_dirty(ptr noundef, ptr noundef, i64 noundef) #5

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

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

; Function Attrs: hot nounwind uwtable
define dso_local i32 @page_touch_unmodifable(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 i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.page_get_result, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.page_get_result, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  br label %18

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

29:                                               ; preds = %18
  br label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = call zeroext i1 @is_modifable(ptr noundef %31, ptr noundef %32) #9
  br i1 %33, label %38, label %34

34:                                               ; preds = %30
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call zeroext i1 @is_largepage(ptr noundef %35) #9
  %37 = xor i1 %36, true
  br label %38

38:                                               ; preds = %34, %30
  %39 = phi i1 [ false, %30 ], [ %37, %34 ]
  %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 %51

47:                                               ; preds = %38
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.MDBX_txn, ptr %48, i32 0, i32 9
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  call void @mdbx_assert_fail(ptr noundef %50, ptr noundef @.str.19, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 172) #10
  unreachable

51:                                               ; preds = %38
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52, %18
  br label %54

54:                                               ; preds = %53
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = call zeroext i1 @is_subpage(ptr noundef %55) #9
  br i1 %56, label %57, label %63

57:                                               ; preds = %54
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MDBX_txn, ptr %58, i32 0, i32 8
  %60 = load i64, ptr %59, align 8, !tbaa !19
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.page, ptr %61, i32 0, i32 0
  store i64 %60, ptr %62, align 1, !tbaa !20
  store i32 0, ptr %4, align 4
  br label %598

63:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #11
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = call zeroext i1 @is_frozen(ptr noundef %64, ptr noundef %65) #9
  br i1 %66, label %67, label %241

67:                                               ; preds = %63
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.MDBX_txn, ptr %68, i32 0, i32 17
  %70 = getelementptr inbounds %struct.anon.6, ptr %69, i32 0, i32 8
  %71 = call i32 @pnl_need(ptr noundef %70, i64 noundef 1)
  store i32 %71, ptr %8, align 4, !tbaa !21
  %72 = load i32, ptr %8, align 4, !tbaa !21
  %73 = icmp ne i32 %72, 0
  %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 %81

80:                                               ; preds = %67
  br label %591

81:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #11
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = call { ptr, i32 } @gc_alloc_single(ptr noundef %82)
  %84 = getelementptr inbounds { ptr, i32 }, ptr %10, i32 0, i32 0
  %85 = extractvalue { ptr, i32 } %83, 0
  store ptr %85, ptr %84, align 8
  %86 = getelementptr inbounds { ptr, i32 }, ptr %10, i32 0, i32 1
  %87 = extractvalue { ptr, i32 } %83, 1
  store i32 %87, ptr %86, align 8
  %88 = getelementptr inbounds %struct.page_get_result, ptr %10, i32 0, i32 1
  %89 = load i32, ptr %88, align 8, !tbaa !22
  store i32 %89, ptr %8, align 4, !tbaa !21
  %90 = getelementptr inbounds %struct.page_get_result, ptr %10, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !24
  store ptr %91, ptr %9, align 8, !tbaa !5
  %92 = load i32, ptr %8, align 4, !tbaa !21
  %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 0)
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %81
  store i32 6, ptr %14, align 4
  br label %238

101:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #11
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.page, ptr %102, i32 0, i32 4
  %104 = load i32, ptr %103, align 1, !tbaa !21
  store i32 %104, ptr %11, align 4, !tbaa !21
  br label %105

105:                                              ; preds = %101
  %106 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !25
  %107 = zext i8 %106 to i32
  %108 = icmp sle i32 5, %107
  %109 = xor i1 %108, true
  %110 = xor i1 %109, true
  %111 = zext i1 %110 to i32
  %112 = sext i32 %111 to i64
  %113 = call i64 @llvm.expect.i64(i64 %112, i64 0)
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %122

115:                                              ; preds = %105
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = call i32 @cursor_dbi_dbg(ptr noundef %116)
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.page, ptr %118, i32 0, i32 4
  %120 = load i32, ptr %119, align 1, !tbaa !21
  %121 = load i32, ptr %11, align 4, !tbaa !21
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 192, ptr noundef @.str.20, i32 noundef %117, i32 noundef %120, i32 noundef %121)
  br label %122

122:                                              ; preds = %115, %105
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  br label %125

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

136:                                              ; preds = %125
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.page, ptr %138, i32 0, i32 4
  %140 = load i32, ptr %139, align 1, !tbaa !21
  %141 = load i32, ptr %11, align 4, !tbaa !21
  %142 = icmp ne i32 %140, %141
  %143 = xor i1 %142, true
  %144 = xor i1 %143, true
  %145 = xor i1 %144, true
  %146 = zext i1 %145 to i32
  %147 = sext i32 %146 to i64
  %148 = call i64 @llvm.expect.i64(i64 %147, i64 0)
  %149 = icmp ne i64 %148, 0
  br i1 %149, label %150, label %154

150:                                              ; preds = %137
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.MDBX_txn, ptr %151, i32 0, i32 9
  %153 = load ptr, ptr %152, align 8, !tbaa !14
  call void @mdbx_assert_fail(ptr noundef %153, ptr noundef @.str.21, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 193) #10
  unreachable

154:                                              ; preds = %137
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156, %125
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.MDBX_txn, ptr %160, i32 0, i32 17
  %162 = getelementptr inbounds %struct.anon.6, ptr %161, i32 0, i32 8
  %163 = load ptr, ptr %162, align 8, !tbaa !26
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.page, ptr %164, i32 0, i32 4
  %166 = load i32, ptr %165, align 1, !tbaa !21
  call void @pnl_append_prereserved(ptr noundef %163, i32 noundef %166)
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.MDBX_cursor, ptr %167, i32 0, i32 1
  %169 = getelementptr inbounds %struct.anon.1, ptr %168, i32 0, i32 1
  %170 = load i8, ptr %169, align 1, !tbaa !26
  %171 = icmp ne i8 %170, 0
  %172 = xor i1 %171, true
  %173 = xor i1 %172, true
  %174 = zext i1 %173 to i32
  %175 = sext i32 %174 to i64
  %176 = call i64 @llvm.expect.i64(i64 %175, i64 1)
  %177 = icmp ne i64 %176, 0
  br i1 %177, label %178, label %206

178:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #11
  %179 = load ptr, ptr %6, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.MDBX_cursor, ptr %179, i32 0, i32 9
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.MDBX_cursor, ptr %181, i32 0, i32 1
  %183 = getelementptr inbounds %struct.anon.1, ptr %182, i32 0, i32 1
  %184 = load i8, ptr %183, align 1, !tbaa !26
  %185 = sext i8 %184 to i32
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [32 x ptr], ptr %180, i64 0, i64 %187
  %189 = load ptr, ptr %188, align 8, !tbaa !5
  store ptr %189, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #11
  %190 = load ptr, ptr %12, align 8, !tbaa !5
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.MDBX_cursor, ptr %191, i32 0, i32 10
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.MDBX_cursor, ptr %193, i32 0, i32 1
  %195 = getelementptr inbounds %struct.anon.1, ptr %194, i32 0, i32 1
  %196 = load i8, ptr %195, align 1, !tbaa !26
  %197 = sext i8 %196 to i32
  %198 = sub nsw i32 %197, 1
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [32 x i16], ptr %192, i64 0, i64 %199
  %201 = load i16, ptr %200, align 2, !tbaa !27
  %202 = zext i16 %201 to i64
  %203 = call ptr @page_node(ptr noundef %190, i64 noundef %202) #9
  store ptr %203, ptr %13, align 8, !tbaa !5
  %204 = load ptr, ptr %13, align 8, !tbaa !5
  %205 = load i32, ptr %11, align 4, !tbaa !21
  call void @node_set_pgno(ptr noundef %204, i32 noundef %205)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #11
  br label %212

206:                                              ; preds = %159
  %207 = load i32, ptr %11, align 4, !tbaa !21
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.MDBX_cursor, ptr %208, i32 0, i32 6
  %210 = load ptr, ptr %209, align 8, !tbaa !28
  %211 = getelementptr inbounds %struct.tree, ptr %210, i32 0, i32 3
  store i32 %207, ptr %211, align 4, !tbaa !30
  br label %212

212:                                              ; preds = %206, %178
  %213 = load ptr, ptr %5, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.MDBX_txn, ptr %213, i32 0, i32 9
  %215 = load ptr, ptr %214, align 8, !tbaa !14
  %216 = getelementptr inbounds %struct.MDBX_env, ptr %215, i32 0, i32 7
  %217 = load ptr, ptr %216, align 8, !tbaa !32
  %218 = getelementptr inbounds %struct.shared_lck, ptr %217, i32 0, i32 9
  %219 = getelementptr inbounds %struct.pgops, ptr %218, i32 0, i32 1
  %220 = load volatile i64, ptr %219, align 8, !tbaa !26
  %221 = add i64 %220, 1
  store volatile i64 %221, ptr %219, align 8, !tbaa !26
  %222 = load ptr, ptr %9, align 8, !tbaa !5
  %223 = load ptr, ptr %7, align 8, !tbaa !5
  %224 = load ptr, ptr %5, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.MDBX_txn, ptr %224, i32 0, i32 9
  %226 = load ptr, ptr %225, align 8, !tbaa !14
  %227 = getelementptr inbounds %struct.MDBX_env, ptr %226, i32 0, i32 2
  %228 = load i32, ptr %227, align 8, !tbaa !41
  %229 = zext i32 %228 to i64
  call void @page_copy(ptr noundef %222, ptr noundef %223, i64 noundef %229) #12
  %230 = load i32, ptr %11, align 4, !tbaa !21
  %231 = load ptr, ptr %9, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.page, ptr %231, i32 0, i32 4
  store i32 %230, ptr %232, align 1, !tbaa !21
  %233 = load ptr, ptr %5, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.MDBX_txn, ptr %233, i32 0, i32 8
  %235 = load i64, ptr %234, align 8, !tbaa !19
  %236 = load ptr, ptr %9, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.page, ptr %236, i32 0, i32 0
  store i64 %235, ptr %237, align 1, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #11
  store i32 0, ptr %14, align 4
  br label %238

238:                                              ; preds = %212, %100
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #11
  %239 = load i32, ptr %14, align 4
  switch i32 %239, label %597 [
    i32 0, label %240
    i32 6, label %591
  ]

240:                                              ; preds = %238
  br label %449

241:                                              ; preds = %63
  %242 = load ptr, ptr %5, align 8, !tbaa !5
  %243 = load ptr, ptr %7, align 8, !tbaa !5
  %244 = call zeroext i1 @is_spilled(ptr noundef %242, ptr noundef %243) #9
  br i1 %244, label %245, label %301

245:                                              ; preds = %241
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #11
  %246 = load ptr, ptr %5, align 8, !tbaa !5
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = call { ptr, i32 } @page_unspill(ptr noundef %246, ptr noundef %247) #13
  %249 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 0
  %250 = extractvalue { ptr, i32 } %248, 0
  store ptr %250, ptr %249, align 8
  %251 = getelementptr inbounds { ptr, i32 }, ptr %15, i32 0, i32 1
  %252 = extractvalue { ptr, i32 } %248, 1
  store i32 %252, ptr %251, align 8
  %253 = getelementptr inbounds %struct.page_get_result, ptr %15, i32 0, i32 0
  %254 = load ptr, ptr %253, align 8, !tbaa !24
  store ptr %254, ptr %9, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.page_get_result, ptr %15, i32 0, i32 1
  %256 = load i32, ptr %255, align 8, !tbaa !22
  store i32 %256, ptr %8, align 4, !tbaa !21
  %257 = load i32, ptr %8, align 4, !tbaa !21
  %258 = icmp eq i32 %257, 0
  %259 = xor i1 %258, true
  %260 = xor i1 %259, true
  %261 = zext i1 %260 to i32
  %262 = sext i32 %261 to i64
  %263 = call i64 @llvm.expect.i64(i64 %262, i64 1)
  %264 = icmp ne i64 %263, 0
  br i1 %264, label %265, label %298

265:                                              ; preds = %245
  br label %266

266:                                              ; preds = %265
  %267 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %268 = zext i8 %267 to i32
  %269 = and i32 %268, 1
  %270 = icmp ne i32 %269, 0
  %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 1)
  %276 = icmp ne i64 %275, 0
  br i1 %276, label %277, label %295

277:                                              ; preds = %266
  br label %278

278:                                              ; preds = %277
  %279 = load ptr, ptr %9, align 8, !tbaa !5
  %280 = icmp ne ptr %279, null
  %281 = xor i1 %280, true
  %282 = xor i1 %281, true
  %283 = xor i1 %282, true
  %284 = zext i1 %283 to i32
  %285 = sext i32 %284 to i64
  %286 = call i64 @llvm.expect.i64(i64 %285, i64 0)
  %287 = icmp ne i64 %286, 0
  br i1 %287, label %288, label %292

288:                                              ; preds = %278
  %289 = load ptr, ptr %5, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.MDBX_txn, ptr %289, i32 0, i32 9
  %291 = load ptr, ptr %290, align 8, !tbaa !14
  call void @mdbx_assert_fail(ptr noundef %291, ptr noundef @.str.22, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 215) #10
  unreachable

292:                                              ; preds = %278
  br label %293

293:                                              ; preds = %292
  br label %294

294:                                              ; preds = %293
  br label %295

295:                                              ; preds = %294, %266
  br label %296

296:                                              ; preds = %295
  br label %297

297:                                              ; preds = %296
  store i32 17, ptr %14, align 4
  br label %299

298:                                              ; preds = %245
  store i32 6, ptr %14, align 4
  br label %299

299:                                              ; preds = %298, %297
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #11
  %300 = load i32, ptr %14, align 4
  switch i32 %300, label %597 [
    i32 17, label %450
    i32 6, label %591
  ]

301:                                              ; preds = %241
  %302 = load ptr, ptr %5, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.MDBX_txn, ptr %302, i32 0, i32 4
  %304 = load ptr, ptr %303, align 8, !tbaa !42
  %305 = icmp ne ptr %304, null
  %306 = xor i1 %305, true
  %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 0)
  %312 = icmp ne i64 %311, 0
  br i1 %312, label %313, label %348

313:                                              ; preds = %301
  br label %314

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

324:                                              ; preds = %314
  %325 = load ptr, ptr %7, align 8, !tbaa !5
  %326 = call zeroext i1 @is_branch(ptr noundef %325) #9
  %327 = zext i1 %326 to i64
  %328 = select i1 %326, ptr @.str.24, ptr @.str.25
  %329 = load ptr, ptr %7, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.page, ptr %329, i32 0, i32 4
  %331 = load i32, ptr %330, align 1, !tbaa !21
  %332 = load ptr, ptr %7, align 8, !tbaa !5
  %333 = getelementptr inbounds %struct.page, ptr %332, i32 0, i32 0
  %334 = load i64, ptr %333, align 1, !tbaa !20
  %335 = load ptr, ptr %6, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.MDBX_cursor, ptr %335, i32 0, i32 5
  %337 = load ptr, ptr %336, align 8, !tbaa !43
  %338 = getelementptr inbounds %struct.MDBX_txn, ptr %337, i32 0, i32 7
  %339 = load i64, ptr %338, align 8, !tbaa !44
  %340 = load ptr, ptr %6, align 8, !tbaa !5
  %341 = getelementptr inbounds %struct.MDBX_cursor, ptr %340, i32 0, i32 5
  %342 = load ptr, ptr %341, align 8, !tbaa !43
  %343 = getelementptr inbounds %struct.MDBX_txn, ptr %342, i32 0, i32 8
  %344 = load i64, ptr %343, align 8, !tbaa !19
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 224, ptr noundef @.str.23, ptr noundef %328, i32 noundef %331, i64 noundef %334, i64 noundef %339, i64 noundef %344)
  br label %345

345:                                              ; preds = %324, %314
  br label %346

346:                                              ; preds = %345
  br label %347

347:                                              ; preds = %346
  store i32 -30779, ptr %8, align 4, !tbaa !21
  br label %591

348:                                              ; preds = %301
  br label %349

349:                                              ; preds = %348
  %350 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !25
  %351 = zext i8 %350 to i32
  %352 = icmp sle i32 5, %351
  %353 = xor i1 %352, true
  %354 = xor i1 %353, true
  %355 = zext i1 %354 to i32
  %356 = sext i32 %355 to i64
  %357 = call i64 @llvm.expect.i64(i64 %356, i64 0)
  %358 = icmp ne i64 %357, 0
  br i1 %358, label %359, label %365

359:                                              ; preds = %349
  %360 = load ptr, ptr %6, align 8, !tbaa !5
  %361 = call i32 @cursor_dbi_dbg(ptr noundef %360)
  %362 = load ptr, ptr %7, align 8, !tbaa !5
  %363 = getelementptr inbounds %struct.page, ptr %362, i32 0, i32 4
  %364 = load i32, ptr %363, align 1, !tbaa !21
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 229, ptr noundef @.str.26, i32 noundef %361, i32 noundef %364)
  br label %365

365:                                              ; preds = %359, %349
  br label %366

366:                                              ; preds = %365
  br label %367

367:                                              ; preds = %366
  br label %368

368:                                              ; preds = %367
  %369 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %370 = zext i8 %369 to i32
  %371 = and i32 %370, 1
  %372 = icmp ne i32 %371, 0
  %373 = xor i1 %372, true
  %374 = xor i1 %373, true
  %375 = zext i1 %374 to i32
  %376 = sext i32 %375 to i64
  %377 = call i64 @llvm.expect.i64(i64 %376, i64 1)
  %378 = icmp ne i64 %377, 0
  br i1 %378, label %379, label %402

379:                                              ; preds = %368
  br label %380

380:                                              ; preds = %379
  %381 = load ptr, ptr %5, align 8, !tbaa !5
  %382 = getelementptr inbounds %struct.MDBX_txn, ptr %381, i32 0, i32 17
  %383 = getelementptr inbounds %struct.anon.6, ptr %382, i32 0, i32 7
  %384 = load ptr, ptr %383, align 8, !tbaa !26
  %385 = getelementptr inbounds %struct.dpl, ptr %384, i32 0, i32 1
  %386 = load i64, ptr %385, align 8, !tbaa !45
  %387 = icmp ule i64 %386, 2147484671
  %388 = xor i1 %387, true
  %389 = xor i1 %388, true
  %390 = xor i1 %389, true
  %391 = zext i1 %390 to i32
  %392 = sext i32 %391 to i64
  %393 = call i64 @llvm.expect.i64(i64 %392, i64 0)
  %394 = icmp ne i64 %393, 0
  br i1 %394, label %395, label %399

395:                                              ; preds = %380
  %396 = load ptr, ptr %5, align 8, !tbaa !5
  %397 = getelementptr inbounds %struct.MDBX_txn, ptr %396, i32 0, i32 9
  %398 = load ptr, ptr %397, align 8, !tbaa !14
  call void @mdbx_assert_fail(ptr noundef %398, ptr noundef @.str.27, ptr noundef @__func__.page_touch_unmodifable, i32 noundef 230) #10
  unreachable

399:                                              ; preds = %380
  br label %400

400:                                              ; preds = %399
  br label %401

401:                                              ; preds = %400
  br label %402

402:                                              ; preds = %401, %368
  br label %403

403:                                              ; preds = %402
  br label %404

404:                                              ; preds = %403
  %405 = load ptr, ptr %5, align 8, !tbaa !5
  %406 = call ptr @page_shadow_alloc(ptr noundef %405, i64 noundef 1)
  store ptr %406, ptr %9, align 8, !tbaa !5
  %407 = load ptr, ptr %9, align 8, !tbaa !5
  %408 = icmp ne ptr %407, null
  %409 = xor i1 %408, true
  %410 = xor i1 %409, true
  %411 = xor i1 %410, true
  %412 = zext i1 %411 to i32
  %413 = sext i32 %412 to i64
  %414 = call i64 @llvm.expect.i64(i64 %413, i64 0)
  %415 = icmp ne i64 %414, 0
  br i1 %415, label %416, label %417

416:                                              ; preds = %404
  store i32 12, ptr %8, align 4, !tbaa !21
  br label %591

417:                                              ; preds = %404
  %418 = load ptr, ptr %9, align 8, !tbaa !5
  %419 = load ptr, ptr %7, align 8, !tbaa !5
  %420 = load ptr, ptr %5, align 8, !tbaa !5
  %421 = getelementptr inbounds %struct.MDBX_txn, ptr %420, i32 0, i32 9
  %422 = load ptr, ptr %421, align 8, !tbaa !14
  %423 = getelementptr inbounds %struct.MDBX_env, ptr %422, i32 0, i32 2
  %424 = load i32, ptr %423, align 8, !tbaa !41
  %425 = zext i32 %424 to i64
  call void @page_copy(ptr noundef %418, ptr noundef %419, i64 noundef %425) #12
  %426 = load ptr, ptr %5, align 8, !tbaa !5
  %427 = load ptr, ptr %9, align 8, !tbaa !5
  %428 = call i32 @page_dirty(ptr noundef %426, ptr noundef %427, i64 noundef 1)
  store i32 %428, ptr %8, align 4, !tbaa !21
  %429 = load i32, ptr %8, align 4, !tbaa !21
  %430 = icmp ne i32 %429, 0
  %431 = xor i1 %430, true
  %432 = xor i1 %431, true
  %433 = zext i1 %432 to i32
  %434 = sext i32 %433 to i64
  %435 = call i64 @llvm.expect.i64(i64 %434, i64 0)
  %436 = icmp ne i64 %435, 0
  br i1 %436, label %437, label %438

437:                                              ; preds = %417
  br label %591

438:                                              ; preds = %417
  %439 = load ptr, ptr %5, align 8, !tbaa !5
  %440 = getelementptr inbounds %struct.MDBX_txn, ptr %439, i32 0, i32 9
  %441 = load ptr, ptr %440, align 8, !tbaa !14
  %442 = getelementptr inbounds %struct.MDBX_env, ptr %441, i32 0, i32 7
  %443 = load ptr, ptr %442, align 8, !tbaa !32
  %444 = getelementptr inbounds %struct.shared_lck, ptr %443, i32 0, i32 9
  %445 = getelementptr inbounds %struct.pgops, ptr %444, i32 0, i32 2
  %446 = load volatile i64, ptr %445, align 16, !tbaa !26
  %447 = add i64 %446, 1
  store volatile i64 %447, ptr %445, align 16, !tbaa !26
  br label %448

448:                                              ; preds = %438
  br label %449

449:                                              ; preds = %448, %240
  br label %450

450:                                              ; preds = %449, %299
  %451 = load ptr, ptr %9, align 8, !tbaa !5
  %452 = load ptr, ptr %6, align 8, !tbaa !5
  %453 = getelementptr inbounds %struct.MDBX_cursor, ptr %452, i32 0, i32 9
  %454 = load ptr, ptr %6, align 8, !tbaa !5
  %455 = getelementptr inbounds %struct.MDBX_cursor, ptr %454, i32 0, i32 1
  %456 = getelementptr inbounds %struct.anon.1, ptr %455, i32 0, i32 1
  %457 = load i8, ptr %456, align 1, !tbaa !26
  %458 = sext i8 %457 to i64
  %459 = getelementptr inbounds [32 x ptr], ptr %453, i64 0, i64 %458
  store ptr %451, ptr %459, align 8, !tbaa !5
  %460 = load ptr, ptr %5, align 8, !tbaa !5
  %461 = getelementptr inbounds %struct.MDBX_txn, ptr %460, i32 0, i32 14
  %462 = load ptr, ptr %461, align 8, !tbaa !47
  %463 = load ptr, ptr %6, align 8, !tbaa !5
  %464 = call i64 @cursor_dbi(ptr noundef %463) #9
  %465 = getelementptr inbounds ptr, ptr %462, i64 %464
  %466 = load ptr, ptr %465, align 8, !tbaa !5
  store ptr %466, ptr %16, align 8, !tbaa !5
  %467 = load ptr, ptr %6, align 8, !tbaa !5
  %468 = getelementptr inbounds %struct.MDBX_cursor, ptr %467, i32 0, i32 1
  %469 = getelementptr inbounds %struct.anon.1, ptr %468, i32 0, i32 0
  %470 = load i8, ptr %469, align 4, !tbaa !26
  %471 = sext i8 %470 to i32
  %472 = and i32 %471, 1
  %473 = icmp ne i32 %472, 0
  br i1 %473, label %474, label %526

474:                                              ; preds = %450
  br label %475

475:                                              ; preds = %521, %474
  %476 = load ptr, ptr %16, align 8, !tbaa !5
  %477 = icmp ne ptr %476, null
  br i1 %477, label %478, label %525

478:                                              ; preds = %475
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #11
  %479 = load ptr, ptr %16, align 8, !tbaa !5
  %480 = getelementptr inbounds %struct.MDBX_cursor, ptr %479, i32 0, i32 8
  %481 = load ptr, ptr %480, align 8, !tbaa !48
  %482 = getelementptr inbounds %struct.inner_cursor, ptr %481, i32 0, i32 0
  store ptr %482, ptr %17, align 8, !tbaa !5
  %483 = load ptr, ptr %17, align 8, !tbaa !5
  %484 = getelementptr inbounds %struct.MDBX_cursor, ptr %483, i32 0, i32 1
  %485 = getelementptr inbounds %struct.anon.1, ptr %484, i32 0, i32 1
  %486 = load i8, ptr %485, align 1, !tbaa !26
  %487 = sext i8 %486 to i32
  %488 = load ptr, ptr %6, align 8, !tbaa !5
  %489 = getelementptr inbounds %struct.MDBX_cursor, ptr %488, i32 0, i32 1
  %490 = getelementptr inbounds %struct.anon.1, ptr %489, i32 0, i32 1
  %491 = load i8, ptr %490, align 1, !tbaa !26
  %492 = sext i8 %491 to i32
  %493 = icmp slt i32 %487, %492
  br i1 %493, label %494, label %495

494:                                              ; preds = %478
  store i32 28, ptr %14, align 4
  br label %518

495:                                              ; preds = %478
  %496 = load ptr, ptr %17, align 8, !tbaa !5
  %497 = getelementptr inbounds %struct.MDBX_cursor, ptr %496, i32 0, i32 9
  %498 = load ptr, ptr %6, align 8, !tbaa !5
  %499 = getelementptr inbounds %struct.MDBX_cursor, ptr %498, i32 0, i32 1
  %500 = getelementptr inbounds %struct.anon.1, ptr %499, i32 0, i32 1
  %501 = load i8, ptr %500, align 1, !tbaa !26
  %502 = sext i8 %501 to i64
  %503 = getelementptr inbounds [32 x ptr], ptr %497, i64 0, i64 %502
  %504 = load ptr, ptr %503, align 8, !tbaa !5
  %505 = load ptr, ptr %7, align 8, !tbaa !5
  %506 = icmp eq ptr %504, %505
  br i1 %506, label %507, label %517

507:                                              ; preds = %495
  %508 = load ptr, ptr %9, align 8, !tbaa !5
  %509 = load ptr, ptr %17, align 8, !tbaa !5
  %510 = getelementptr inbounds %struct.MDBX_cursor, ptr %509, i32 0, i32 9
  %511 = load ptr, ptr %6, align 8, !tbaa !5
  %512 = getelementptr inbounds %struct.MDBX_cursor, ptr %511, i32 0, i32 1
  %513 = getelementptr inbounds %struct.anon.1, ptr %512, i32 0, i32 1
  %514 = load i8, ptr %513, align 1, !tbaa !26
  %515 = sext i8 %514 to i64
  %516 = getelementptr inbounds [32 x ptr], ptr %510, i64 0, i64 %515
  store ptr %508, ptr %516, align 8, !tbaa !5
  br label %517

517:                                              ; preds = %507, %495
  store i32 0, ptr %14, align 4
  br label %518

518:                                              ; preds = %517, %494
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #11
  %519 = load i32, ptr %14, align 4
  switch i32 %519, label %600 [
    i32 0, label %520
    i32 28, label %521
  ]

520:                                              ; preds = %518
  br label %521

521:                                              ; preds = %520, %518
  %522 = load ptr, ptr %16, align 8, !tbaa !5
  %523 = getelementptr inbounds %struct.MDBX_cursor, ptr %522, i32 0, i32 11
  %524 = load ptr, ptr %523, align 8, !tbaa !49
  store ptr %524, ptr %16, align 8, !tbaa !5
  br label %475, !llvm.loop !50

525:                                              ; preds = %475
  br label %590

526:                                              ; preds = %450
  br label %527

527:                                              ; preds = %585, %526
  %528 = load ptr, ptr %16, align 8, !tbaa !5
  %529 = icmp ne ptr %528, null
  br i1 %529, label %530, label %589

530:                                              ; preds = %527
  %531 = load ptr, ptr %16, align 8, !tbaa !5
  %532 = getelementptr inbounds %struct.MDBX_cursor, ptr %531, i32 0, i32 1
  %533 = getelementptr inbounds %struct.anon.1, ptr %532, i32 0, i32 1
  %534 = load i8, ptr %533, align 1, !tbaa !26
  %535 = sext i8 %534 to i32
  %536 = load ptr, ptr %6, align 8, !tbaa !5
  %537 = getelementptr inbounds %struct.MDBX_cursor, ptr %536, i32 0, i32 1
  %538 = getelementptr inbounds %struct.anon.1, ptr %537, i32 0, i32 1
  %539 = load i8, ptr %538, align 1, !tbaa !26
  %540 = sext i8 %539 to i32
  %541 = icmp slt i32 %535, %540
  br i1 %541, label %542, label %543

542:                                              ; preds = %530
  br label %585

543:                                              ; preds = %530
  %544 = load ptr, ptr %16, align 8, !tbaa !5
  %545 = getelementptr inbounds %struct.MDBX_cursor, ptr %544, i32 0, i32 9
  %546 = load ptr, ptr %6, align 8, !tbaa !5
  %547 = getelementptr inbounds %struct.MDBX_cursor, ptr %546, i32 0, i32 1
  %548 = getelementptr inbounds %struct.anon.1, ptr %547, i32 0, i32 1
  %549 = load i8, ptr %548, align 1, !tbaa !26
  %550 = sext i8 %549 to i64
  %551 = getelementptr inbounds [32 x ptr], ptr %545, i64 0, i64 %550
  %552 = load ptr, ptr %551, align 8, !tbaa !5
  %553 = load ptr, ptr %7, align 8, !tbaa !5
  %554 = icmp eq ptr %552, %553
  br i1 %554, label %555, label %584

555:                                              ; preds = %543
  %556 = load ptr, ptr %9, align 8, !tbaa !5
  %557 = load ptr, ptr %16, align 8, !tbaa !5
  %558 = getelementptr inbounds %struct.MDBX_cursor, ptr %557, i32 0, i32 9
  %559 = load ptr, ptr %6, align 8, !tbaa !5
  %560 = getelementptr inbounds %struct.MDBX_cursor, ptr %559, i32 0, i32 1
  %561 = getelementptr inbounds %struct.anon.1, ptr %560, i32 0, i32 1
  %562 = load i8, ptr %561, align 1, !tbaa !26
  %563 = sext i8 %562 to i64
  %564 = getelementptr inbounds [32 x ptr], ptr %558, i64 0, i64 %563
  store ptr %556, ptr %564, align 8, !tbaa !5
  %565 = load ptr, ptr %9, align 8, !tbaa !5
  %566 = call zeroext i1 @is_leaf(ptr noundef %565) #9
  br i1 %566, label %567, label %583

567:                                              ; preds = %555
  %568 = load ptr, ptr %16, align 8, !tbaa !5
  %569 = call zeroext i1 @inner_pointed(ptr noundef %568) #9
  br i1 %569, label %570, label %583

570:                                              ; preds = %567
  %571 = load ptr, ptr %16, align 8, !tbaa !5
  %572 = load ptr, ptr %9, align 8, !tbaa !5
  %573 = load ptr, ptr %16, align 8, !tbaa !5
  %574 = getelementptr inbounds %struct.MDBX_cursor, ptr %573, i32 0, i32 10
  %575 = load ptr, ptr %6, align 8, !tbaa !5
  %576 = getelementptr inbounds %struct.MDBX_cursor, ptr %575, i32 0, i32 1
  %577 = getelementptr inbounds %struct.anon.1, ptr %576, i32 0, i32 1
  %578 = load i8, ptr %577, align 1, !tbaa !26
  %579 = sext i8 %578 to i64
  %580 = getelementptr inbounds [32 x i16], ptr %574, i64 0, i64 %579
  %581 = load i16, ptr %580, align 2, !tbaa !27
  %582 = zext i16 %581 to i32
  call void @cursor_inner_refresh(ptr noundef %571, ptr noundef %572, i32 noundef %582)
  br label %583

583:                                              ; preds = %570, %567, %555
  br label %584

584:                                              ; preds = %583, %543
  br label %585

585:                                              ; preds = %584, %542
  %586 = load ptr, ptr %16, align 8, !tbaa !5
  %587 = getelementptr inbounds %struct.MDBX_cursor, ptr %586, i32 0, i32 11
  %588 = load ptr, ptr %587, align 8, !tbaa !49
  store ptr %588, ptr %16, align 8, !tbaa !5
  br label %527, !llvm.loop !52

589:                                              ; preds = %527
  br label %590

590:                                              ; preds = %589, %525
  store i32 0, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %597

591:                                              ; preds = %437, %416, %347, %299, %238, %80
  %592 = load ptr, ptr %5, align 8, !tbaa !5
  %593 = getelementptr inbounds %struct.MDBX_txn, ptr %592, i32 0, i32 1
  %594 = load i32, ptr %593, align 4, !tbaa !53
  %595 = or i32 %594, 2
  store i32 %595, ptr %593, align 4, !tbaa !53
  %596 = load i32, ptr %8, align 4, !tbaa !21
  store i32 %596, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %597

597:                                              ; preds = %591, %590, %299, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #11
  br label %598

598:                                              ; preds = %597, %57
  %599 = load i32, ptr %4, align 4
  ret i32 %599

600:                                              ; preds = %518
  unreachable
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @pnl_need(ptr noalias noundef, i64 noundef) #8

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

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

; 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 void @node_set_pgno(ptr noalias noundef, i32 noundef) #8

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @cursor_inner_refresh(ptr noundef, ptr noundef, i32 noundef) #8

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

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


; 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.19 = external hidden unnamed_addr constant [44 x i8], align 1
@__func__.page_touch_unmodifable = external hidden unnamed_addr constant [23 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [135 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [63 x i8], align 1

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

declare { ptr, i32 } @gc_alloc_single(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: hot nounwind uwtable
declare dso_local void @page_copy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: cold nounwind optsize uwtable
declare dso_local { ptr, i32 } @page_unspill(ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @page_shadow_alloc(ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: hot nounwind uwtable
declare dso_local i32 @page_dirty(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: hot nounwind uwtable
define dso_local i32 @page_touch_unmodifable(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 %12, label %6, !prof !13

6:                                                ; preds = %3
  %7 = tail call zeroext i1 @is_modifable(ptr noundef %0, ptr noundef %2) #7
  br i1 %7, label %.critedge, label %8, !prof !13

8:                                                ; preds = %6
  %9 = tail call zeroext i1 @is_largepage(ptr noundef %2) #7
  br i1 %9, label %.critedge, label %12, !prof !13

.critedge:                                        ; preds = %6, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  tail call void @mdbx_assert_fail(ptr noundef %11, ptr noundef nonnull @.str.19, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 172) #8
  unreachable

12:                                               ; preds = %3, %8
  %13 = tail call zeroext i1 @is_subpage(ptr noundef %2) #7
  br i1 %13, label %14, label %17

14:                                               ; preds = %12
  %15 = getelementptr inbounds i8, ptr %0, i64 72
  %16 = load i64, ptr %15, align 8, !tbaa !19
  store i64 %16, ptr %2, align 1, !tbaa !20
  br label %.loopexit

17:                                               ; preds = %12
  %18 = tail call zeroext i1 @is_frozen(ptr noundef %0, ptr noundef %2) #7
  br i1 %18, label %19, label %72

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %0, i64 504
  %21 = tail call i32 @pnl_need(ptr noundef nonnull %20, i64 noundef 1)
  %.not122 = icmp eq i32 %21, 0
  br i1 %.not122, label %22, label %187, !prof !21

22:                                               ; preds = %19
  %23 = tail call { ptr, i32 } @gc_alloc_single(ptr noundef %1) #9
  %24 = extractvalue { ptr, i32 } %23, 0
  %25 = extractvalue { ptr, i32 } %23, 1
  %.not123 = icmp eq i32 %25, 0
  br i1 %.not123, label %26, label %187, !prof !21

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %24, i64 16
  %28 = load i32, ptr %27, align 1, !tbaa !22
  %29 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  %30 = icmp ugt i8 %29, 4
  br i1 %30, label %31, label %35, !prof !13

31:                                               ; preds = %26
  %32 = tail call i32 @cursor_dbi_dbg(ptr noundef %1)
  %33 = getelementptr inbounds i8, ptr %2, i64 16
  %34 = load i32, ptr %33, align 1, !tbaa !22
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 192, ptr noundef nonnull @.str.20, i32 noundef %32, i32 noundef %34, i32 noundef %28) #9
  br label %35

35:                                               ; preds = %26, %31
  %36 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %37 = and i8 %36, 1
  %.not124 = icmp ne i8 %37, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %2, i64 16
  %.pre141 = load i32, ptr %.phi.trans.insert, align 1, !tbaa !22
  %.not125 = icmp eq i32 %.pre141, %28
  %or.cond144 = select i1 %.not124, i1 %.not125, i1 false
  br i1 %or.cond144, label %38, label %._crit_edge, !prof !24

38:                                               ; preds = %35
  %39 = getelementptr inbounds i8, ptr %0, i64 80
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  tail call void @mdbx_assert_fail(ptr noundef %40, ptr noundef nonnull @.str.21, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 193) #8
  unreachable

._crit_edge:                                      ; preds = %35
  %41 = load ptr, ptr %20, align 8, !tbaa !25
  tail call void @pnl_append_prereserved(ptr noundef %41, i32 noundef %.pre141)
  %42 = getelementptr inbounds i8, ptr %1, i64 5
  %43 = load i8, ptr %42, align 1, !tbaa !25
  %.not126 = icmp eq i8 %43, 0
  br i1 %.not126, label %55, label %44, !prof !13

44:                                               ; preds = %._crit_edge
  %45 = getelementptr inbounds i8, ptr %1, i64 48
  %46 = sext i8 %43 to i64
  %47 = add nsw i64 %46, -1
  %48 = getelementptr inbounds [32 x ptr], ptr %45, i64 0, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !26
  %50 = getelementptr inbounds i8, ptr %1, i64 304
  %51 = getelementptr inbounds [32 x i16], ptr %50, i64 0, i64 %47
  %52 = load i16, ptr %51, align 2, !tbaa !27
  %53 = zext i16 %52 to i64
  %54 = tail call ptr @page_node(ptr noundef %49, i64 noundef %53) #7
  tail call void @node_set_pgno(ptr noundef %54, i32 noundef %28)
  br label %.thread

55:                                               ; preds = %._crit_edge
  %56 = getelementptr inbounds i8, ptr %1, i64 24
  %57 = load ptr, ptr %56, align 8, !tbaa !28
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  store i32 %28, ptr %58, align 4, !tbaa !30
  br label %.thread

.thread:                                          ; preds = %44, %55
  %59 = getelementptr inbounds i8, ptr %0, i64 80
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %60, i64 104
  %62 = load ptr, ptr %61, align 8, !tbaa !32
  %63 = getelementptr inbounds i8, ptr %62, i64 72
  %64 = load volatile i64, ptr %63, align 8, !tbaa !25
  %65 = add i64 %64, 1
  store volatile i64 %65, ptr %63, align 8, !tbaa !25
  %66 = load ptr, ptr %59, align 8, !tbaa !14
  %67 = getelementptr inbounds i8, ptr %66, i64 8
  %68 = load i32, ptr %67, align 8, !tbaa !41
  %69 = zext i32 %68 to i64
  tail call void @page_copy(ptr noundef nonnull %24, ptr noundef nonnull %2, i64 noundef %69) #10
  store i32 %28, ptr %27, align 1, !tbaa !22
  %70 = getelementptr inbounds i8, ptr %0, i64 72
  %71 = load i64, ptr %70, align 8, !tbaa !19
  store i64 %71, ptr %24, align 1, !tbaa !20
  br label %.thread131

72:                                               ; preds = %17
  %73 = tail call zeroext i1 @is_spilled(ptr noundef %0, ptr noundef %2) #7
  br i1 %73, label %74, label %85

74:                                               ; preds = %72
  %75 = tail call { ptr, i32 } @page_unspill(ptr noundef %0, ptr noundef %2) #11
  %76 = extractvalue { ptr, i32 } %75, 1
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %187, !prof !21

78:                                               ; preds = %74
  %79 = extractvalue { ptr, i32 } %75, 0
  %80 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %81 = and i8 %80, 1
  %.not120 = icmp ne i8 %81, 0
  %.not121 = icmp eq ptr %79, null
  %or.cond = select i1 %.not120, i1 %.not121, i1 false
  br i1 %or.cond, label %82, label %.thread131, !prof !24

82:                                               ; preds = %78
  %83 = getelementptr inbounds i8, ptr %0, i64 80
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  tail call void @mdbx_assert_fail(ptr noundef %84, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 215) #8
  unreachable

85:                                               ; preds = %72
  %86 = getelementptr inbounds i8, ptr %0, i64 24
  %87 = load ptr, ptr %86, align 8, !tbaa !42
  %.not115 = icmp eq ptr %87, null
  %88 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  br i1 %.not115, label %89, label %102, !prof !13

89:                                               ; preds = %85
  %.not119 = icmp eq i8 %88, 0
  br i1 %.not119, label %187, label %90, !prof !21

90:                                               ; preds = %89
  %91 = tail call zeroext i1 @is_branch(ptr noundef %2) #7
  %92 = select i1 %91, ptr @.str.24, ptr @.str.25
  %93 = getelementptr inbounds i8, ptr %2, i64 16
  %94 = load i32, ptr %93, align 1, !tbaa !22
  %95 = load i64, ptr %2, align 1, !tbaa !20
  %96 = getelementptr inbounds i8, ptr %1, i64 16
  %97 = load ptr, ptr %96, align 8, !tbaa !43
  %98 = getelementptr inbounds i8, ptr %97, i64 64
  %99 = load i64, ptr %98, align 8, !tbaa !44
  %100 = getelementptr inbounds i8, ptr %97, i64 72
  %101 = load i64, ptr %100, align 8, !tbaa !19
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 224, ptr noundef nonnull @.str.23, ptr noundef nonnull %92, i32 noundef %94, i64 noundef %95, i64 noundef %99, i64 noundef %101) #9
  br label %187

102:                                              ; preds = %85
  %103 = icmp ugt i8 %88, 4
  br i1 %103, label %104, label %108, !prof !13

104:                                              ; preds = %102
  %105 = tail call i32 @cursor_dbi_dbg(ptr noundef %1)
  %106 = getelementptr inbounds i8, ptr %2, i64 16
  %107 = load i32, ptr %106, align 1, !tbaa !22
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 5, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 229, ptr noundef nonnull @.str.26, i32 noundef %105, i32 noundef %107) #9
  %.pre = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %.pre142 = and i8 %.pre, 1
  br label %108

108:                                              ; preds = %102, %104
  %.pre-phi = phi i8 [ %5, %102 ], [ %.pre142, %104 ]
  %.not116 = icmp eq i8 %.pre-phi, 0
  br i1 %.not116, label %118, label %109, !prof !13

109:                                              ; preds = %108
  %110 = getelementptr inbounds i8, ptr %0, i64 496
  %111 = load ptr, ptr %110, align 8, !tbaa !25
  %112 = getelementptr inbounds i8, ptr %111, i64 8
  %113 = load i64, ptr %112, align 8, !tbaa !45
  %114 = icmp ugt i64 %113, 2147484671
  br i1 %114, label %115, label %118, !prof !13

115:                                              ; preds = %109
  %116 = getelementptr inbounds i8, ptr %0, i64 80
  %117 = load ptr, ptr %116, align 8, !tbaa !14
  tail call void @mdbx_assert_fail(ptr noundef %117, ptr noundef nonnull @.str.27, ptr noundef nonnull @__func__.page_touch_unmodifable, i32 noundef 230) #8
  unreachable

118:                                              ; preds = %109, %108
  %119 = tail call ptr @page_shadow_alloc(ptr noundef nonnull %0, i64 noundef 1)
  %.not117 = icmp eq ptr %119, null
  br i1 %.not117, label %187, label %120, !prof !13

120:                                              ; preds = %118
  %121 = getelementptr inbounds i8, ptr %0, i64 80
  %122 = load ptr, ptr %121, align 8, !tbaa !14
  %123 = getelementptr inbounds i8, ptr %122, i64 8
  %124 = load i32, ptr %123, align 8, !tbaa !41
  %125 = zext i32 %124 to i64
  tail call void @page_copy(ptr noundef nonnull %119, ptr noundef %2, i64 noundef %125) #10
  %126 = tail call i32 @page_dirty(ptr noundef nonnull %0, ptr noundef nonnull %119, i64 noundef 1)
  %.not118 = icmp eq i32 %126, 0
  br i1 %.not118, label %127, label %187, !prof !21

127:                                              ; preds = %120
  %128 = load ptr, ptr %121, align 8, !tbaa !14
  %129 = getelementptr inbounds i8, ptr %128, i64 104
  %130 = load ptr, ptr %129, align 8, !tbaa !32
  %131 = getelementptr inbounds i8, ptr %130, i64 80
  %132 = load volatile i64, ptr %131, align 16, !tbaa !25
  %133 = add i64 %132, 1
  store volatile i64 %133, ptr %131, align 16, !tbaa !25
  br label %.thread131

.thread131:                                       ; preds = %78, %.thread, %127
  %.0109 = phi ptr [ %119, %127 ], [ %24, %.thread ], [ %79, %78 ]
  %134 = getelementptr inbounds i8, ptr %1, i64 48
  %135 = getelementptr inbounds i8, ptr %1, i64 4
  %136 = getelementptr inbounds i8, ptr %1, i64 5
  %137 = load i8, ptr %136, align 1, !tbaa !25
  %138 = sext i8 %137 to i64
  %139 = getelementptr inbounds [32 x ptr], ptr %134, i64 0, i64 %138
  store ptr %.0109, ptr %139, align 8, !tbaa !26
  %140 = getelementptr inbounds i8, ptr %0, i64 120
  %141 = load ptr, ptr %140, align 8, !tbaa !47
  %142 = tail call i64 @cursor_dbi(ptr noundef %1) #7
  %143 = getelementptr inbounds ptr, ptr %141, i64 %142
  %144 = load ptr, ptr %143, align 8, !tbaa !26
  %145 = load i8, ptr %135, align 4, !tbaa !25
  %146 = and i8 %145, 1
  %.not127 = icmp eq i8 %146, 0
  %.not128137 = icmp eq ptr %144, null
  br i1 %.not127, label %.preheader, label %.preheader133

.preheader133:                                    ; preds = %.thread131
  br i1 %.not128137, label %.loopexit, label %.lr.ph

.preheader:                                       ; preds = %.thread131
  br i1 %.not128137, label %.loopexit, label %.lr.ph139

.lr.ph:                                           ; preds = %.preheader133, %160
  %.0106136 = phi ptr [ %162, %160 ], [ %144, %.preheader133 ]
  %147 = getelementptr inbounds i8, ptr %.0106136, i64 40
  %148 = load ptr, ptr %147, align 8, !tbaa !48
  %149 = getelementptr inbounds i8, ptr %148, i64 5
  %150 = load i8, ptr %149, align 1, !tbaa !25
  %151 = load i8, ptr %136, align 1, !tbaa !25
  %152 = icmp slt i8 %150, %151
  br i1 %152, label %160, label %153

153:                                              ; preds = %.lr.ph
  %154 = getelementptr inbounds i8, ptr %148, i64 48
  %155 = sext i8 %151 to i64
  %156 = getelementptr inbounds [32 x ptr], ptr %154, i64 0, i64 %155
  %157 = load ptr, ptr %156, align 8, !tbaa !26
  %158 = icmp eq ptr %157, %2
  br i1 %158, label %159, label %160

159:                                              ; preds = %153
  store ptr %.0109, ptr %156, align 8, !tbaa !26
  br label %160

160:                                              ; preds = %153, %159, %.lr.ph
  %161 = getelementptr inbounds i8, ptr %.0106136, i64 368
  %162 = load ptr, ptr %161, align 8, !tbaa !49
  %.not129 = icmp eq ptr %162, null
  br i1 %.not129, label %.loopexit, label %.lr.ph, !llvm.loop !50

.lr.ph139:                                        ; preds = %.preheader, %184
  %.1107138 = phi ptr [ %186, %184 ], [ %144, %.preheader ]
  %163 = getelementptr inbounds i8, ptr %.1107138, i64 5
  %164 = load i8, ptr %163, align 1, !tbaa !25
  %165 = load i8, ptr %136, align 1, !tbaa !25
  %166 = icmp slt i8 %164, %165
  br i1 %166, label %184, label %167

167:                                              ; preds = %.lr.ph139
  %168 = getelementptr inbounds i8, ptr %.1107138, i64 48
  %169 = sext i8 %165 to i64
  %170 = getelementptr inbounds [32 x ptr], ptr %168, i64 0, i64 %169
  %171 = load ptr, ptr %170, align 8, !tbaa !26
  %172 = icmp eq ptr %171, %2
  br i1 %172, label %173, label %184

173:                                              ; preds = %167
  store ptr %.0109, ptr %170, align 8, !tbaa !26
  %174 = tail call zeroext i1 @is_leaf(ptr noundef %.0109) #7
  br i1 %174, label %175, label %184

175:                                              ; preds = %173
  %176 = tail call zeroext i1 @inner_pointed(ptr noundef nonnull %.1107138) #7
  br i1 %176, label %177, label %184

177:                                              ; preds = %175
  %178 = getelementptr inbounds i8, ptr %.1107138, i64 304
  %179 = load i8, ptr %136, align 1, !tbaa !25
  %180 = sext i8 %179 to i64
  %181 = getelementptr inbounds [32 x i16], ptr %178, i64 0, i64 %180
  %182 = load i16, ptr %181, align 2, !tbaa !27
  %183 = zext i16 %182 to i32
  tail call void @cursor_inner_refresh(ptr noundef nonnull %.1107138, ptr noundef %.0109, i32 noundef %183)
  br label %184

184:                                              ; preds = %167, %177, %175, %173, %.lr.ph139
  %185 = getelementptr inbounds i8, ptr %.1107138, i64 368
  %186 = load ptr, ptr %185, align 8, !tbaa !49
  %.not128 = icmp eq ptr %186, null
  br i1 %.not128, label %.loopexit, label %.lr.ph139, !llvm.loop !52

187:                                              ; preds = %74, %22, %118, %89, %90, %120, %19
  %.0108 = phi i32 [ %21, %19 ], [ %126, %120 ], [ -30779, %90 ], [ -30779, %89 ], [ 12, %118 ], [ %25, %22 ], [ %76, %74 ]
  %188 = getelementptr inbounds i8, ptr %0, i64 4
  %189 = load i32, ptr %188, align 4, !tbaa !53
  %190 = or i32 %189, 2
  store i32 %190, ptr %188, align 4, !tbaa !53
  br label %.loopexit

.loopexit:                                        ; preds = %160, %184, %.preheader133, %.preheader, %187, %14
  %.1 = phi i32 [ 0, %14 ], [ %.0108, %187 ], [ 0, %.preheader ], [ 0, %.preheader133 ], [ 0, %184 ], [ 0, %160 ]
  ret i32 %.1
}

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

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

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

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

; 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 void @node_set_pgno(ptr noalias noundef, i32 noundef) local_unnamed_addr #6

; 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 zeroext i1 @is_leaf(ptr noundef) local_unnamed_addr #2

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

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

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

!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 80}
!15 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !16, 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, !18, i64 128, !12, i64 160, !7, i64 168}
!16 = !{!"geo", !17, i64 0, !17, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!19 = !{!15, !11, i64 72}
!20 = !{!11, !11, i64 0}
!21 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!22 = !{!9, !9, i64 0}
!23 = !{!6, !7, i64 26}
!24 = !{!"branch_weights", i32 2000, i32 4002001}
!25 = !{!7, !7, i64 0}
!26 = !{!12, !12, i64 0}
!27 = !{!17, !17, i64 0}
!28 = !{!29, !12, i64 24}
!29 = !{!"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}
!30 = !{!31, !9, i64 8}
!31 = !{!"tree", !17, i64 0, !17, 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}
!32 = !{!33, !12, i64 104}
!33 = !{!"MDBX_env", !7, i64 0, !9, i64 4, !9, i64 8, !34, i64 16, !9, i64 56, !9, i64 60, !34, i64 64, !12, i64 104, !17, i64 112, !17, i64 114, !17, i64 116, !17, i64 118, !17, i64 120, !17, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !17, i64 130, !9, i64 132, !9, i64 136, !9, i64 140, !9, i64 144, !35, 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, !36, i64 264, !38, i64 320, !10, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !39, i64 392, !7, i64 400, !9, i64 440, !9, i64 444, !12, i64 448, !40, i64 456, !7, i64 496, !7, i64 536}
!34 = !{!"osal_mmap", !7, i64 0, !9, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!35 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!36 = !{!"", !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, !37, i64 40, !7, i64 48}
!37 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6}
!38 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!39 = !{!"", !11, i64 0}
!40 = !{!"osal_ioring", !9, i64 0, !9, i64 4, !9, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!41 = !{!33, !9, i64 8}
!42 = !{!15, !12, i64 24}
!43 = !{!29, !12, i64 16}
!44 = !{!15, !11, i64 64}
!45 = !{!46, !11, i64 8}
!46 = !{!"dpl", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32}
!47 = !{!15, !12, i64 120}
!48 = !{!29, !12, i64 40}
!49 = !{!29, !12, i64 368}
!50 = distinct !{!50, !51}
!51 = !{!"llvm.loop.mustprogress"}
!52 = distinct !{!52, !51}
!53 = !{!15, !9, i64 4}


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