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

@globals = external global %struct.libmdbx_globals, align 8
@__func__.mdbx_txn_commit_ex = external hidden unnamed_addr constant [19 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 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

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

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

declare i32 @txn_end(ptr noundef, i32 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @osal_thread_self() #3

declare i32 @txn_abort(ptr noundef) #5

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_commit_ex(ptr noundef %0, ptr noundef %1) #6 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.commit_timestamp, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 56, ptr %6) #7
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  call void @latency_init(ptr noundef %13, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i32 @check_txn(ptr noundef %14, i32 noundef 1)
  store i32 %15, ptr %7, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  %18 = xor i1 %17, true
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i32
  %21 = sext i32 %20 to i64
  %22 = call i64 @llvm.expect.i64(i64 %21, i64 0)
  %23 = icmp ne i64 %22, 0
  br i1 %23, label %24, label %37

24:                                               ; preds = %2
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = icmp eq i32 %25, -30782
  br i1 %26, label %27, label %34

27:                                               ; preds = %24
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.MDBX_txn, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = and i32 %30, 131073
  %32 = icmp eq i32 %31, 131073
  br i1 %32, label %33, label %34

33:                                               ; preds = %27
  store i32 -1, ptr %7, align 4, !tbaa !9
  br label %149

34:                                               ; preds = %27, %24
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = call i32 @log_if_error(i32 noundef %35, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 352)
  store i32 %36, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

37:                                               ; preds = %2
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.MDBX_txn, ptr %38, i32 0, i32 9
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  store ptr %40, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.MDBX_txn, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = and i32 %43, 131072
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %105

46:                                               ; preds = %37
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.MDBX_txn, ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = icmp ne ptr %49, null
  br i1 %50, label %69, label %51

51:                                               ; preds = %46
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MDBX_txn, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !11
  %55 = and i32 %54, 16
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %69, label %57

57:                                               ; preds = %51
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.MDBX_env, ptr %59, i32 0, i32 39
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = icmp eq ptr %58, %61
  br i1 %62, label %69, label %63

63:                                               ; preds = %57
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.MDBX_env, ptr %65, i32 0, i32 24
  %67 = load ptr, ptr %66, align 8, !tbaa !29
  %68 = icmp eq ptr %64, %67
  br label %69

69:                                               ; preds = %63, %57, %51, %46
  %70 = phi i1 [ true, %57 ], [ true, %51 ], [ true, %46 ], [ %68, %63 ]
  %71 = xor i1 %70, true
  %72 = xor i1 %71, true
  %73 = zext i1 %72 to i32
  %74 = sext i32 %73 to i64
  %75 = call i64 @llvm.expect.i64(i64 %74, i64 0)
  %76 = icmp ne i64 %75, 0
  br i1 %76, label %77, label %93

77:                                               ; preds = %69
  br label %78

78:                                               ; preds = %77
  %79 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !30
  %80 = zext i8 %79 to i32
  %81 = icmp sle i32 1, %80
  %82 = xor i1 %81, true
  %83 = xor i1 %82, true
  %84 = zext i1 %83 to i32
  %85 = sext i32 %84 to i64
  %86 = call i64 @llvm.expect.i64(i64 %85, i64 0)
  %87 = icmp ne i64 %86, 0
  br i1 %87, label %88, label %90

88:                                               ; preds = %78
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 364, ptr noundef @.str.14, ptr noundef @.str.15, ptr noundef %89)
  br label %90

90:                                               ; preds = %88, %78
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  store i32 -30779, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

93:                                               ; preds = %69
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  call void @latency_gcprof(ptr noundef %94, ptr noundef %95)
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.MDBX_txn, ptr %96, i32 0, i32 1
  %98 = load i32, ptr %97, align 4, !tbaa !11
  %99 = and i32 %98, 2
  %100 = icmp ne i32 %99, 0
  %101 = zext i1 %100 to i64
  %102 = select i1 %100, i32 -1, i32 0
  store i32 %102, ptr %7, align 4, !tbaa !9
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = call i32 @txn_end(ptr noundef %103, i32 noundef 113)
  br label %342

105:                                              ; preds = %37
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.MDBX_txn, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %107, align 4, !tbaa !11
  %109 = and i32 %108, 2097152
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %136

111:                                              ; preds = %105
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.MDBX_env, ptr %113, i32 0, i32 24
  %115 = load ptr, ptr %114, align 8, !tbaa !29
  %116 = icmp eq ptr %112, %115
  br i1 %116, label %117, label %136

117:                                              ; preds = %111
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.MDBX_txn, ptr %118, i32 0, i32 3
  %120 = load i64, ptr %119, align 8, !tbaa !32
  %121 = call i64 @osal_thread_self()
  %122 = icmp ne i64 %120, %121
  %123 = xor i1 %122, true
  %124 = xor i1 %123, true
  %125 = zext i1 %124 to i32
  %126 = sext i32 %125 to i64
  %127 = call i64 @llvm.expect.i64(i64 %126, i64 0)
  %128 = icmp ne i64 %127, 0
  br i1 %128, label %129, label %136

129:                                              ; preds = %117
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MDBX_txn, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !11
  %133 = or i32 %132, 2
  store i32 %133, ptr %131, align 4, !tbaa !11
  store i32 -30416, ptr %7, align 4, !tbaa !9
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = call i32 @log_if_error(i32 noundef %134, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 377)
  store i32 %135, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

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

148:                                              ; preds = %136
  store i32 -1, ptr %7, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %217, %148, %33
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  call void @latency_gcprof(ptr noundef %150, ptr noundef %151)
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = call i32 @txn_abort(ptr noundef %152)
  store i32 %153, ptr %10, align 4, !tbaa !9
  %154 = load i32, ptr %10, align 4, !tbaa !9
  %155 = icmp ne i32 %154, 0
  %156 = xor i1 %155, true
  %157 = xor i1 %156, true
  %158 = zext i1 %157 to i32
  %159 = sext i32 %158 to i64
  %160 = call i64 @llvm.expect.i64(i64 %159, i64 0)
  %161 = icmp ne i64 %160, 0
  br i1 %161, label %162, label %164

162:                                              ; preds = %149
  %163 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %163, ptr %7, align 4, !tbaa !9
  br label %164

164:                                              ; preds = %162, %149
  br label %342

165:                                              ; preds = %136
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.MDBX_txn, ptr %166, i32 0, i32 5
  %168 = load ptr, ptr %167, align 8, !tbaa !33
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %219

170:                                              ; preds = %165
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.MDBX_txn, ptr %171, i32 0, i32 5
  %173 = load ptr, ptr %172, align 8, !tbaa !33
  %174 = call i32 @mdbx_txn_commit_ex(ptr noundef %173, ptr noundef null)
  store i32 %174, ptr %7, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %170
  %176 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !34
  %177 = zext i8 %176 to i32
  %178 = and i32 %177, 1
  %179 = icmp ne i32 %178, 0
  %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 1)
  %185 = icmp ne i64 %184, 0
  br i1 %185, label %186, label %206

186:                                              ; preds = %175
  br label %187

187:                                              ; preds = %186
  %188 = load ptr, ptr %4, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.MDBX_txn, ptr %188, i32 0, i32 5
  %190 = load ptr, ptr %189, align 8, !tbaa !33
  %191 = icmp eq ptr %190, null
  %192 = xor i1 %191, true
  %193 = xor i1 %192, true
  %194 = xor i1 %193, true
  %195 = zext i1 %194 to i32
  %196 = sext i32 %195 to i64
  %197 = call i64 @llvm.expect.i64(i64 %196, i64 0)
  %198 = icmp ne i64 %197, 0
  br i1 %198, label %199, label %203

199:                                              ; preds = %187
  %200 = load ptr, ptr %4, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.MDBX_txn, ptr %200, i32 0, i32 9
  %202 = load ptr, ptr %201, align 8, !tbaa !17
  call void @mdbx_assert_fail(ptr noundef %202, ptr noundef @.str.16, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 393) #8
  unreachable

203:                                              ; preds = %187
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205, %175
  br label %207

207:                                              ; preds = %206
  br label %208

208:                                              ; preds = %207
  %209 = load i32, ptr %7, align 4, !tbaa !9
  %210 = icmp ne i32 %209, 0
  %211 = xor i1 %210, true
  %212 = xor i1 %211, true
  %213 = zext i1 %212 to i32
  %214 = sext i32 %213 to i64
  %215 = call i64 @llvm.expect.i64(i64 %214, i64 0)
  %216 = icmp ne i64 %215, 0
  br i1 %216, label %217, label %218

217:                                              ; preds = %208
  br label %149

218:                                              ; preds = %208
  br label %219

219:                                              ; preds = %218, %165
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = load ptr, ptr %9, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.MDBX_env, ptr %221, i32 0, i32 39
  %223 = load ptr, ptr %222, align 8, !tbaa !19
  %224 = icmp ne ptr %220, %223
  %225 = xor i1 %224, true
  %226 = xor i1 %225, true
  %227 = zext i1 %226 to i32
  %228 = sext i32 %227 to i64
  %229 = call i64 @llvm.expect.i64(i64 %228, i64 0)
  %230 = icmp ne i64 %229, 0
  br i1 %230, label %231, label %247

231:                                              ; preds = %219
  br label %232

232:                                              ; preds = %231
  %233 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !30
  %234 = zext i8 %233 to i32
  %235 = icmp sle i32 1, %234
  %236 = xor i1 %235, true
  %237 = xor i1 %236, true
  %238 = zext i1 %237 to i32
  %239 = sext i32 %238 to i64
  %240 = call i64 @llvm.expect.i64(i64 %239, i64 0)
  %241 = icmp ne i64 %240, 0
  br i1 %241, label %242, label %244

242:                                              ; preds = %232
  %243 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 399, ptr noundef @.str.14, ptr noundef @.str.17, ptr noundef %243)
  br label %244

244:                                              ; preds = %242, %232
  br label %245

245:                                              ; preds = %244
  br label %246

246:                                              ; preds = %245
  store i32 22, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

247:                                              ; preds = %219
  %248 = load ptr, ptr %4, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.MDBX_txn, ptr %248, i32 0, i32 4
  %250 = load ptr, ptr %249, align 8, !tbaa !18
  %251 = icmp ne ptr %250, null
  br i1 %251, label %252, label %303

252:                                              ; preds = %247
  %253 = load ptr, ptr %4, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.MDBX_txn, ptr %253, i32 0, i32 4
  %255 = load ptr, ptr %254, align 8, !tbaa !18
  %256 = getelementptr inbounds %struct.MDBX_txn, ptr %255, i32 0, i32 5
  %257 = load ptr, ptr %256, align 8, !tbaa !33
  %258 = load ptr, ptr %4, align 8, !tbaa !5
  %259 = icmp ne ptr %257, %258
  br i1 %259, label %268, label %260

260:                                              ; preds = %252
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.MDBX_txn, ptr %261, i32 0, i32 4
  %263 = load ptr, ptr %262, align 8, !tbaa !18
  %264 = getelementptr inbounds %struct.MDBX_txn, ptr %263, i32 0, i32 9
  %265 = load ptr, ptr %264, align 8, !tbaa !17
  %266 = load ptr, ptr %9, align 8, !tbaa !5
  %267 = icmp ne ptr %265, %266
  br label %268

268:                                              ; preds = %260, %252
  %269 = phi i1 [ true, %252 ], [ %267, %260 ]
  %270 = xor i1 %269, true
  %271 = xor i1 %270, true
  %272 = zext i1 %271 to i32
  %273 = sext i32 %272 to i64
  %274 = call i64 @llvm.expect.i64(i64 %273, i64 0)
  %275 = icmp ne i64 %274, 0
  br i1 %275, label %276, label %292

276:                                              ; preds = %268
  br label %277

277:                                              ; preds = %276
  %278 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 5), align 2, !tbaa !30
  %279 = zext i8 %278 to i32
  %280 = icmp sle i32 1, %279
  %281 = xor i1 %280, true
  %282 = xor i1 %281, true
  %283 = zext i1 %282 to i32
  %284 = sext i32 %283 to i64
  %285 = call i64 @llvm.expect.i64(i64 %284, i64 0)
  %286 = icmp ne i64 %285, 0
  br i1 %286, label %287, label %289

287:                                              ; preds = %277
  %288 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 405, ptr noundef @.str.14, ptr noundef @.str.18, ptr noundef %288)
  br label %289

289:                                              ; preds = %287, %277
  br label %290

290:                                              ; preds = %289
  br label %291

291:                                              ; preds = %290
  store i32 -30779, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

292:                                              ; preds = %268
  %293 = load ptr, ptr %5, align 8, !tbaa !5
  %294 = load ptr, ptr %4, align 8, !tbaa !5
  call void @latency_gcprof(ptr noundef %293, ptr noundef %294)
  %295 = load ptr, ptr %4, align 8, !tbaa !5
  %296 = load ptr, ptr %5, align 8, !tbaa !5
  %297 = icmp ne ptr %296, null
  br i1 %297, label %298, label %299

298:                                              ; preds = %292
  br label %300

299:                                              ; preds = %292
  br label %300

300:                                              ; preds = %299, %298
  %301 = phi ptr [ %6, %298 ], [ null, %299 ]
  %302 = call i32 @txn_nested_join(ptr noundef %295, ptr noundef %301)
  store i32 %302, ptr %7, align 4, !tbaa !9
  br label %342

303:                                              ; preds = %247
  %304 = load ptr, ptr %4, align 8, !tbaa !5
  %305 = load ptr, ptr %5, align 8, !tbaa !5
  %306 = icmp ne ptr %305, null
  br i1 %306, label %307, label %308

307:                                              ; preds = %303
  br label %309

308:                                              ; preds = %303
  br label %309

309:                                              ; preds = %308, %307
  %310 = phi ptr [ %6, %307 ], [ null, %308 ]
  %311 = call i32 @txn_basal_commit(ptr noundef %304, ptr noundef %310)
  store i32 %311, ptr %7, align 4, !tbaa !9
  %312 = load ptr, ptr %5, align 8, !tbaa !5
  %313 = load ptr, ptr %4, align 8, !tbaa !5
  call void @latency_gcprof(ptr noundef %312, ptr noundef %313)
  store i32 16, ptr %11, align 4, !tbaa !9
  %314 = load i32, ptr %7, align 4, !tbaa !9
  %315 = icmp ne i32 %314, 0
  %316 = xor i1 %315, true
  %317 = xor i1 %316, true
  %318 = zext i1 %317 to i32
  %319 = sext i32 %318 to i64
  %320 = call i64 @llvm.expect.i64(i64 %319, i64 0)
  %321 = icmp ne i64 %320, 0
  br i1 %321, label %322, label %327

322:                                              ; preds = %309
  store i32 2, ptr %11, align 4, !tbaa !9
  %323 = load i32, ptr %7, align 4, !tbaa !9
  %324 = icmp eq i32 %323, -1
  br i1 %324, label %325, label %326

325:                                              ; preds = %322
  store i32 17, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %326

326:                                              ; preds = %325, %322
  br label %327

327:                                              ; preds = %326, %309
  %328 = load ptr, ptr %4, align 8, !tbaa !5
  %329 = load i32, ptr %11, align 4, !tbaa !9
  %330 = call i32 @txn_end(ptr noundef %328, i32 noundef %329)
  store i32 %330, ptr %12, align 4, !tbaa !9
  %331 = load i32, ptr %12, align 4, !tbaa !9
  %332 = icmp ne i32 %331, 0
  %333 = xor i1 %332, true
  %334 = xor i1 %333, true
  %335 = zext i1 %334 to i32
  %336 = sext i32 %335 to i64
  %337 = call i64 @llvm.expect.i64(i64 %336, i64 0)
  %338 = icmp ne i64 %337, 0
  br i1 %338, label %339, label %341

339:                                              ; preds = %327
  %340 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %340, ptr %7, align 4, !tbaa !9
  br label %341

341:                                              ; preds = %339, %327
  br label %342

342:                                              ; preds = %341, %300, %164, %93
  %343 = load ptr, ptr %5, align 8, !tbaa !5
  call void @latency_done(ptr noundef %343, ptr noundef %6)
  %344 = load i32, ptr %7, align 4, !tbaa !9
  %345 = call i32 @log_if_error(i32 noundef %344, ptr noundef @__func__.mdbx_txn_commit_ex, i32 noundef 430)
  store i32 %345, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %346

346:                                              ; preds = %342, %291, %246, %129, %92, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %6) #7
  %347 = load i32, ptr %3, align 4
  ret i32 %347
}

; Function Attrs: nounwind uwtable
declare hidden void @latency_init(ptr noundef, ptr noundef) #6

; Function Attrs: nounwind uwtable
declare hidden void @latency_gcprof(ptr noundef, ptr noundef) #6

declare i32 @txn_nested_join(ptr noundef, ptr noundef) #5

declare i32 @txn_basal_commit(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden void @latency_done(ptr noundef, ptr noundef) #6

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 = { 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !16, i64 128, !6, i64 160, !7, i64 168}
!13 = !{!"long", !7, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!12, !6, i64 80}
!18 = !{!12, !6, i64 24}
!19 = !{!20, !6, i64 384}
!20 = !{!"MDBX_env", !7, i64 0, !10, i64 4, !10, i64 8, !21, i64 16, !10, i64 56, !10, i64 60, !21, i64 64, !6, i64 104, !15, i64 112, !15, i64 114, !15, i64 116, !15, i64 118, !15, i64 120, !15, i64 122, !7, i64 124, !7, i64 128, !7, i64 129, !15, i64 130, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !22, i64 152, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !13, i64 256, !23, i64 264, !26, i64 320, !24, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !27, i64 392, !7, i64 400, !10, i64 440, !10, i64 444, !6, i64 448, !28, i64 456, !7, i64 496, !7, i64 536}
!21 = !{!"osal_mmap", !7, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!22 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !13, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !10, i64 28, !10, i64 32, !24, i64 36, !24, i64 37, !24, i64 38, !25, i64 40, !7, i64 48}
!24 = !{!"_Bool", !7, i64 0}
!25 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6}
!26 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!27 = !{!"", !13, i64 0}
!28 = !{!"osal_ioring", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!29 = !{!20, !6, i64 192}
!30 = !{!31, !7, i64 26}
!31 = !{!"libmdbx_globals", !7, i64 0, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !24, i64 27, !10, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!32 = !{!12, !13, i64 16}
!33 = !{!12, !6, i64 32}
!34 = !{!31, !7, i64 25}


; 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.12 }
%struct.anon.12 = 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.commit_timestamp = type { i64, i64, i64, i64, i64, i64, i64 }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@__func__.mdbx_txn_commit_ex = external hidden unnamed_addr constant [19 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 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

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

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

declare i32 @txn_end(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @osal_thread_self() local_unnamed_addr #2

declare i32 @txn_abort(ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_commit_ex(ptr noundef %0, ptr noundef %1) local_unnamed_addr #5 {
  %3 = alloca %struct.commit_timestamp, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #6
  call void @latency_init(ptr noundef %1, ptr noundef nonnull %3)
  %4 = call i32 @check_txn(ptr noundef %0, i32 noundef 1)
  switch i32 %4, label %10 [
    i32 0, label %12
    i32 -30782, label %5
  ], !prof !5

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !6
  %8 = and i32 %7, 131073
  %9 = icmp eq i32 %8, 131073
  br i1 %9, label %52, label %10

10:                                               ; preds = %2, %5
  %11 = call i32 @log_if_error(i32 noundef %4, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 352)
  br label %94

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 80
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !6
  %17 = and i32 %16, 131072
  %.not76 = icmp eq i32 %17, 0
  br i1 %.not76, label %36, label %18

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  %.not93 = icmp eq ptr %20, null
  %21 = and i32 %16, 16
  %.not94 = icmp eq i32 %21, 0
  %or.cond = and i1 %.not94, %.not93
  br i1 %or.cond, label %22, label %.critedge, !prof !18

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %14, i64 384
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = icmp eq ptr %24, %0
  br i1 %25, label %.critedge, label %26, !prof !29

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %14, i64 192
  %28 = load ptr, ptr %27, align 8, !tbaa !30
  %29 = icmp eq ptr %28, %0
  br i1 %29, label %.critedge, label %32, !prof !29

.critedge:                                        ; preds = %22, %18, %26
  %30 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !31
  %.not96 = icmp eq i8 %30, 0
  br i1 %.not96, label %94, label %31, !prof !33

31:                                               ; preds = %.critedge
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 364, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15, ptr noundef nonnull %0) #6
  br label %94

32:                                               ; preds = %26
  call void @latency_gcprof(ptr noundef %1, ptr noundef nonnull %0)
  %33 = load i32, ptr %15, align 4, !tbaa !6
  %34 = shl i32 %33, 30
  %sext = ashr i32 %34, 31
  %35 = call i32 @txn_end(ptr noundef nonnull %0, i32 noundef 113) #6
  br label %92

36:                                               ; preds = %12
  %37 = and i32 %16, 2097152
  %.not77 = icmp eq i32 %37, 0
  br i1 %.not77, label %49, label %38

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %14, i64 192
  %40 = load ptr, ptr %39, align 8, !tbaa !30
  %41 = icmp eq ptr %40, %0
  br i1 %41, label %42, label %49

42:                                               ; preds = %38
  %43 = getelementptr inbounds i8, ptr %0, i64 16
  %44 = load i64, ptr %43, align 8, !tbaa !34
  %45 = call i64 @osal_thread_self()
  %.not78 = icmp eq i64 %44, %45
  %.pre = load i32, ptr %15, align 4, !tbaa !6
  br i1 %.not78, label %49, label %46, !prof !33

46:                                               ; preds = %42
  %47 = or i32 %.pre, 2
  store i32 %47, ptr %15, align 4, !tbaa !6
  %48 = call i32 @log_if_error(i32 noundef -30416, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 377)
  br label %94

49:                                               ; preds = %42, %38, %36
  %50 = phi i32 [ %.pre, %42 ], [ %16, %38 ], [ %16, %36 ]
  %51 = and i32 %50, 2
  %.not79 = icmp eq i32 %51, 0
  br i1 %.not79, label %55, label %52, !prof !33

52:                                               ; preds = %49, %5, %66
  %.063 = phi i32 [ %59, %66 ], [ -1, %5 ], [ -1, %49 ]
  call void @latency_gcprof(ptr noundef %1, ptr noundef nonnull %0)
  %53 = call i32 @txn_abort(ptr noundef nonnull %0) #6
  %.not97 = icmp eq i32 %53, 0
  br i1 %.not97, label %92, label %54, !prof !33

54:                                               ; preds = %52
  br label %92

55:                                               ; preds = %49
  %56 = getelementptr inbounds i8, ptr %0, i64 32
  %57 = load ptr, ptr %56, align 8, !tbaa !35
  %.not80 = icmp eq ptr %57, null
  br i1 %.not80, label %67, label %58

58:                                               ; preds = %55
  %59 = call i32 @mdbx_txn_commit_ex(ptr noundef nonnull %57, ptr noundef null)
  %60 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !36
  %61 = and i8 %60, 1
  %.not81 = icmp eq i8 %61, 0
  br i1 %.not81, label %66, label %62, !prof !29

62:                                               ; preds = %58
  %63 = load ptr, ptr %56, align 8, !tbaa !35
  %.not82 = icmp eq ptr %63, null
  br i1 %.not82, label %66, label %64, !prof !33

64:                                               ; preds = %62
  %65 = load ptr, ptr %13, align 8, !tbaa !16
  call void @mdbx_assert_fail(ptr noundef %65, ptr noundef nonnull @.str.16, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 393) #7
  unreachable

66:                                               ; preds = %62, %58
  %.not83 = icmp eq i32 %59, 0
  br i1 %.not83, label %67, label %52, !prof !33

67:                                               ; preds = %66, %55
  %68 = getelementptr inbounds i8, ptr %14, i64 384
  %69 = load ptr, ptr %68, align 8, !tbaa !19
  %.not84 = icmp eq ptr %69, %0
  br i1 %.not84, label %73, label %70, !prof !33

70:                                               ; preds = %67
  %71 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !31
  %.not92 = icmp eq i8 %71, 0
  br i1 %.not92, label %94, label %72, !prof !33

72:                                               ; preds = %70
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 399, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.17, ptr noundef nonnull %0) #6
  br label %94

73:                                               ; preds = %67
  %74 = getelementptr inbounds i8, ptr %0, i64 24
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %.not85 = icmp eq ptr %75, null
  br i1 %.not85, label %86, label %76

76:                                               ; preds = %73
  %77 = getelementptr inbounds i8, ptr %75, i64 32
  %78 = load ptr, ptr %77, align 8, !tbaa !35
  %.not89 = icmp eq ptr %78, %0
  br i1 %.not89, label %79, label %.critedge99, !prof !33

79:                                               ; preds = %76
  %80 = getelementptr inbounds i8, ptr %75, i64 80
  %81 = load ptr, ptr %80, align 8, !tbaa !16
  %.not = icmp eq ptr %81, %14
  br i1 %.not, label %84, label %.critedge99, !prof !33

.critedge99:                                      ; preds = %76, %79
  %82 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 26), align 2, !tbaa !31
  %.not91 = icmp eq i8 %82, 0
  br i1 %.not91, label %94, label %83, !prof !33

83:                                               ; preds = %.critedge99
  call void (i32, ptr, i32, ptr, ...) @debug_log(i32 noundef 1, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 405, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.18, ptr noundef nonnull %0) #6
  br label %94

84:                                               ; preds = %79
  call void @latency_gcprof(ptr noundef %1, ptr noundef nonnull %0)
  %.not90 = icmp eq ptr %1, null
  %. = select i1 %.not90, ptr null, ptr %3
  %85 = call i32 @txn_nested_join(ptr noundef nonnull %0, ptr noundef %.) #6
  br label %92

86:                                               ; preds = %73
  %.not86 = icmp eq ptr %1, null
  %.1 = select i1 %.not86, ptr null, ptr %3
  %87 = call i32 @txn_basal_commit(ptr noundef nonnull %0, ptr noundef %.1) #6
  call void @latency_gcprof(ptr noundef %1, ptr noundef nonnull %0)
  switch i32 %87, label %.fold.split [
    i32 0, label %89
    i32 -1, label %88
  ], !prof !5

88:                                               ; preds = %86
  br label %89

.fold.split:                                      ; preds = %86
  br label %89

89:                                               ; preds = %86, %.fold.split, %88
  %.164 = phi i32 [ 0, %88 ], [ %87, %86 ], [ %87, %.fold.split ]
  %.062 = phi i32 [ 17, %88 ], [ 16, %86 ], [ 2, %.fold.split ]
  %90 = call i32 @txn_end(ptr noundef nonnull %0, i32 noundef %.062) #6
  %.not88 = icmp eq i32 %90, 0
  br i1 %.not88, label %92, label %91, !prof !33

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %89, %91, %52, %54, %84, %32
  %.2 = phi i32 [ %53, %54 ], [ %.063, %52 ], [ %sext, %32 ], [ %85, %84 ], [ %90, %91 ], [ %.164, %89 ]
  call void @latency_done(ptr noundef %1, ptr noundef nonnull %3)
  %93 = call i32 @log_if_error(i32 noundef %.2, ptr noundef nonnull @__func__.mdbx_txn_commit_ex, i32 noundef 430)
  br label %94

94:                                               ; preds = %.critedge99, %83, %70, %72, %.critedge, %31, %92, %46, %10
  %.0 = phi i32 [ %93, %92 ], [ %11, %10 ], [ %48, %46 ], [ -30779, %31 ], [ -30779, %.critedge ], [ 22, %72 ], [ 22, %70 ], [ -30779, %83 ], [ -30779, %.critedge99 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #6
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @latency_init(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden void @latency_gcprof(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @txn_nested_join(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @txn_basal_commit(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @latency_done(ptr noundef, ptr noundef) local_unnamed_addr #5

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 = { 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 #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 = { nounwind }
attributes #7 = { 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", i32 1, i32 4000, i32 1}
!6 = !{!7, !8, i64 4}
!7 = !{!"MDBX_txn", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !11, i64 64, !11, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !15, i64 128, !12, i64 160, !9, i64 168}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"geo", !14, i64 0, !14, i64 2, !8, i64 4, !8, i64 8, !9, i64 12, !9, i64 16}
!14 = !{!"short", !9, i64 0}
!15 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!16 = !{!7, !12, i64 80}
!17 = !{!7, !12, i64 24}
!18 = !{!"branch_weights", i32 4000000, i32 4001}
!19 = !{!20, !12, i64 384}
!20 = !{!"MDBX_env", !9, i64 0, !8, i64 4, !8, i64 8, !21, i64 16, !8, i64 56, !8, i64 60, !21, i64 64, !12, i64 104, !14, i64 112, !14, i64 114, !14, i64 116, !14, i64 118, !14, i64 120, !14, i64 122, !9, i64 124, !9, i64 128, !9, i64 129, !14, i64 130, !8, i64 132, !8, i64 136, !8, i64 140, !8, i64 144, !22, i64 152, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !8, i64 224, !8, i64 228, !8, i64 232, !12, i64 240, !12, i64 248, !11, i64 256, !23, i64 264, !26, i64 320, !24, i64 360, !12, i64 368, !12, i64 376, !12, i64 384, !27, i64 392, !9, i64 400, !8, i64 440, !8, i64 444, !12, i64 448, !28, i64 456, !9, i64 496, !9, i64 536}
!21 = !{!"osal_mmap", !9, i64 0, !8, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!22 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!23 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !11, i64 16, !9, i64 24, !9, i64 25, !9, i64 26, !9, i64 27, !8, i64 28, !8, i64 32, !24, i64 36, !24, i64 37, !24, i64 38, !25, i64 40, !9, i64 48}
!24 = !{!"_Bool", !9, i64 0}
!25 = !{!"", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6}
!26 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!27 = !{!"", !11, i64 0}
!28 = !{!"osal_ioring", !8, i64 0, !8, i64 4, !8, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!29 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!30 = !{!20, !12, i64 192}
!31 = !{!32, !9, i64 26}
!32 = !{!"libmdbx_globals", !9, i64 0, !8, i64 16, !8, i64 20, !9, i64 24, !9, i64 25, !9, i64 26, !24, i64 27, !8, i64 28, !9, i64 32, !9, i64 40, !11, i64 80, !12, i64 88}
!33 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!34 = !{!7, !11, i64 16}
!35 = !{!7, !12, i64 32}
!36 = !{!32, !9, i64 25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass