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

; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.6, i64 }
%union.anon.6 = type { ptr }
%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.1 }
%struct.geo = type { i16, i16, i32, i32, %union.anon, %union.anon.0 }
%union.anon = type { i32 }
%union.anon.0 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.1 = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.troika, ptr, %struct.anon.3, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.4 }
%struct.anon.3 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.4 = type { %struct.anon.5 }
%struct.anon.5 = type { i64, ptr }
%struct.MDBX_txn_info = type { i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.meta = type { [2 x i32], %union.anon.7, i16, i8, i8, %struct.geo, %union.anon.8, %struct.MDBX_canary, %union.anon.11, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.7 = type { i64 }
%union.anon.8 = type { %struct.anon.9 }
%struct.anon.9 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%union.anon.11 = type { i64 }
%union.mdbx_atomic_uint32_t = type { i32 }
%union.bin128 = type { %struct.anon.12 }
%struct.anon.12 = type { i64, i64 }
%struct.anon = type { ptr }
%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 }
%union.mdbx_atomic_uint64_t = type { 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.15, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.16, %struct.anon.20, i8, ptr, ptr, ptr, %struct.anon.21, %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.14, i32, i64, i64, i64 }
%union.anon.14 = type { ptr }
%struct.anon.15 = type { ptr, ptr, ptr, ptr }
%struct.anon.16 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.17, %union.anon.18 }
%struct.anon.17 = type { i16, i16, i16, i16 }
%union.anon.18 = type { i32 }
%struct.anon.20 = type { i64, i64, i64, i64, i64 }
%struct.anon.21 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, 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.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.24, %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.22 }
%struct.anon.22 = 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.23 }
%struct.anon.23 = type { i64, i64, i32 }
%struct.anon.24 = type { [4 x i32], [4 x i64] }
%struct.dpl = type { i64, i64, i64, i64, [18 x %struct.dp] }
%struct.dp = type { ptr, i32, i32 }

@__func__.mdbx_txn_info = external hidden unnamed_addr constant [14 x i8], align 1

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

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

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

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

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) #3

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

declare zeroext i1 @meta_should_retry(ptr noundef, ptr noundef) #4

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @safe64_read(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_info(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) #5 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %struct.meta_ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.troika, align 8
  %14 = alloca %struct.meta_ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %28 = zext i1 %2 to i8
  store i8 %28, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i32 @check_txn(ptr noundef %29, i32 noundef 1)
  store i32 %30, ptr %8, align 4, !tbaa !11
  %31 = load i32, ptr %8, align 4, !tbaa !11
  %32 = icmp ne i32 %31, 0
  %33 = xor i1 %32, true
  %34 = xor i1 %33, true
  %35 = zext i1 %34 to i32
  %36 = sext i32 %35 to i64
  %37 = call i64 @llvm.expect.i64(i64 %36, i64 0)
  %38 = icmp ne i64 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %3
  %40 = load i32, ptr %8, align 4, !tbaa !11
  %41 = call i32 @log_if_error(i32 noundef %40, ptr noundef @__func__.mdbx_txn_info, i32 noundef 436)
  store i32 %41, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %492

42:                                               ; preds = %3
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  %45 = xor i1 %44, true
  %46 = xor i1 %45, true
  %47 = xor i1 %46, true
  %48 = zext i1 %47 to i32
  %49 = sext i32 %48 to i64
  %50 = call i64 @llvm.expect.i64(i64 %49, i64 0)
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %42
  %53 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_txn_info, i32 noundef 439)
  store i32 %53, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %492

54:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MDBX_txn, ptr %55, i32 0, i32 9
  %57 = load ptr, ptr %56, align 8, !tbaa !13
  store ptr %57, ptr %10, align 8, !tbaa !5
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MDBX_txn, ptr %58, i32 0, i32 7
  %60 = load i64, ptr %59, align 8, !tbaa !19
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MDBX_txn_info, ptr %61, i32 0, i32 0
  store i64 %60, ptr %62, align 8, !tbaa !20
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.MDBX_txn, ptr %64, i32 0, i32 6
  %66 = getelementptr inbounds %struct.geo, ptr %65, i32 0, i32 5
  %67 = load i32, ptr %66, align 8, !tbaa !22
  %68 = zext i32 %67 to i64
  %69 = call i64 @pgno2bytes(ptr noundef %63, i64 noundef %68) #9
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.MDBX_txn_info, ptr %70, i32 0, i32 2
  store i64 %69, ptr %71, align 8, !tbaa !23
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.MDBX_txn, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !24
  %75 = and i32 %74, 131072
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %314

77:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #8
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  call void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8 %13, ptr noundef %78)
  br label %79

79:                                               ; preds = %122, %77
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #8
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  call void @meta_recent(ptr dead_on_unwind writable sret(%struct.meta_ptr) align 8 %14, ptr noundef %80, ptr noundef %13)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #8
  %81 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !22
  %83 = getelementptr inbounds %struct.meta, ptr %82, i32 0, i32 10
  %84 = getelementptr inbounds [2 x i32], ptr %83, i64 0, i64 0
  %85 = call i64 @unaligned_peek_u64_volatile(i64 noundef 4, ptr noundef %84)
  store i64 %85, ptr %12, align 8, !tbaa !26
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !22
  %89 = getelementptr inbounds %struct.meta, ptr %88, i32 0, i32 5
  %90 = getelementptr inbounds %struct.geo, ptr %89, i32 0, i32 4
  %91 = load volatile i32, ptr %90, align 4, !tbaa !22
  %92 = zext i32 %91 to i64
  %93 = call i64 @pgno2bytes(ptr noundef %86, i64 noundef %92) #9
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.MDBX_txn_info, ptr %94, i32 0, i32 3
  store i64 %93, ptr %95, align 8, !tbaa !27
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = getelementptr inbounds %struct.meta, ptr %98, i32 0, i32 5
  %100 = getelementptr inbounds %struct.geo, ptr %99, i32 0, i32 3
  %101 = load volatile i32, ptr %100, align 4, !tbaa !28
  %102 = zext i32 %101 to i64
  %103 = call i64 @pgno2bytes(ptr noundef %96, i64 noundef %102) #9
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.MDBX_txn_info, ptr %104, i32 0, i32 4
  store i64 %103, ptr %105, align 8, !tbaa !30
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !22
  %109 = getelementptr inbounds %struct.meta, ptr %108, i32 0, i32 5
  %110 = getelementptr inbounds %struct.geo, ptr %109, i32 0, i32 4
  %111 = load volatile i32, ptr %110, align 4, !tbaa !22
  %112 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !22
  %114 = getelementptr inbounds %struct.meta, ptr %113, i32 0, i32 5
  %115 = getelementptr inbounds %struct.geo, ptr %114, i32 0, i32 5
  %116 = load volatile i32, ptr %115, align 4, !tbaa !22
  %117 = sub i32 %111, %116
  %118 = zext i32 %117 to i64
  %119 = call i64 @pgno2bytes(ptr noundef %106, i64 noundef %118) #9
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MDBX_txn_info, ptr %120, i32 0, i32 6
  store i64 %119, ptr %121, align 8, !tbaa !31
  br label %122

122:                                              ; preds = %79
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = call zeroext i1 @meta_should_retry(ptr noundef %123, ptr noundef %13)
  %125 = xor i1 %124, true
  %126 = xor i1 %125, true
  %127 = zext i1 %126 to i32
  %128 = sext i32 %127 to i64
  %129 = call i64 @llvm.expect.i64(i64 %128, i64 0)
  %130 = icmp ne i64 %129, 0
  br i1 %130, label %79, label %131, !llvm.loop !32

131:                                              ; preds = %122
  %132 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 0
  %133 = load i64, ptr %132, align 8, !tbaa !34
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.MDBX_txn_info, ptr %134, i32 0, i32 0
  %136 = load i64, ptr %135, align 8, !tbaa !20
  %137 = sub i64 %133, %136
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MDBX_txn_info, ptr %138, i32 0, i32 1
  store i64 %137, ptr %139, align 8, !tbaa !36
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.MDBX_txn_info, ptr %140, i32 0, i32 5
  store i64 0, ptr %141, align 8, !tbaa !37
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.MDBX_txn_info, ptr %142, i32 0, i32 7
  store i64 0, ptr %143, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 0, ptr %15, align 8, !tbaa !26
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.MDBX_txn, ptr %144, i32 0, i32 17
  %146 = getelementptr inbounds %struct.anon, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %146, align 8, !tbaa !22
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %313

149:                                              ; preds = %131
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.MDBX_txn, ptr %150, i32 0, i32 1
  %152 = load i32, ptr %151, align 4, !tbaa !24
  %153 = and i32 %152, 32
  %154 = icmp eq i32 %153, 0
  br i1 %154, label %163, label %155

155:                                              ; preds = %149
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.MDBX_txn, ptr %156, i32 0, i32 17
  %158 = getelementptr inbounds %struct.anon, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !22
  %160 = getelementptr inbounds %struct.reader_slot, ptr %159, i32 0, i32 1
  %161 = call i64 @safe64_read(ptr noundef %160)
  %162 = icmp ne i64 %161, -2
  br i1 %162, label %163, label %313

163:                                              ; preds = %155, %149
  %164 = load i64, ptr %12, align 8, !tbaa !26
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.MDBX_txn, ptr %165, i32 0, i32 17
  %167 = getelementptr inbounds %struct.anon, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !22
  %169 = getelementptr inbounds %struct.reader_slot, ptr %168, i32 0, i32 4
  %170 = call i64 @atomic_load64(ptr noundef %169, i32 noundef 0)
  store i64 %170, ptr %15, align 8, !tbaa !26
  %171 = icmp ugt i64 %164, %170
  br i1 %171, label %172, label %313

172:                                              ; preds = %163
  %173 = load ptr, ptr %10, align 8, !tbaa !5
  %174 = load i64, ptr %12, align 8, !tbaa !26
  %175 = load i64, ptr %15, align 8, !tbaa !26
  %176 = sub i64 %174, %175
  %177 = trunc i64 %176 to i32
  %178 = zext i32 %177 to i64
  %179 = call i64 @pgno2bytes(ptr noundef %173, i64 noundef %178) #9
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.MDBX_txn_info, ptr %180, i32 0, i32 5
  store i64 %179, ptr %181, align 8, !tbaa !37
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.MDBX_txn_info, ptr %182, i32 0, i32 7
  store i64 %179, ptr %183, align 8, !tbaa !38
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 0, ptr %16, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.MDBX_env, ptr %184, i32 0, i32 6
  %186 = getelementptr inbounds %struct.osal_mmap, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !22
  store ptr %187, ptr %17, align 8, !tbaa !5
  %188 = load i8, ptr %7, align 1, !tbaa !9, !range !39, !noundef !40
  %189 = trunc i8 %188 to i1
  br i1 %189, label %190, label %309

190:                                              ; preds = %172
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.MDBX_txn_info, ptr %191, i32 0, i32 1
  %193 = load i64, ptr %192, align 8, !tbaa !36
  %194 = icmp ugt i64 %193, 1
  br i1 %194, label %195, label %309

195:                                              ; preds = %190
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %309

198:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %199 = getelementptr inbounds %struct.meta_ptr, ptr %11, i32 0, i32 0
  %200 = load i64, ptr %199, align 8, !tbaa !34
  store i64 %200, ptr %18, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %201 = load ptr, ptr %17, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.shared_lck, ptr %201, i32 0, i32 20
  %203 = call i32 @atomic_load32(ptr noundef %202, i32 noundef 1)
  %204 = zext i32 %203 to i64
  store i64 %204, ptr %19, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store i64 0, ptr %20, align 8, !tbaa !26
  br label %205

205:                                              ; preds = %304, %198
  %206 = load i64, ptr %20, align 8, !tbaa !26
  %207 = load i64, ptr %19, align 8, !tbaa !26
  %208 = icmp ult i64 %206, %207
  br i1 %208, label %210, label %209

209:                                              ; preds = %205
  store i32 4, ptr %9, align 4
  br label %307

210:                                              ; preds = %205
  br label %211

211:                                              ; preds = %300, %210
  %212 = load ptr, ptr %17, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.shared_lck, ptr %212, i32 0, i32 23
  %214 = load i64, ptr %20, align 8, !tbaa !26
  %215 = getelementptr inbounds [0 x %struct.reader_slot], ptr %213, i64 0, i64 %214
  %216 = getelementptr inbounds %struct.reader_slot, ptr %215, i32 0, i32 2
  %217 = call i32 @atomic_load32(ptr noundef %216, i32 noundef 1)
  %218 = icmp ne i32 %217, 0
  br i1 %218, label %219, label %303

219:                                              ; preds = %211
  call void @jitter4testing(i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %220 = load ptr, ptr %17, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.shared_lck, ptr %220, i32 0, i32 23
  %222 = load i64, ptr %20, align 8, !tbaa !26
  %223 = getelementptr inbounds [0 x %struct.reader_slot], ptr %221, i64 0, i64 %222
  %224 = getelementptr inbounds %struct.reader_slot, ptr %223, i32 0, i32 1
  %225 = call i64 @safe64_read(ptr noundef %224)
  store i64 %225, ptr %21, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %226 = load ptr, ptr %17, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.shared_lck, ptr %226, i32 0, i32 23
  %228 = load i64, ptr %20, align 8, !tbaa !26
  %229 = getelementptr inbounds [0 x %struct.reader_slot], ptr %227, i64 0, i64 %228
  %230 = getelementptr inbounds %struct.reader_slot, ptr %229, i32 0, i32 0
  %231 = call i64 @safe64_read(ptr noundef %230)
  store i64 %231, ptr %22, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %232 = load ptr, ptr %17, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.shared_lck, ptr %232, i32 0, i32 23
  %234 = load i64, ptr %20, align 8, !tbaa !26
  %235 = getelementptr inbounds [0 x %struct.reader_slot], ptr %233, i64 0, i64 %234
  %236 = getelementptr inbounds %struct.reader_slot, ptr %235, i32 0, i32 4
  %237 = call i64 @atomic_load64(ptr noundef %236, i32 noundef 1)
  store i64 %237, ptr %23, align 8, !tbaa !26
  %238 = load i64, ptr %23, align 8, !tbaa !26
  %239 = load ptr, ptr %17, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.shared_lck, ptr %239, i32 0, i32 23
  %241 = load i64, ptr %20, align 8, !tbaa !26
  %242 = getelementptr inbounds [0 x %struct.reader_slot], ptr %240, i64 0, i64 %241
  %243 = getelementptr inbounds %struct.reader_slot, ptr %242, i32 0, i32 4
  %244 = call i64 @atomic_load64(ptr noundef %243, i32 noundef 0)
  %245 = icmp ne i64 %238, %244
  %246 = xor i1 %245, true
  %247 = xor i1 %246, true
  %248 = zext i1 %247 to i32
  %249 = sext i32 %248 to i64
  %250 = call i64 @llvm.expect.i64(i64 %249, i64 0)
  %251 = icmp ne i64 %250, 0
  br i1 %251, label %270, label %252

252:                                              ; preds = %219
  %253 = load i64, ptr %22, align 8, !tbaa !26
  %254 = load ptr, ptr %17, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.shared_lck, ptr %254, i32 0, i32 23
  %256 = load i64, ptr %20, align 8, !tbaa !26
  %257 = getelementptr inbounds [0 x %struct.reader_slot], ptr %255, i64 0, i64 %256
  %258 = getelementptr inbounds %struct.reader_slot, ptr %257, i32 0, i32 0
  %259 = call i64 @safe64_read(ptr noundef %258)
  %260 = icmp ne i64 %253, %259
  br i1 %260, label %270, label %261

261:                                              ; preds = %252
  %262 = load i64, ptr %21, align 8, !tbaa !26
  %263 = load ptr, ptr %17, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.shared_lck, ptr %263, i32 0, i32 23
  %265 = load i64, ptr %20, align 8, !tbaa !26
  %266 = getelementptr inbounds [0 x %struct.reader_slot], ptr %264, i64 0, i64 %265
  %267 = getelementptr inbounds %struct.reader_slot, ptr %266, i32 0, i32 1
  %268 = call i64 @safe64_read(ptr noundef %267)
  %269 = icmp ne i64 %262, %268
  br i1 %269, label %270, label %271

270:                                              ; preds = %261, %252, %219
  store i32 7, ptr %9, align 4
  br label %300

271:                                              ; preds = %261
  %272 = load i64, ptr %22, align 8, !tbaa !26
  %273 = load ptr, ptr %5, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.MDBX_txn, ptr %273, i32 0, i32 7
  %275 = load i64, ptr %274, align 8, !tbaa !19
  %276 = icmp ule i64 %272, %275
  br i1 %276, label %277, label %278

277:                                              ; preds = %271
  store i64 0, ptr %16, align 8, !tbaa !26
  store i32 4, ptr %9, align 4
  br label %300

278:                                              ; preds = %271
  %279 = load i64, ptr %22, align 8, !tbaa !26
  %280 = load i64, ptr %18, align 8, !tbaa !26
  %281 = icmp ult i64 %279, %280
  br i1 %281, label %282, label %299

282:                                              ; preds = %278
  %283 = load i64, ptr %21, align 8, !tbaa !26
  %284 = icmp uge i64 %283, -2
  br i1 %284, label %285, label %299

285:                                              ; preds = %282
  %286 = load i64, ptr %22, align 8, !tbaa !26
  store i64 %286, ptr %18, align 8, !tbaa !26
  %287 = load ptr, ptr %10, align 8, !tbaa !5
  %288 = load i64, ptr %23, align 8, !tbaa !26
  %289 = load ptr, ptr %5, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.MDBX_txn, ptr %289, i32 0, i32 17
  %291 = getelementptr inbounds %struct.anon, ptr %290, i32 0, i32 0
  %292 = load ptr, ptr %291, align 8, !tbaa !22
  %293 = getelementptr inbounds %struct.reader_slot, ptr %292, i32 0, i32 4
  %294 = call i64 @atomic_load64(ptr noundef %293, i32 noundef 0)
  %295 = sub i64 %288, %294
  %296 = trunc i64 %295 to i32
  %297 = zext i32 %296 to i64
  %298 = call i64 @pgno2bytes(ptr noundef %287, i64 noundef %297) #9
  store i64 %298, ptr %16, align 8, !tbaa !26
  br label %299

299:                                              ; preds = %285, %282, %278
  store i32 0, ptr %9, align 4
  br label %300

300:                                              ; preds = %299, %277, %270
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  %301 = load i32, ptr %9, align 4
  switch i32 %301, label %307 [
    i32 0, label %302
    i32 7, label %211
  ]

302:                                              ; preds = %300
  br label %303

303:                                              ; preds = %302, %211
  br label %304

304:                                              ; preds = %303
  %305 = load i64, ptr %20, align 8, !tbaa !26
  %306 = add i64 %305, 1
  store i64 %306, ptr %20, align 8, !tbaa !26
  br label %205, !llvm.loop !41

307:                                              ; preds = %300, %209
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %308

308:                                              ; preds = %307
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %309

309:                                              ; preds = %308, %195, %190, %172
  %310 = load i64, ptr %16, align 8, !tbaa !26
  %311 = load ptr, ptr %6, align 8, !tbaa !5
  %312 = getelementptr inbounds %struct.MDBX_txn_info, ptr %311, i32 0, i32 7
  store i64 %310, ptr %312, align 8, !tbaa !38
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %313

313:                                              ; preds = %309, %163, %155, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  br label %491

314:                                              ; preds = %54
  %315 = load ptr, ptr %10, align 8, !tbaa !5
  %316 = load ptr, ptr %5, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.MDBX_txn, ptr %316, i32 0, i32 6
  %318 = getelementptr inbounds %struct.geo, ptr %317, i32 0, i32 4
  %319 = load i32, ptr %318, align 4, !tbaa !22
  %320 = zext i32 %319 to i64
  %321 = call i64 @pgno2bytes(ptr noundef %315, i64 noundef %320) #9
  %322 = load ptr, ptr %6, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct.MDBX_txn_info, ptr %322, i32 0, i32 3
  store i64 %321, ptr %323, align 8, !tbaa !27
  %324 = load ptr, ptr %10, align 8, !tbaa !5
  %325 = load ptr, ptr %5, align 8, !tbaa !5
  %326 = getelementptr inbounds %struct.MDBX_txn, ptr %325, i32 0, i32 6
  %327 = getelementptr inbounds %struct.geo, ptr %326, i32 0, i32 3
  %328 = load i32, ptr %327, align 8, !tbaa !42
  %329 = zext i32 %328 to i64
  %330 = call i64 @pgno2bytes(ptr noundef %324, i64 noundef %329) #9
  %331 = load ptr, ptr %6, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.MDBX_txn_info, ptr %331, i32 0, i32 4
  store i64 %330, ptr %332, align 8, !tbaa !30
  %333 = load ptr, ptr %10, align 8, !tbaa !5
  %334 = load ptr, ptr %5, align 8, !tbaa !5
  %335 = getelementptr inbounds %struct.MDBX_txn, ptr %334, i32 0, i32 5
  %336 = load ptr, ptr %335, align 8, !tbaa !43
  %337 = icmp ne ptr %336, null
  br i1 %337, label %338, label %344

338:                                              ; preds = %314
  %339 = load ptr, ptr %5, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct.MDBX_txn, ptr %339, i32 0, i32 17
  %341 = getelementptr inbounds %struct.anon.2, ptr %340, i32 0, i32 8
  %342 = load ptr, ptr %341, align 8, !tbaa !22
  %343 = ptrtoint ptr %342 to i64
  br label %352

344:                                              ; preds = %314
  %345 = load ptr, ptr %5, align 8, !tbaa !5
  %346 = getelementptr inbounds %struct.MDBX_txn, ptr %345, i32 0, i32 17
  %347 = getelementptr inbounds %struct.anon.2, ptr %346, i32 0, i32 8
  %348 = load ptr, ptr %347, align 8, !tbaa !22
  %349 = getelementptr inbounds i32, ptr %348, i64 0
  %350 = load i32, ptr %349, align 4, !tbaa !11
  %351 = zext i32 %350 to i64
  br label %352

352:                                              ; preds = %344, %338
  %353 = phi i64 [ %343, %338 ], [ %351, %344 ]
  %354 = call i64 @pgno2bytes(ptr noundef %333, i64 noundef %353) #9
  %355 = load ptr, ptr %6, align 8, !tbaa !5
  %356 = getelementptr inbounds %struct.MDBX_txn_info, ptr %355, i32 0, i32 5
  store i64 %354, ptr %356, align 8, !tbaa !37
  %357 = load ptr, ptr %10, align 8, !tbaa !5
  %358 = load ptr, ptr %5, align 8, !tbaa !5
  %359 = getelementptr inbounds %struct.MDBX_txn, ptr %358, i32 0, i32 17
  %360 = getelementptr inbounds %struct.anon.2, ptr %359, i32 0, i32 6
  %361 = load i64, ptr %360, align 8, !tbaa !22
  %362 = call i64 @pgno2bytes(ptr noundef %357, i64 noundef %361) #9
  %363 = load ptr, ptr %6, align 8, !tbaa !5
  %364 = getelementptr inbounds %struct.MDBX_txn_info, ptr %363, i32 0, i32 6
  store i64 %362, ptr %364, align 8, !tbaa !31
  %365 = load ptr, ptr %10, align 8, !tbaa !5
  %366 = load ptr, ptr %5, align 8, !tbaa !5
  %367 = getelementptr inbounds %struct.MDBX_txn, ptr %366, i32 0, i32 17
  %368 = getelementptr inbounds %struct.anon.2, ptr %367, i32 0, i32 7
  %369 = load ptr, ptr %368, align 8, !tbaa !22
  %370 = icmp ne ptr %369, null
  br i1 %370, label %371, label %378

371:                                              ; preds = %352
  %372 = load ptr, ptr %5, align 8, !tbaa !5
  %373 = getelementptr inbounds %struct.MDBX_txn, ptr %372, i32 0, i32 17
  %374 = getelementptr inbounds %struct.anon.2, ptr %373, i32 0, i32 7
  %375 = load ptr, ptr %374, align 8, !tbaa !22
  %376 = getelementptr inbounds %struct.dpl, ptr %375, i32 0, i32 2
  %377 = load i64, ptr %376, align 8, !tbaa !44
  br label %388

378:                                              ; preds = %352
  %379 = load ptr, ptr %5, align 8, !tbaa !5
  %380 = getelementptr inbounds %struct.MDBX_txn, ptr %379, i32 0, i32 17
  %381 = getelementptr inbounds %struct.anon.2, ptr %380, i32 0, i32 11
  %382 = load i64, ptr %381, align 8, !tbaa !22
  %383 = load ptr, ptr %5, align 8, !tbaa !5
  %384 = getelementptr inbounds %struct.MDBX_txn, ptr %383, i32 0, i32 17
  %385 = getelementptr inbounds %struct.anon.2, ptr %384, i32 0, i32 11
  %386 = load i64, ptr %385, align 8, !tbaa !22
  %387 = add i64 %382, %386
  br label %388

388:                                              ; preds = %378, %371
  %389 = phi i64 [ %377, %371 ], [ %387, %378 ]
  %390 = call i64 @pgno2bytes(ptr noundef %365, i64 noundef %389) #9
  %391 = load ptr, ptr %6, align 8, !tbaa !5
  %392 = getelementptr inbounds %struct.MDBX_txn_info, ptr %391, i32 0, i32 7
  store i64 %390, ptr %392, align 8, !tbaa !38
  %393 = load ptr, ptr %6, align 8, !tbaa !5
  %394 = getelementptr inbounds %struct.MDBX_txn_info, ptr %393, i32 0, i32 1
  store i64 9223372036854775807, ptr %394, align 8, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %395 = load ptr, ptr %10, align 8, !tbaa !5
  %396 = getelementptr inbounds %struct.MDBX_env, ptr %395, i32 0, i32 6
  %397 = getelementptr inbounds %struct.osal_mmap, ptr %396, i32 0, i32 0
  %398 = load ptr, ptr %397, align 8, !tbaa !22
  store ptr %398, ptr %24, align 8, !tbaa !5
  %399 = load i8, ptr %7, align 1, !tbaa !9, !range !39, !noundef !40
  %400 = trunc i8 %399 to i1
  br i1 %400, label %401, label %490

401:                                              ; preds = %388
  %402 = load ptr, ptr %24, align 8, !tbaa !5
  %403 = icmp ne ptr %402, null
  br i1 %403, label %404, label %490

404:                                              ; preds = %401
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %405 = load ptr, ptr %5, align 8, !tbaa !5
  %406 = getelementptr inbounds %struct.MDBX_txn, ptr %405, i32 0, i32 7
  %407 = load i64, ptr %406, align 8, !tbaa !19
  store i64 %407, ptr %25, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %408 = load ptr, ptr %24, align 8, !tbaa !5
  %409 = getelementptr inbounds %struct.shared_lck, ptr %408, i32 0, i32 20
  %410 = call i32 @atomic_load32(ptr noundef %409, i32 noundef 1)
  %411 = zext i32 %410 to i64
  store i64 %411, ptr %26, align 8, !tbaa !26
  %412 = load i64, ptr %26, align 8, !tbaa !26
  %413 = icmp ne i64 %412, 0
  br i1 %413, label %414, label %482

414:                                              ; preds = %404
  %415 = load ptr, ptr %5, align 8, !tbaa !5
  %416 = call zeroext i1 @txn_gc_detent(ptr noundef %415)
  %417 = load ptr, ptr %5, align 8, !tbaa !5
  %418 = getelementptr inbounds %struct.MDBX_txn, ptr %417, i32 0, i32 9
  %419 = load ptr, ptr %418, align 8, !tbaa !13
  %420 = getelementptr inbounds %struct.MDBX_env, ptr %419, i32 0, i32 40
  %421 = getelementptr inbounds %struct.anon.21, ptr %420, i32 0, i32 0
  %422 = load i64, ptr %421, align 8, !tbaa !46
  store i64 %422, ptr %25, align 8, !tbaa !26
  %423 = load i64, ptr %25, align 8, !tbaa !26
  %424 = load ptr, ptr %5, align 8, !tbaa !5
  %425 = getelementptr inbounds %struct.MDBX_txn, ptr %424, i32 0, i32 17
  %426 = getelementptr inbounds %struct.anon.2, ptr %425, i32 0, i32 0
  %427 = getelementptr inbounds %struct.troika, ptr %426, i32 0, i32 5
  %428 = load ptr, ptr %5, align 8, !tbaa !5
  %429 = getelementptr inbounds %struct.MDBX_txn, ptr %428, i32 0, i32 17
  %430 = getelementptr inbounds %struct.anon.2, ptr %429, i32 0, i32 0
  %431 = getelementptr inbounds %struct.troika, ptr %430, i32 0, i32 1
  %432 = load i8, ptr %431, align 1, !tbaa !22
  %433 = zext i8 %432 to i64
  %434 = getelementptr inbounds [3 x i64], ptr %427, i64 0, i64 %433
  %435 = load i64, ptr %434, align 8, !tbaa !22
  %436 = icmp eq i64 %423, %435
  br i1 %436, label %437, label %481

437:                                              ; preds = %414
  %438 = load ptr, ptr %5, align 8, !tbaa !5
  %439 = getelementptr inbounds %struct.MDBX_txn, ptr %438, i32 0, i32 7
  %440 = load i64, ptr %439, align 8, !tbaa !19
  store i64 %440, ptr %25, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  store i64 0, ptr %27, align 8, !tbaa !26
  br label %441

441:                                              ; preds = %476, %437
  %442 = load i64, ptr %27, align 8, !tbaa !26
  %443 = load i64, ptr %26, align 8, !tbaa !26
  %444 = icmp ult i64 %442, %443
  br i1 %444, label %446, label %445

445:                                              ; preds = %441
  store i32 8, ptr %9, align 4
  br label %479

446:                                              ; preds = %441
  %447 = load ptr, ptr %24, align 8, !tbaa !5
  %448 = getelementptr inbounds %struct.shared_lck, ptr %447, i32 0, i32 23
  %449 = load i64, ptr %27, align 8, !tbaa !26
  %450 = getelementptr inbounds [0 x %struct.reader_slot], ptr %448, i64 0, i64 %449
  %451 = getelementptr inbounds %struct.reader_slot, ptr %450, i32 0, i32 2
  %452 = call i32 @atomic_load32(ptr noundef %451, i32 noundef 0)
  %453 = icmp ne i32 %452, 0
  br i1 %453, label %454, label %475

454:                                              ; preds = %446
  %455 = load ptr, ptr %5, align 8, !tbaa !5
  %456 = getelementptr inbounds %struct.MDBX_txn, ptr %455, i32 0, i32 9
  %457 = load ptr, ptr %456, align 8, !tbaa !13
  %458 = getelementptr inbounds %struct.MDBX_env, ptr %457, i32 0, i32 40
  %459 = getelementptr inbounds %struct.anon.21, ptr %458, i32 0, i32 0
  %460 = load i64, ptr %459, align 8, !tbaa !46
  %461 = load ptr, ptr %24, align 8, !tbaa !5
  %462 = getelementptr inbounds %struct.shared_lck, ptr %461, i32 0, i32 23
  %463 = load i64, ptr %27, align 8, !tbaa !26
  %464 = getelementptr inbounds [0 x %struct.reader_slot], ptr %462, i64 0, i64 %463
  %465 = getelementptr inbounds %struct.reader_slot, ptr %464, i32 0, i32 0
  %466 = call i64 @safe64_read(ptr noundef %465)
  %467 = icmp eq i64 %460, %466
  br i1 %467, label %468, label %475

468:                                              ; preds = %454
  %469 = load ptr, ptr %5, align 8, !tbaa !5
  %470 = getelementptr inbounds %struct.MDBX_txn, ptr %469, i32 0, i32 9
  %471 = load ptr, ptr %470, align 8, !tbaa !13
  %472 = getelementptr inbounds %struct.MDBX_env, ptr %471, i32 0, i32 40
  %473 = getelementptr inbounds %struct.anon.21, ptr %472, i32 0, i32 0
  %474 = load i64, ptr %473, align 8, !tbaa !46
  store i64 %474, ptr %25, align 8, !tbaa !26
  store i32 8, ptr %9, align 4
  br label %479

475:                                              ; preds = %454, %446
  br label %476

476:                                              ; preds = %475
  %477 = load i64, ptr %27, align 8, !tbaa !26
  %478 = add i64 %477, 1
  store i64 %478, ptr %27, align 8, !tbaa !26
  br label %441, !llvm.loop !55

479:                                              ; preds = %468, %445
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  br label %480

480:                                              ; preds = %479
  br label %481

481:                                              ; preds = %480, %414
  br label %482

482:                                              ; preds = %481, %404
  %483 = load ptr, ptr %5, align 8, !tbaa !5
  %484 = getelementptr inbounds %struct.MDBX_txn, ptr %483, i32 0, i32 7
  %485 = load i64, ptr %484, align 8, !tbaa !19
  %486 = load i64, ptr %25, align 8, !tbaa !26
  %487 = sub i64 %485, %486
  %488 = load ptr, ptr %6, align 8, !tbaa !5
  %489 = getelementptr inbounds %struct.MDBX_txn_info, ptr %488, i32 0, i32 1
  store i64 %487, ptr %489, align 8, !tbaa !36
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %490

490:                                              ; preds = %482, %401, %388
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %491

491:                                              ; preds = %490, %313
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %492

492:                                              ; preds = %491, %52, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  %493 = load i32, ptr %4, align 4
  ret i32 %493
}

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @unaligned_peek_u64_volatile(i64 noundef, ptr noalias noundef) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_load64(ptr noundef, i32 noundef) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @jitter4testing(i1 noundef zeroext) #3

declare zeroext i1 @txn_gc_detent(ptr noundef) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 80}
!14 = !{!"MDBX_txn", !12, i64 0, !12, i64 4, !15, i64 8, !15, i64 16, !6, i64 24, !6, i64 32, !16, i64 40, !15, i64 64, !15, 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}
!15 = !{!"long", !7, i64 0}
!16 = !{!"geo", !17, i64 0, !17, i64 2, !12, i64 4, !12, i64 8, !7, i64 12, !7, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!"MDBX_canary", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!19 = !{!14, !15, i64 64}
!20 = !{!21, !15, i64 0}
!21 = !{!"MDBX_txn_info", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56}
!22 = !{!7, !7, i64 0}
!23 = !{!21, !15, i64 16}
!24 = !{!14, !12, i64 4}
!25 = !{i64 0, i64 8, !26, i64 8, i64 8, !22, i64 16, i64 8, !26}
!26 = !{!15, !15, i64 0}
!27 = !{!21, !15, i64 24}
!28 = !{!29, !12, i64 28}
!29 = !{!"meta", !7, i64 0, !7, i64 8, !17, i64 16, !7, i64 18, !7, i64 19, !16, i64 20, !7, i64 40, !18, i64 136, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 208}
!30 = !{!21, !15, i64 32}
!31 = !{!21, !15, i64 48}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!35, !15, i64 0}
!35 = !{!"meta_ptr", !15, i64 0, !7, i64 8, !15, i64 16}
!36 = !{!21, !15, i64 8}
!37 = !{!21, !15, i64 40}
!38 = !{!21, !15, i64 56}
!39 = !{i8 0, i8 2}
!40 = !{}
!41 = distinct !{!41, !33}
!42 = !{!14, !12, i64 48}
!43 = !{!14, !6, i64 32}
!44 = !{!45, !15, i64 16}
!45 = !{!"dpl", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !7, i64 32}
!46 = !{!47, !15, i64 392}
!47 = !{!"MDBX_env", !7, i64 0, !12, i64 4, !12, i64 8, !48, i64 16, !12, i64 56, !12, i64 60, !48, 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, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144, !49, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !12, i64 224, !12, i64 228, !12, i64 232, !6, i64 240, !6, i64 248, !15, i64 256, !50, i64 264, !52, i64 320, !10, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !53, i64 392, !7, i64 400, !12, i64 440, !12, i64 444, !6, i64 448, !54, i64 456, !7, i64 496, !7, i64 536}
!48 = !{!"osal_mmap", !7, i64 0, !12, i64 8, !15, i64 16, !15, i64 24, !15, i64 32}
!49 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!50 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !15, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !12, i64 28, !12, i64 32, !10, i64 36, !10, i64 37, !10, i64 38, !51, i64 40, !7, i64 48}
!51 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6}
!52 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32}
!53 = !{!"", !15, i64 0}
!54 = !{!"osal_ioring", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!55 = distinct !{!55, !33}


; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.6, i64 }
%union.anon.6 = type { ptr }
%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 }
%union.mdbx_atomic_uint32_t = type { i32 }
%union.mdbx_atomic_uint64_t = type { i64 }

@__func__.mdbx_txn_info = external hidden unnamed_addr constant [14 x i8], align 1

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

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

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

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare zeroext i1 @meta_should_retry(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @safe64_read(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_info(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #4 {
  %4 = alloca %struct.troika, align 8
  %5 = alloca %struct.meta_ptr, align 8
  %6 = tail call i32 @check_txn(ptr noundef %0, i32 noundef 1)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %9, label %7, !prof !5

7:                                                ; preds = %3
  %8 = tail call i32 @log_if_error(i32 noundef %6, ptr noundef nonnull @__func__.mdbx_txn_info, i32 noundef 436)
  br label %194

9:                                                ; preds = %3
  %.not149 = icmp eq ptr %1, null
  br i1 %.not149, label %10, label %12, !prof !6

10:                                               ; preds = %9
  %11 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_txn_info, i32 noundef 439)
  br label %194

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = load ptr, ptr %13, align 8, !tbaa !7
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  %16 = load i64, ptr %15, align 8, !tbaa !17
  store i64 %16, ptr %1, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %0, i64 56
  %18 = load i32, ptr %17, align 8, !tbaa !20
  %19 = zext i32 %18 to i64
  %20 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %19) #6
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  store i64 %20, ptr %21, align 8, !tbaa !21
  %22 = getelementptr inbounds i8, ptr %0, i64 4
  %23 = load i32, ptr %22, align 4, !tbaa !22
  %24 = and i32 %23, 131072
  %.not150 = icmp eq i32 %24, 0
  br i1 %.not150, label %112, label %25

25:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @meta_tap(ptr dead_on_unwind nonnull writable sret(%struct.troika) align 8 %4, ptr noundef %14) #7
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  %26 = getelementptr inbounds i8, ptr %1, i64 24
  %27 = getelementptr inbounds i8, ptr %1, i64 32
  %28 = getelementptr inbounds i8, ptr %1, i64 48
  br label %29

29:                                               ; preds = %29, %25
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  call void @meta_recent(ptr dead_on_unwind nonnull writable sret(%struct.meta_ptr) align 8 %5, ptr noundef %14, ptr noundef nonnull %4)
  %.sroa.0.0.copyload = load i64, ptr %5, align 8, !tbaa !23
  %.sroa.5.0.copyload = load ptr, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  %30 = getelementptr inbounds i8, ptr %.sroa.5.0.copyload, i64 184
  %31 = call i64 @unaligned_peek_u64_volatile(i64 noundef 4, ptr noundef nonnull %30)
  %32 = getelementptr inbounds i8, ptr %.sroa.5.0.copyload, i64 32
  %33 = load volatile i32, ptr %32, align 4, !tbaa !20
  %34 = zext i32 %33 to i64
  %35 = call i64 @pgno2bytes(ptr noundef %14, i64 noundef %34) #6
  store i64 %35, ptr %26, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %.sroa.5.0.copyload, i64 28
  %37 = load volatile i32, ptr %36, align 4, !tbaa !25
  %38 = zext i32 %37 to i64
  %39 = call i64 @pgno2bytes(ptr noundef %14, i64 noundef %38) #6
  store i64 %39, ptr %27, align 8, !tbaa !27
  %40 = load volatile i32, ptr %32, align 4, !tbaa !20
  %41 = getelementptr inbounds i8, ptr %.sroa.5.0.copyload, i64 36
  %42 = load volatile i32, ptr %41, align 4, !tbaa !20
  %43 = sub i32 %40, %42
  %44 = zext i32 %43 to i64
  %45 = call i64 @pgno2bytes(ptr noundef %14, i64 noundef %44) #6
  store i64 %45, ptr %28, align 8, !tbaa !28
  %46 = call zeroext i1 @meta_should_retry(ptr noundef %14, ptr noundef nonnull %4) #7
  br i1 %46, label %29, label %47, !prof !6, !llvm.loop !29

47:                                               ; preds = %29
  %48 = load i64, ptr %1, align 8, !tbaa !18
  %49 = sub i64 %.sroa.0.0.copyload, %48
  %50 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %49, ptr %50, align 8, !tbaa !31
  %51 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 0, ptr %51, align 8, !tbaa !32
  %52 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 0, ptr %52, align 8, !tbaa !33
  %53 = getelementptr inbounds i8, ptr %0, i64 168
  %54 = load ptr, ptr %53, align 8, !tbaa !20
  %.not155 = icmp eq ptr %54, null
  br i1 %.not155, label %111, label %55

55:                                               ; preds = %47
  %56 = load i32, ptr %22, align 4, !tbaa !22
  %57 = and i32 %56, 32
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %62, label %59

59:                                               ; preds = %55
  %60 = getelementptr inbounds i8, ptr %54, i64 8
  %61 = call i64 @safe64_read(ptr noundef nonnull %60)
  %.not156 = icmp eq i64 %61, -2
  br i1 %.not156, label %111, label %._crit_edge

._crit_edge:                                      ; preds = %59
  %.pre = load ptr, ptr %53, align 8, !tbaa !20
  br label %62

62:                                               ; preds = %._crit_edge, %55
  %63 = phi ptr [ %.pre, %._crit_edge ], [ %54, %55 ]
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = call i64 @atomic_load64(ptr noundef nonnull %64, i32 noundef 0)
  %66 = icmp ugt i64 %31, %65
  br i1 %66, label %67, label %111

67:                                               ; preds = %62
  %68 = sub i64 %31, %65
  %69 = and i64 %68, 4294967295
  %70 = call i64 @pgno2bytes(ptr noundef %14, i64 noundef %69) #6
  store i64 %70, ptr %51, align 8, !tbaa !32
  store i64 %70, ptr %52, align 8, !tbaa !33
  %71 = getelementptr inbounds i8, ptr %14, i64 64
  %72 = load ptr, ptr %71, align 8, !tbaa !20
  br i1 %2, label %73, label %.thread165

73:                                               ; preds = %67
  %74 = load i64, ptr %50, align 8, !tbaa !31
  %75 = icmp ugt i64 %74, 1
  %76 = icmp ne ptr %72, null
  %or.cond = select i1 %75, i1 %76, i1 false
  br i1 %or.cond, label %77, label %.thread165

77:                                               ; preds = %73
  %78 = getelementptr inbounds i8, ptr %72, i64 488
  %79 = call i32 @atomic_load32(ptr noundef nonnull %78, i32 noundef 1)
  %80 = zext i32 %79 to i64
  %.not179 = icmp eq i32 %79, 0
  br i1 %.not179, label %.thread165, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %77
  %81 = getelementptr inbounds i8, ptr %72, i64 512
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.thread
  %.0129175 = phi i64 [ 0, %.preheader.lr.ph ], [ %.4, %.thread ]
  %.0131174 = phi i64 [ %.sroa.0.0.copyload, %.preheader.lr.ph ], [ %.4135, %.thread ]
  %.0136173 = phi i64 [ 0, %.preheader.lr.ph ], [ %110, %.thread ]
  %82 = getelementptr inbounds [0 x %struct.reader_slot], ptr %81, i64 0, i64 %.0136173
  %83 = getelementptr inbounds i8, ptr %82, i64 16
  %84 = call i32 @atomic_load32(ptr noundef nonnull %83, i32 noundef 1)
  %.not157172 = icmp eq i32 %84, 0
  br i1 %.not157172, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %85 = getelementptr inbounds i8, ptr %82, i64 8
  %86 = getelementptr inbounds i8, ptr %82, i64 24
  br label %87

87:                                               ; preds = %.lr.ph, %108
  call void @jitter4testing(i1 noundef zeroext true)
  %88 = call i64 @safe64_read(ptr noundef nonnull %85)
  %89 = call i64 @safe64_read(ptr noundef nonnull %82)
  %90 = call i64 @atomic_load64(ptr noundef nonnull %86, i32 noundef 1)
  %91 = call i64 @atomic_load64(ptr noundef nonnull %86, i32 noundef 0)
  %.not158 = icmp eq i64 %90, %91
  br i1 %.not158, label %92, label %108, !prof !5

92:                                               ; preds = %87
  %93 = call i64 @safe64_read(ptr noundef nonnull %82)
  %.not159 = icmp eq i64 %89, %93
  br i1 %.not159, label %94, label %108

94:                                               ; preds = %92
  %95 = call i64 @safe64_read(ptr noundef nonnull %85)
  %.not160 = icmp eq i64 %88, %95
  br i1 %.not160, label %96, label %108

96:                                               ; preds = %94
  %97 = load i64, ptr %15, align 8, !tbaa !17
  %.not161 = icmp ugt i64 %89, %97
  br i1 %.not161, label %98, label %.thread165

98:                                               ; preds = %96
  %99 = icmp ult i64 %89, %.0131174
  %100 = icmp ugt i64 %88, -3
  %or.cond3 = select i1 %99, i1 %100, i1 false
  br i1 %or.cond3, label %101, label %.thread

101:                                              ; preds = %98
  %102 = load ptr, ptr %53, align 8, !tbaa !20
  %103 = getelementptr inbounds i8, ptr %102, i64 24
  %104 = call i64 @atomic_load64(ptr noundef nonnull %103, i32 noundef 0)
  %105 = sub i64 %90, %104
  %106 = and i64 %105, 4294967295
  %107 = call i64 @pgno2bytes(ptr noundef %14, i64 noundef %106) #6
  br label %.thread

108:                                              ; preds = %87, %92, %94
  %109 = call i32 @atomic_load32(ptr noundef nonnull %83, i32 noundef 1)
  %.not157 = icmp eq i32 %109, 0
  br i1 %.not157, label %.thread, label %87

.thread:                                          ; preds = %108, %.preheader, %98, %101
  %.4135 = phi i64 [ %.0131174, %98 ], [ %89, %101 ], [ %.0131174, %.preheader ], [ %.0131174, %108 ]
  %.4 = phi i64 [ %.0129175, %98 ], [ %107, %101 ], [ %.0129175, %.preheader ], [ %.0129175, %108 ]
  %110 = add nuw nsw i64 %.0136173, 1
  %exitcond.not = icmp eq i64 %110, %80
  br i1 %exitcond.not, label %.thread165, label %.preheader, !llvm.loop !34

.thread165:                                       ; preds = %.thread, %96, %77, %73, %67
  %.6 = phi i64 [ 0, %73 ], [ 0, %67 ], [ 0, %77 ], [ %.4, %.thread ], [ 0, %96 ]
  store i64 %.6, ptr %52, align 8, !tbaa !33
  br label %111

111:                                              ; preds = %.thread165, %62, %59, %47
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  br label %194

112:                                              ; preds = %12
  %113 = getelementptr inbounds i8, ptr %0, i64 52
  %114 = load i32, ptr %113, align 4, !tbaa !20
  %115 = zext i32 %114 to i64
  %116 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %115) #6
  %117 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 %116, ptr %117, align 8, !tbaa !24
  %118 = getelementptr inbounds i8, ptr %0, i64 48
  %119 = load i32, ptr %118, align 8, !tbaa !35
  %120 = zext i32 %119 to i64
  %121 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %120) #6
  %122 = getelementptr inbounds i8, ptr %1, i64 32
  store i64 %121, ptr %122, align 8, !tbaa !27
  %123 = getelementptr inbounds i8, ptr %0, i64 32
  %124 = load ptr, ptr %123, align 8, !tbaa !36
  %.not151 = icmp eq ptr %124, null
  %125 = getelementptr inbounds i8, ptr %0, i64 504
  %126 = load ptr, ptr %125, align 8, !tbaa !20
  br i1 %.not151, label %129, label %127

127:                                              ; preds = %112
  %128 = ptrtoint ptr %126 to i64
  br label %132

129:                                              ; preds = %112
  %130 = load i32, ptr %126, align 4, !tbaa !37
  %131 = zext i32 %130 to i64
  br label %132

132:                                              ; preds = %129, %127
  %133 = phi i64 [ %128, %127 ], [ %131, %129 ]
  %134 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %133) #6
  %135 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 %134, ptr %135, align 8, !tbaa !32
  %136 = getelementptr inbounds i8, ptr %0, i64 488
  %137 = load i64, ptr %136, align 8, !tbaa !20
  %138 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %137) #6
  %139 = getelementptr inbounds i8, ptr %1, i64 48
  store i64 %138, ptr %139, align 8, !tbaa !28
  %140 = getelementptr inbounds i8, ptr %0, i64 496
  %141 = load ptr, ptr %140, align 8, !tbaa !20
  %.not152 = icmp eq ptr %141, null
  br i1 %.not152, label %145, label %142

142:                                              ; preds = %132
  %143 = getelementptr inbounds i8, ptr %141, i64 16
  %144 = load i64, ptr %143, align 8, !tbaa !38
  br label %149

145:                                              ; preds = %132
  %146 = getelementptr inbounds i8, ptr %0, i64 528
  %147 = load i64, ptr %146, align 8, !tbaa !20
  %148 = shl i64 %147, 1
  br label %149

149:                                              ; preds = %145, %142
  %150 = phi i64 [ %144, %142 ], [ %148, %145 ]
  %151 = tail call i64 @pgno2bytes(ptr noundef %14, i64 noundef %150) #6
  %152 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 %151, ptr %152, align 8, !tbaa !33
  %153 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 9223372036854775807, ptr %153, align 8, !tbaa !31
  %154 = getelementptr inbounds i8, ptr %14, i64 64
  %155 = load ptr, ptr %154, align 8, !tbaa !20
  %156 = icmp ne ptr %155, null
  %or.cond5 = select i1 %2, i1 %156, i1 false
  br i1 %or.cond5, label %157, label %194

157:                                              ; preds = %149
  %158 = getelementptr inbounds i8, ptr %155, i64 488
  %159 = tail call i32 @atomic_load32(ptr noundef nonnull %158, i32 noundef 1)
  %160 = zext i32 %159 to i64
  %.not153 = icmp eq i32 %159, 0
  br i1 %.not153, label %.loopexit, label %161

161:                                              ; preds = %157
  %162 = tail call zeroext i1 @txn_gc_detent(ptr noundef nonnull %0) #7
  %163 = load ptr, ptr %13, align 8, !tbaa !7
  %164 = getelementptr inbounds i8, ptr %163, i64 392
  %165 = load i64, ptr %164, align 8, !tbaa !40
  %166 = getelementptr inbounds i8, ptr %0, i64 176
  %167 = getelementptr inbounds i8, ptr %0, i64 169
  %168 = load i8, ptr %167, align 1, !tbaa !20
  %169 = zext i8 %168 to i64
  %170 = getelementptr inbounds [3 x i64], ptr %166, i64 0, i64 %169
  %171 = load i64, ptr %170, align 8, !tbaa !20
  %172 = icmp eq i64 %165, %171
  br i1 %172, label %173, label %.loopexit

173:                                              ; preds = %161
  %174 = load i64, ptr %15, align 8, !tbaa !17
  %175 = getelementptr inbounds i8, ptr %155, i64 512
  br label %176

176:                                              ; preds = %173, %190
  %.0178 = phi i64 [ 0, %173 ], [ %191, %190 ]
  %177 = getelementptr inbounds [0 x %struct.reader_slot], ptr %175, i64 0, i64 %.0178
  %178 = getelementptr inbounds i8, ptr %177, i64 16
  %179 = tail call i32 @atomic_load32(ptr noundef nonnull %178, i32 noundef 0)
  %.not154 = icmp eq i32 %179, 0
  br i1 %.not154, label %190, label %180

180:                                              ; preds = %176
  %181 = load ptr, ptr %13, align 8, !tbaa !7
  %182 = getelementptr inbounds i8, ptr %181, i64 392
  %183 = load i64, ptr %182, align 8, !tbaa !40
  %184 = tail call i64 @safe64_read(ptr noundef nonnull %177)
  %185 = icmp eq i64 %183, %184
  br i1 %185, label %186, label %190

186:                                              ; preds = %180
  %187 = load ptr, ptr %13, align 8, !tbaa !7
  %188 = getelementptr inbounds i8, ptr %187, i64 392
  %189 = load i64, ptr %188, align 8, !tbaa !40
  br label %.loopexit

190:                                              ; preds = %176, %180
  %191 = add nuw nsw i64 %.0178, 1
  %exitcond186.not = icmp eq i64 %191, %160
  br i1 %exitcond186.not, label %.loopexit, label %176, !llvm.loop !50

.loopexit:                                        ; preds = %190, %186, %161, %157
  %.1 = phi i64 [ %165, %161 ], [ %16, %157 ], [ %189, %186 ], [ %174, %190 ]
  %192 = load i64, ptr %15, align 8, !tbaa !17
  %193 = sub i64 %192, %.1
  store i64 %193, ptr %153, align 8, !tbaa !31
  br label %194

194:                                              ; preds = %111, %.loopexit, %149, %10, %7
  %.0126 = phi i32 [ %8, %7 ], [ %11, %10 ], [ 0, %149 ], [ 0, %.loopexit ], [ 0, %111 ]
  ret i32 %.0126
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @unaligned_peek_u64_volatile(i64 noundef, ptr noalias noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i64 @atomic_load64(ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @jitter4testing(i1 noundef zeroext) local_unnamed_addr #2

declare zeroext i1 @txn_gc_detent(ptr noundef) local_unnamed_addr #3

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


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