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

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

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon.16 }
%struct.anon.16 = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.MDBX_cursor = type { i32, %union.anon, i8, i8, ptr, ptr, ptr, ptr, ptr, [32 x ptr], [32 x i16], ptr, ptr }
%union.anon = type { i16 }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.2 }
%struct.geo = type { i16, i16, i32, i32, %union.anon.0, %union.anon.1 }
%union.anon.0 = type { i32 }
%union.anon.1 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.2 = type { %struct.anon.4 }
%struct.anon.4 = type { %struct.troika, ptr, %struct.anon.5, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.6 }
%struct.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.anon.5 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.6 = type { %struct.anon.7 }
%struct.anon.7 = type { i64, ptr }
%struct.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.9, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i64, %struct.anon.10, %struct.anon.14, i8, ptr, ptr, ptr, %struct.anon.15, %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.8, i32, i64, i64, i64 }
%union.anon.8 = type { ptr }
%union.mdbx_atomic_uint32_t = type { i32 }
%struct.anon.9 = type { ptr, ptr, ptr, ptr }
%struct.anon.10 = type { i32, i32, i32, i32, i64, i8, i8, i8, i8, i32, i32, i8, i8, i8, %struct.anon.11, %union.anon.12 }
%struct.anon.11 = type { i16, i16, i16, i16 }
%union.anon.12 = type { i32 }
%struct.anon.14 = type { i64, i64, i64, i64, i64 }
%struct.anon.15 = type { i64 }
%struct.osal_ioring = type { i32, i32, i32, ptr, ptr, ptr }
%union.mdbx_atomic_uint64_t = type { i64 }
%struct.kvx = type { %struct.clc2, %struct.iovec }
%struct.clc2 = type { %struct.clc, %struct.clc }
%struct.clc = type { ptr, i64, i64 }
%struct.iovec = type { ptr, i64 }

@globals = external global %struct.libmdbx_globals, align 8
@__func__.mdbx_cursor_unbind = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_cursor_unbind(ptr noundef %0) #5 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  %11 = xor i1 %10, true
  %12 = xor i1 %11, true
  %13 = xor i1 %12, true
  %14 = zext i1 %13 to i32
  %15 = sext i32 %14 to i64
  %16 = call i64 @llvm.expect.i64(i64 %15, i64 0)
  %17 = icmp ne i64 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %1
  %19 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 82)
  store i32 %19, ptr %2, align 4
  br label %348

20:                                               ; preds = %1
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.MDBX_cursor, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp ne i32 %23, 2114311601
  %25 = xor i1 %24, true
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i32
  %28 = sext i32 %27 to i64
  %29 = call i64 @llvm.expect.i64(i64 %28, i64 0)
  %30 = icmp ne i64 %29, 0
  br i1 %30, label %31, label %41

31:                                               ; preds = %20
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.MDBX_cursor, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !9
  %35 = icmp eq i32 %34, 672636999
  br i1 %35, label %36, label %37

36:                                               ; preds = %31
  br label %39

37:                                               ; preds = %31
  %38 = call i32 @log_if_error(i32 noundef -30420, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 85)
  br label %39

39:                                               ; preds = %37, %36
  %40 = phi i32 [ 0, %36 ], [ %38, %37 ]
  store i32 %40, ptr %2, align 4
  br label %348

41:                                               ; preds = %20
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MDBX_cursor, ptr %42, i32 0, i32 12
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %45 = icmp ne ptr %44, null
  %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 = %41
  %53 = call i32 @log_if_error(i32 noundef 22, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 89)
  store i32 %53, ptr %2, align 4
  br label %348

54:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MDBX_cursor, ptr %55, i32 0, i32 5
  %57 = load ptr, ptr %56, align 8, !tbaa !13
  %58 = call i32 @check_txn(ptr noundef %57, i32 noundef 17)
  store i32 %58, ptr %4, align 4, !tbaa !14
  %59 = load i32, ptr %4, align 4, !tbaa !14
  %60 = icmp ne i32 %59, 0
  %61 = xor i1 %60, true
  %62 = xor i1 %61, true
  %63 = zext i1 %62 to i32
  %64 = sext i32 %63 to i64
  %65 = call i64 @llvm.expect.i64(i64 %64, i64 0)
  %66 = icmp ne i64 %65, 0
  br i1 %66, label %67, label %97

67:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.MDBX_cursor, ptr %68, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  store ptr %70, ptr %5, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %90, %67
  %72 = load i32, ptr %4, align 4, !tbaa !14
  %73 = icmp eq i32 %72, -30782
  br i1 %73, label %74, label %78

74:                                               ; preds = %71
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = call i32 @check_txn(ptr noundef %75, i32 noundef 1)
  %77 = icmp eq i32 %76, 0
  br label %78

78:                                               ; preds = %74, %71
  %79 = phi i1 [ false, %71 ], [ %77, %74 ]
  br i1 %79, label %81, label %80

80:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %94

81:                                               ; preds = %78
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = call i64 @cursor_dbi(ptr noundef %83) #9
  %85 = call zeroext i8 @dbi_state(ptr noundef %82, i64 noundef %84)
  %86 = zext i8 %85 to i32
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  store i32 22, ptr %4, align 4, !tbaa !14
  br label %89

89:                                               ; preds = %88, %81
  br label %90

90:                                               ; preds = %89
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.MDBX_txn, ptr %91, i32 0, i32 5
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  store ptr %93, ptr %5, align 8, !tbaa !5
  br label %71, !llvm.loop !21

94:                                               ; preds = %80
  %95 = load i32, ptr %4, align 4, !tbaa !14
  %96 = call i32 @log_if_error(i32 noundef %95, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 100)
  store i32 %96, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %347

97:                                               ; preds = %54
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.MDBX_cursor, ptr %98, i32 0, i32 5
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %109

102:                                              ; preds = %97
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.MDBX_cursor, ptr %103, i32 0, i32 5
  %105 = load ptr, ptr %104, align 8, !tbaa !13
  %106 = getelementptr inbounds %struct.MDBX_txn, ptr %105, i32 0, i32 0
  %107 = load i32, ptr %106, align 8, !tbaa !23
  %108 = icmp ne i32 %107, 332741169
  br label %109

109:                                              ; preds = %102, %97
  %110 = phi i1 [ true, %97 ], [ %108, %102 ]
  %111 = xor i1 %110, true
  %112 = xor i1 %111, true
  %113 = zext i1 %112 to i32
  %114 = sext i32 %113 to i64
  %115 = call i64 @llvm.expect.i64(i64 %114, i64 0)
  %116 = icmp ne i64 %115, 0
  br i1 %116, label %117, label %150

117:                                              ; preds = %109
  br label %118

118:                                              ; preds = %117
  %119 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !24
  %120 = zext i8 %119 to i32
  %121 = icmp sle i32 1, %120
  %122 = xor i1 %121, true
  %123 = xor i1 %122, true
  %124 = zext i1 %123 to i32
  %125 = sext i32 %124 to i64
  %126 = call i64 @llvm.expect.i64(i64 %125, i64 0)
  %127 = icmp ne i64 %126, 0
  br i1 %127, label %128, label %146

128:                                              ; preds = %118
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.MDBX_cursor, ptr %129, i32 0, i32 5
  %131 = load ptr, ptr %130, align 8, !tbaa !13
  %132 = call ptr @__Wpedantic_format_voidptr(ptr noundef %131)
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MDBX_cursor, ptr %133, i32 0, i32 5
  %135 = load ptr, ptr %134, align 8, !tbaa !13
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %143

137:                                              ; preds = %128
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MDBX_cursor, ptr %138, i32 0, i32 5
  %140 = load ptr, ptr %139, align 8, !tbaa !13
  %141 = getelementptr inbounds %struct.MDBX_txn, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 8, !tbaa !23
  br label %144

143:                                              ; preds = %128
  br label %144

144:                                              ; preds = %143, %137
  %145 = phi i32 [ %142, %137 ], [ 0, %143 ]
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 104, ptr noundef @.str.1, ptr noundef %132, i32 noundef %145)
  br label %146

146:                                              ; preds = %144, %118
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  %149 = call i32 @log_if_error(i32 noundef -30779, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 105)
  store i32 %149, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %347

150:                                              ; preds = %109
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.MDBX_cursor, ptr %151, i32 0, i32 11
  %153 = load ptr, ptr %152, align 8, !tbaa !27
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = icmp ne ptr %153, %154
  br i1 %155, label %156, label %343

156:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = call i64 @cursor_dbi(ptr noundef %157) #9
  store i64 %158, ptr %7, align 8, !tbaa !28
  br label %159

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

170:                                              ; preds = %159
  br label %171

171:                                              ; preds = %170
  %172 = load i64, ptr %7, align 8, !tbaa !28
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.MDBX_cursor, ptr %173, i32 0, i32 5
  %175 = load ptr, ptr %174, align 8, !tbaa !13
  %176 = getelementptr inbounds %struct.MDBX_txn, ptr %175, i32 0, i32 2
  %177 = load i64, ptr %176, align 8, !tbaa !30
  %178 = icmp ult i64 %172, %177
  %179 = xor i1 %178, true
  %180 = xor i1 %179, true
  %181 = xor i1 %180, true
  %182 = zext i1 %181 to i32
  %183 = sext i32 %182 to i64
  %184 = call i64 @llvm.expect.i64(i64 %183, i64 0)
  %185 = icmp ne i64 %184, 0
  br i1 %185, label %186, label %192

186:                                              ; preds = %171
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.MDBX_cursor, ptr %187, i32 0, i32 5
  %189 = load ptr, ptr %188, align 8, !tbaa !13
  %190 = getelementptr inbounds %struct.MDBX_txn, ptr %189, i32 0, i32 9
  %191 = load ptr, ptr %190, align 8, !tbaa !31
  call void @mdbx_assert_fail(ptr noundef %191, ptr noundef @.str.2, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 110) #10
  unreachable

192:                                              ; preds = %171
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194, %159
  br label %196

196:                                              ; preds = %195
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  %199 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !29
  %200 = zext i8 %199 to i32
  %201 = and i32 %200, 1
  %202 = icmp ne i32 %201, 0
  %203 = xor i1 %202, true
  %204 = xor i1 %203, true
  %205 = zext i1 %204 to i32
  %206 = sext i32 %205 to i64
  %207 = call i64 @llvm.expect.i64(i64 %206, i64 1)
  %208 = icmp ne i64 %207, 0
  br i1 %208, label %209, label %241

209:                                              ; preds = %198
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr %3, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.MDBX_cursor, ptr %211, i32 0, i32 5
  %213 = load ptr, ptr %212, align 8, !tbaa !13
  %214 = getelementptr inbounds %struct.MDBX_txn, ptr %213, i32 0, i32 9
  %215 = load ptr, ptr %214, align 8, !tbaa !31
  %216 = getelementptr inbounds %struct.MDBX_env, ptr %215, i32 0, i32 25
  %217 = load ptr, ptr %216, align 8, !tbaa !32
  %218 = load i64, ptr %7, align 8, !tbaa !28
  %219 = getelementptr inbounds %struct.kvx, ptr %217, i64 %218
  %220 = getelementptr inbounds %struct.kvx, ptr %219, i32 0, i32 0
  %221 = load ptr, ptr %3, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.MDBX_cursor, ptr %221, i32 0, i32 7
  %223 = load ptr, ptr %222, align 8, !tbaa !41
  %224 = icmp eq ptr %220, %223
  %225 = xor i1 %224, true
  %226 = xor i1 %225, true
  %227 = xor i1 %226, true
  %228 = zext i1 %227 to i32
  %229 = sext i32 %228 to i64
  %230 = call i64 @llvm.expect.i64(i64 %229, i64 0)
  %231 = icmp ne i64 %230, 0
  br i1 %231, label %232, label %238

232:                                              ; preds = %210
  %233 = load ptr, ptr %3, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.MDBX_cursor, ptr %233, i32 0, i32 5
  %235 = load ptr, ptr %234, align 8, !tbaa !13
  %236 = getelementptr inbounds %struct.MDBX_txn, ptr %235, i32 0, i32 9
  %237 = load ptr, ptr %236, align 8, !tbaa !31
  call void @mdbx_assert_fail(ptr noundef %237, ptr noundef @.str.3, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 111) #10
  unreachable

238:                                              ; preds = %210
  br label %239

239:                                              ; preds = %238
  br label %240

240:                                              ; preds = %239
  br label %241

241:                                              ; preds = %240, %198
  br label %242

242:                                              ; preds = %241
  br label %243

243:                                              ; preds = %242
  %244 = load i64, ptr %7, align 8, !tbaa !28
  %245 = load ptr, ptr %3, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.MDBX_cursor, ptr %245, i32 0, i32 5
  %247 = load ptr, ptr %246, align 8, !tbaa !13
  %248 = getelementptr inbounds %struct.MDBX_txn, ptr %247, i32 0, i32 2
  %249 = load i64, ptr %248, align 8, !tbaa !30
  %250 = icmp ult i64 %244, %249
  br i1 %250, label %251, label %339

251:                                              ; preds = %243
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %252 = load ptr, ptr %3, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.MDBX_cursor, ptr %252, i32 0, i32 5
  %254 = load ptr, ptr %253, align 8, !tbaa !13
  %255 = getelementptr inbounds %struct.MDBX_txn, ptr %254, i32 0, i32 14
  %256 = load ptr, ptr %255, align 8, !tbaa !42
  %257 = load i64, ptr %7, align 8, !tbaa !28
  %258 = getelementptr inbounds ptr, ptr %256, i64 %257
  store ptr %258, ptr %8, align 8, !tbaa !5
  br label %259

259:                                              ; preds = %294, %251
  %260 = load ptr, ptr %8, align 8, !tbaa !5
  %261 = load ptr, ptr %260, align 8, !tbaa !5
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = icmp ne ptr %261, %262
  br i1 %263, label %264, label %298

264:                                              ; preds = %259
  br label %265

265:                                              ; preds = %264
  %266 = load ptr, ptr %8, align 8, !tbaa !5
  %267 = load ptr, ptr %266, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.MDBX_cursor, ptr %267, i32 0, i32 0
  %269 = load i32, ptr %268, align 8, !tbaa !9
  %270 = icmp eq i32 %269, 2114311601
  br i1 %270, label %277, label %271

271:                                              ; preds = %265
  %272 = load ptr, ptr %8, align 8, !tbaa !5
  %273 = load ptr, ptr %272, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.MDBX_cursor, ptr %273, i32 0, i32 0
  %275 = load i32, ptr %274, align 8, !tbaa !9
  %276 = icmp eq i32 %275, 283285415
  br label %277

277:                                              ; preds = %271, %265
  %278 = phi i1 [ true, %265 ], [ %276, %271 ]
  %279 = xor i1 %278, true
  %280 = xor i1 %279, true
  %281 = xor i1 %280, true
  %282 = zext i1 %281 to i32
  %283 = sext i32 %282 to i64
  %284 = call i64 @llvm.expect.i64(i64 %283, i64 0)
  %285 = icmp ne i64 %284, 0
  br i1 %285, label %286, label %292

286:                                              ; preds = %277
  %287 = load ptr, ptr %3, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.MDBX_cursor, ptr %287, i32 0, i32 5
  %289 = load ptr, ptr %288, align 8, !tbaa !13
  %290 = getelementptr inbounds %struct.MDBX_txn, ptr %289, i32 0, i32 9
  %291 = load ptr, ptr %290, align 8, !tbaa !31
  call void @mdbx_assert_fail(ptr noundef %291, ptr noundef @.str.4, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 115) #10
  unreachable

292:                                              ; preds = %277
  br label %293

293:                                              ; preds = %292
  br label %294

294:                                              ; preds = %293
  %295 = load ptr, ptr %8, align 8, !tbaa !5
  %296 = load ptr, ptr %295, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.MDBX_cursor, ptr %296, i32 0, i32 11
  store ptr %297, ptr %8, align 8, !tbaa !5
  br label %259, !llvm.loop !43

298:                                              ; preds = %259
  br label %299

299:                                              ; preds = %298
  %300 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !29
  %301 = zext i8 %300 to i32
  %302 = and i32 %301, 1
  %303 = icmp ne i32 %302, 0
  %304 = xor i1 %303, true
  %305 = xor i1 %304, true
  %306 = zext i1 %305 to i32
  %307 = sext i32 %306 to i64
  %308 = call i64 @llvm.expect.i64(i64 %307, i64 1)
  %309 = icmp ne i64 %308, 0
  br i1 %309, label %310, label %332

310:                                              ; preds = %299
  br label %311

311:                                              ; preds = %310
  %312 = load ptr, ptr %8, align 8, !tbaa !5
  %313 = load ptr, ptr %312, align 8, !tbaa !5
  %314 = load ptr, ptr %3, align 8, !tbaa !5
  %315 = icmp eq ptr %313, %314
  %316 = xor i1 %315, true
  %317 = xor i1 %316, true
  %318 = xor i1 %317, true
  %319 = zext i1 %318 to i32
  %320 = sext i32 %319 to i64
  %321 = call i64 @llvm.expect.i64(i64 %320, i64 0)
  %322 = icmp ne i64 %321, 0
  br i1 %322, label %323, label %329

323:                                              ; preds = %311
  %324 = load ptr, ptr %3, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct.MDBX_cursor, ptr %324, i32 0, i32 5
  %326 = load ptr, ptr %325, align 8, !tbaa !13
  %327 = getelementptr inbounds %struct.MDBX_txn, ptr %326, i32 0, i32 9
  %328 = load ptr, ptr %327, align 8, !tbaa !31
  call void @mdbx_assert_fail(ptr noundef %328, ptr noundef @.str.5, ptr noundef @__func__.mdbx_cursor_unbind, i32 noundef 118) #10
  unreachable

329:                                              ; preds = %311
  br label %330

330:                                              ; preds = %329
  br label %331

331:                                              ; preds = %330
  br label %332

332:                                              ; preds = %331, %299
  br label %333

333:                                              ; preds = %332
  br label %334

334:                                              ; preds = %333
  %335 = load ptr, ptr %3, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.MDBX_cursor, ptr %335, i32 0, i32 11
  %337 = load ptr, ptr %336, align 8, !tbaa !27
  %338 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %337, ptr %338, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %339

339:                                              ; preds = %334, %243
  %340 = load ptr, ptr %3, align 8, !tbaa !5
  %341 = load ptr, ptr %3, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.MDBX_cursor, ptr %341, i32 0, i32 11
  store ptr %340, ptr %342, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %343

343:                                              ; preds = %339, %150
  %344 = load ptr, ptr %3, align 8, !tbaa !5
  call void @cursor_drown(ptr noundef %344)
  %345 = load ptr, ptr %3, align 8, !tbaa !5
  %346 = getelementptr inbounds %struct.MDBX_cursor, ptr %345, i32 0, i32 0
  store i32 672636999, ptr %346, align 8, !tbaa !9
  store i32 0, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %347

347:                                              ; preds = %343, %148, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %348

348:                                              ; preds = %347, %52, %39, %18
  %349 = load i32, ptr %2, align 4
  ret i32 %349
}

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__Wpedantic_format_voidptr(ptr noundef) #2

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

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

!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, !11, i64 0}
!10 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 376}
!13 = !{!10, !6, i64 16}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 32}
!16 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !17, i64 8, !17, i64 16, !6, i64 24, !6, i64 32, !18, i64 40, !17, i64 64, !17, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !20, i64 128, !6, i64 160, !7, i64 168}
!17 = !{!"long", !7, i64 0}
!18 = !{!"geo", !19, i64 0, !19, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!19 = !{!"short", !7, i64 0}
!20 = !{!"MDBX_canary", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!16, !11, i64 0}
!24 = !{!25, !7, i64 26}
!25 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !26, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !17, i64 80, !6, i64 88}
!26 = !{!"_Bool", !7, i64 0}
!27 = !{!10, !6, i64 368}
!28 = !{!17, !17, i64 0}
!29 = !{!25, !7, i64 25}
!30 = !{!16, !17, i64 8}
!31 = !{!16, !6, i64 80}
!32 = !{!33, !6, i64 200}
!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, !19, i64 112, !19, i64 114, !19, i64 116, !19, i64 118, !19, i64 120, !19, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !19, 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, !17, i64 256, !36, i64 264, !38, i64 320, !26, 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, !17, i64 16, !17, i64 24, !17, 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, !17, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !11, i64 28, !11, i64 32, !26, i64 36, !26, i64 37, !26, i64 38, !37, i64 40, !7, i64 48}
!37 = !{!"", !19, i64 0, !19, i64 2, !19, i64 4, !19, i64 6}
!38 = !{!"", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32}
!39 = !{!"", !17, i64 0}
!40 = !{!"osal_ioring", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!41 = !{!10, !6, i64 32}
!42 = !{!16, !6, i64 120}
!43 = distinct !{!43, !22}


; 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.16 }
%struct.anon.16 = 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.kvx = type { %struct.clc2, %struct.iovec }
%struct.clc2 = type { %struct.clc, %struct.clc }
%struct.clc = type { ptr, i64, i64 }
%struct.iovec = type { ptr, i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@__func__.mdbx_cursor_unbind = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [89 x i8], align 1

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr noundef, i32 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: nounwind uwtable
define dso_local i32 @mdbx_cursor_unbind(ptr noundef %0) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %4, !prof !5

2:                                                ; preds = %1
  %3 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 82)
  br label %72

4:                                                ; preds = %1
  %5 = load i32, ptr %0, align 8, !tbaa !6
  switch i32 %5, label %6 [
    i32 2114311601, label %8
    i32 672636999, label %72
  ], !prof !12

6:                                                ; preds = %4
  %7 = tail call i32 @log_if_error(i32 noundef -30420, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 85)
  br label %72

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 376
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %.not61 = icmp eq ptr %10, null
  br i1 %.not61, label %13, label %11, !prof !14

11:                                               ; preds = %8
  %12 = tail call i32 @log_if_error(i32 noundef 22, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 89)
  br label %72

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = tail call i32 @check_txn(ptr noundef %15, i32 noundef 17)
  switch i32 %16, label %.critedge [
    i32 0, label %23
    i32 -30782, label %.lr.ph
  ], !prof !12

.lr.ph:                                           ; preds = %13, %select.unfold
  %.04881.in = phi ptr [ %22, %select.unfold ], [ %14, %13 ]
  %.04881 = load ptr, ptr %.04881.in, align 8, !tbaa !16
  %17 = tail call i32 @check_txn(ptr noundef %.04881, i32 noundef 1)
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %select.unfold, label %.critedge

.critedge:                                        ; preds = %.lr.ph, %select.unfold, %13
  %.049.lcssa = phi i32 [ %16, %13 ], [ 22, %select.unfold ], [ -30782, %.lr.ph ]
  %19 = tail call i32 @log_if_error(i32 noundef %.049.lcssa, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 100)
  br label %72

select.unfold:                                    ; preds = %.lr.ph
  %20 = tail call i64 @cursor_dbi(ptr noundef nonnull %0) #6
  %21 = tail call zeroext i8 @dbi_state(ptr noundef %.04881, i64 noundef %20)
  %.not86 = icmp eq i8 %21, 0
  %22 = getelementptr inbounds i8, ptr %.04881, i64 32
  br i1 %.not86, label %.critedge, label %.lr.ph

23:                                               ; preds = %13
  %24 = load ptr, ptr %14, align 8, !tbaa !15
  %.not63 = icmp eq ptr %24, null
  br i1 %.not63, label %.critedge75, label %25, !prof !5

25:                                               ; preds = %23
  %26 = load i32, ptr %24, align 8, !tbaa !17
  %.not77 = icmp eq i32 %26, 332741169
  br i1 %.not77, label %37, label %.critedge75, !prof !14

.critedge75:                                      ; preds = %23, %25
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !23
  %.not72 = icmp eq i8 %27, 0
  br i1 %.not72, label %35, label %28, !prof !14

28:                                               ; preds = %.critedge75
  %29 = tail call ptr @__Wpedantic_format_voidptr(ptr noundef %24)
  %30 = load ptr, ptr %14, align 8, !tbaa !15
  %.not73 = icmp eq ptr %30, null
  br i1 %.not73, label %33, label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %30, align 8, !tbaa !17
  br label %33

33:                                               ; preds = %28, %31
  %34 = phi i32 [ %32, %31 ], [ 0, %28 ]
  tail call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 104, ptr noundef nonnull @.str.1, ptr noundef %29, i32 noundef %34) #7
  br label %35

35:                                               ; preds = %33, %.critedge75
  %36 = tail call i32 @log_if_error(i32 noundef -30779, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 105)
  br label %72

37:                                               ; preds = %25
  %38 = getelementptr inbounds i8, ptr %0, i64 368
  %39 = load ptr, ptr %38, align 8, !tbaa !26
  %.not64 = icmp eq ptr %39, %0
  br i1 %.not64, label %71, label %40

40:                                               ; preds = %37
  %41 = tail call i64 @cursor_dbi(ptr noundef nonnull %0) #6
  %42 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !27
  %43 = and i8 %42, 1
  %.not65 = icmp eq i8 %43, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %24, i64 8
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !28
  br i1 %.not65, label %.thread, label %44, !prof !5

44:                                               ; preds = %40
  %.not66 = icmp ult i64 %41, %.pre
  %45 = getelementptr inbounds i8, ptr %24, i64 80
  %46 = load ptr, ptr %45, align 8, !tbaa !29
  br i1 %.not66, label %48, label %47, !prof !14

47:                                               ; preds = %44
  tail call void @mdbx_assert_fail(ptr noundef %46, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 110) #8
  unreachable

48:                                               ; preds = %44
  %49 = getelementptr inbounds i8, ptr %46, i64 200
  %50 = load ptr, ptr %49, align 8, !tbaa !30
  %51 = getelementptr inbounds %struct.kvx, ptr %50, i64 %41
  %52 = getelementptr inbounds i8, ptr %0, i64 32
  %53 = load ptr, ptr %52, align 8, !tbaa !39
  %.not68 = icmp eq ptr %51, %53
  br i1 %.not68, label %.thread, label %54, !prof !14

54:                                               ; preds = %48
  tail call void @mdbx_assert_fail(ptr noundef nonnull %46, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 111) #8
  unreachable

.thread:                                          ; preds = %40, %48
  %55 = icmp ult i64 %41, %.pre
  br i1 %55, label %56, label %70

56:                                               ; preds = %.thread
  %57 = getelementptr inbounds i8, ptr %24, i64 120
  %58 = load ptr, ptr %57, align 8, !tbaa !40
  %59 = getelementptr inbounds ptr, ptr %58, i64 %41
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %.not6983 = icmp eq ptr %60, %0
  br i1 %.not6983, label %._crit_edge, label %.lr.ph84

.lr.ph84:                                         ; preds = %56, %66
  %61 = phi ptr [ %68, %66 ], [ %60, %56 ]
  %62 = load i32, ptr %61, align 8, !tbaa !6
  switch i32 %62, label %63 [
    i32 2114311601, label %66
    i32 283285415, label %66
  ]

63:                                               ; preds = %.lr.ph84
  %64 = getelementptr inbounds i8, ptr %24, i64 80
  %65 = load ptr, ptr %64, align 8, !tbaa !29
  tail call void @mdbx_assert_fail(ptr noundef %65, ptr noundef nonnull @.str.4, ptr noundef nonnull @__func__.mdbx_cursor_unbind, i32 noundef 115) #8
  unreachable

66:                                               ; preds = %.lr.ph84, %.lr.ph84
  %67 = getelementptr inbounds i8, ptr %61, i64 368
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %.not69 = icmp eq ptr %68, %0
  br i1 %.not69, label %._crit_edge.loopexit, label %.lr.ph84, !llvm.loop !41

._crit_edge.loopexit:                             ; preds = %66
  %69 = getelementptr inbounds i8, ptr %61, i64 368
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %56
  %.0.lcssa = phi ptr [ %59, %56 ], [ %69, %._crit_edge.loopexit ]
  store ptr %39, ptr %.0.lcssa, align 8, !tbaa !16
  br label %70

70:                                               ; preds = %._crit_edge, %.thread
  store ptr %0, ptr %38, align 8, !tbaa !26
  br label %71

71:                                               ; preds = %70, %37
  tail call void @cursor_drown(ptr noundef nonnull %0)
  store i32 672636999, ptr %0, align 8, !tbaa !6
  br label %72

72:                                               ; preds = %.critedge, %35, %71, %6, %4, %11, %2
  %.1 = phi i32 [ %3, %2 ], [ %12, %11 ], [ %7, %6 ], [ 0, %4 ], [ %19, %.critedge ], [ %36, %35 ], [ 0, %71 ]
  ret i32 %.1
}

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__Wpedantic_format_voidptr(ptr noundef) local_unnamed_addr #0

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

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


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