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

; 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.14 }
%struct.anon.14 = 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_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 }

@globals = external global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@__func__.txn_nested_abort = external hidden unnamed_addr constant [17 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 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

declare i32 @audit_ex(ptr noundef, i64 noundef, i1 noundef zeroext) #2

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

declare zeroext i1 @dpl_check(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @txn_nested_abort(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.MDBX_txn, ptr %5, i32 0, i32 4
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %7, ptr %3, align 8, !tbaa !5
  br label %8

8:                                                ; preds = %1
  %9 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %10 = zext i8 %9 to i32
  %11 = and i32 %10, 1
  %12 = icmp ne i32 %11, 0
  %13 = xor i1 %12, true
  %14 = xor i1 %13, true
  %15 = zext i1 %14 to i32
  %16 = sext i32 %15 to i64
  %17 = call i64 @llvm.expect.i64(i64 %16, i64 1)
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %41

19:                                               ; preds = %8
  br label %20

20:                                               ; preds = %19
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.MDBX_txn, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !19
  %24 = and i32 %23, 256
  %25 = icmp ne i32 %24, 0
  %26 = xor i1 %25, true
  %27 = xor i1 %26, true
  %28 = xor i1 %27, true
  %29 = xor i1 %28, true
  %30 = zext i1 %29 to i32
  %31 = sext i32 %30 to i64
  %32 = call i64 @llvm.expect.i64(i64 %31, i64 0)
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %38

34:                                               ; preds = %20
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.MDBX_txn, ptr %35, i32 0, i32 9
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  call void @mdbx_assert_fail(ptr noundef %37, ptr noundef @.str.9, ptr noundef @__func__.txn_nested_abort, i32 noundef 442) #7
  unreachable

38:                                               ; preds = %20
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40, %8
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MDBX_txn, ptr %44, i32 0, i32 0
  store i32 0, ptr %45, align 8, !tbaa !21
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.MDBX_txn, ptr %46, i32 0, i32 3
  store i64 0, ptr %47, align 8, !tbaa !22
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.MDBX_txn, ptr %48, i32 0, i32 17
  %50 = getelementptr inbounds %struct.anon.2, ptr %49, i32 0, i32 2
  %51 = getelementptr inbounds %struct.anon.3, ptr %50, i32 0, i32 0
  call void @rkl_destroy(ptr noundef %51)
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MDBX_txn, ptr %52, i32 0, i32 17
  %54 = getelementptr inbounds %struct.anon.2, ptr %53, i32 0, i32 8
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %152

57:                                               ; preds = %43
  br label %58

58:                                               ; preds = %57
  %59 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %60 = zext i8 %59 to i32
  %61 = and i32 %60, 1
  %62 = icmp ne i32 %61, 0
  %63 = xor i1 %62, true
  %64 = xor i1 %63, true
  %65 = zext i1 %64 to i32
  %66 = sext i32 %65 to i64
  %67 = call i64 @llvm.expect.i64(i64 %66, i64 1)
  %68 = icmp ne i64 %67, 0
  br i1 %68, label %69, label %98

69:                                               ; preds = %58
  br label %70

70:                                               ; preds = %69
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.MDBX_txn, ptr %71, i32 0, i32 17
  %73 = getelementptr inbounds %struct.anon.2, ptr %72, i32 0, i32 8
  %74 = load ptr, ptr %73, align 8, !tbaa !23
  %75 = getelementptr inbounds i32, ptr %74, i64 0
  %76 = load i32, ptr %75, align 4, !tbaa !24
  %77 = zext i32 %76 to i64
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.MDBX_txn, ptr %78, i32 0, i32 17
  %80 = getelementptr inbounds %struct.anon.2, ptr %79, i32 0, i32 8
  %81 = load ptr, ptr %80, align 8, !tbaa !23
  %82 = ptrtoint ptr %81 to i64
  %83 = icmp uge i64 %77, %82
  %84 = xor i1 %83, true
  %85 = xor i1 %84, true
  %86 = xor i1 %85, true
  %87 = zext i1 %86 to i32
  %88 = sext i32 %87 to i64
  %89 = call i64 @llvm.expect.i64(i64 %88, i64 0)
  %90 = icmp ne i64 %89, 0
  br i1 %90, label %91, label %95

91:                                               ; preds = %70
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.MDBX_txn, ptr %92, i32 0, i32 9
  %94 = load ptr, ptr %93, align 8, !tbaa !20
  call void @mdbx_assert_fail(ptr noundef %94, ptr noundef @.str.10, ptr noundef @__func__.txn_nested_abort, i32 noundef 449) #7
  unreachable

95:                                               ; preds = %70
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97, %58
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.MDBX_txn, ptr %102, i32 0, i32 17
  %104 = getelementptr inbounds %struct.anon.2, ptr %103, i32 0, i32 8
  %105 = load ptr, ptr %104, align 8, !tbaa !23
  %106 = ptrtoint ptr %105 to i64
  store i64 %106, ptr %4, align 8, !tbaa !25
  br label %107

107:                                              ; preds = %101
  %108 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %109 = zext i8 %108 to i32
  %110 = and i32 %109, 1
  %111 = icmp ne i32 %110, 0
  %112 = xor i1 %111, true
  %113 = xor i1 %112, true
  %114 = zext i1 %113 to i32
  %115 = sext i32 %114 to i64
  %116 = call i64 @llvm.expect.i64(i64 %115, i64 1)
  %117 = icmp ne i64 %116, 0
  br i1 %117, label %118, label %133

118:                                              ; preds = %107
  br label %119

119:                                              ; preds = %118
  %120 = load i64, ptr %4, align 8, !tbaa !25
  %121 = icmp ult i64 %120, 2147483647
  %122 = xor i1 %121, true
  %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 %130

129:                                              ; preds = %119
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.11, ptr noundef @__func__.txn_nested_abort, i32 noundef 450) #7
  unreachable

130:                                              ; preds = %119
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132, %107
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = load i64, ptr %4, align 8, !tbaa !25
  %137 = trunc i64 %136 to i32
  %138 = load ptr, ptr %2, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.MDBX_txn, ptr %138, i32 0, i32 17
  %140 = getelementptr inbounds %struct.anon.2, ptr %139, i32 0, i32 8
  %141 = load ptr, ptr %140, align 8, !tbaa !23
  %142 = getelementptr inbounds i32, ptr %141, i64 0
  store i32 %137, ptr %142, align 4, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %143

143:                                              ; preds = %135
  br label %144

144:                                              ; preds = %143
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.MDBX_txn, ptr %145, i32 0, i32 17
  %147 = getelementptr inbounds %struct.anon.2, ptr %146, i32 0, i32 8
  %148 = load ptr, ptr %147, align 8, !tbaa !23
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.MDBX_txn, ptr %149, i32 0, i32 17
  %151 = getelementptr inbounds %struct.anon.2, ptr %150, i32 0, i32 8
  store ptr %148, ptr %151, align 8, !tbaa !23
  br label %152

152:                                              ; preds = %144, %43
  br label %153

153:                                              ; preds = %152
  %154 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %155 = zext i8 %154 to i32
  %156 = and i32 %155, 1
  %157 = icmp ne i32 %156, 0
  %158 = xor i1 %157, true
  %159 = xor i1 %158, true
  %160 = zext i1 %159 to i32
  %161 = sext i32 %160 to i64
  %162 = call i64 @llvm.expect.i64(i64 %161, i64 1)
  %163 = icmp ne i64 %162, 0
  br i1 %163, label %164, label %182

164:                                              ; preds = %153
  br label %165

165:                                              ; preds = %164
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = call zeroext i1 @dpl_check(ptr noundef %166)
  %168 = xor i1 %167, true
  %169 = xor i1 %168, true
  %170 = xor i1 %169, true
  %171 = zext i1 %170 to i32
  %172 = sext i32 %171 to i64
  %173 = call i64 @llvm.expect.i64(i64 %172, i64 0)
  %174 = icmp ne i64 %173, 0
  br i1 %174, label %175, label %179

175:                                              ; preds = %165
  %176 = load ptr, ptr %3, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.MDBX_txn, ptr %176, i32 0, i32 9
  %178 = load ptr, ptr %177, align 8, !tbaa !20
  call void @mdbx_assert_fail(ptr noundef %178, ptr noundef @.str.1, ptr noundef @__func__.txn_nested_abort, i32 noundef 454) #7
  unreachable

179:                                              ; preds = %165
  br label %180

180:                                              ; preds = %179
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181, %153
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  %186 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %187 = zext i8 %186 to i32
  %188 = and i32 %187, 1
  %189 = icmp ne i32 %188, 0
  %190 = xor i1 %189, true
  %191 = xor i1 %190, true
  %192 = zext i1 %191 to i32
  %193 = sext i32 %192 to i64
  %194 = call i64 @llvm.expect.i64(i64 %193, i64 1)
  %195 = icmp ne i64 %194, 0
  br i1 %195, label %196, label %215

196:                                              ; preds = %185
  br label %197

197:                                              ; preds = %196
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = call i32 @audit_ex(ptr noundef %198, i64 noundef 0, i1 noundef zeroext false)
  %200 = icmp eq i32 %199, 0
  %201 = xor i1 %200, true
  %202 = xor i1 %201, true
  %203 = xor i1 %202, true
  %204 = zext i1 %203 to i32
  %205 = sext i32 %204 to i64
  %206 = call i64 @llvm.expect.i64(i64 %205, i64 0)
  %207 = icmp ne i64 %206, 0
  br i1 %207, label %208, label %212

208:                                              ; preds = %197
  %209 = load ptr, ptr %3, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.MDBX_txn, ptr %209, i32 0, i32 9
  %211 = load ptr, ptr %210, align 8, !tbaa !20
  call void @mdbx_assert_fail(ptr noundef %211, ptr noundef @.str, ptr noundef @__func__.txn_nested_abort, i32 noundef 455) #7
  unreachable

212:                                              ; preds = %197
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  br label %215

215:                                              ; preds = %214, %185
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr %2, align 8, !tbaa !5
  call void @dpl_release_shadows(ptr noundef %218)
  %219 = load ptr, ptr %2, align 8, !tbaa !5
  call void @dpl_free(ptr noundef %219)
  %220 = load ptr, ptr %2, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.MDBX_txn, ptr %220, i32 0, i32 17
  %222 = getelementptr inbounds %struct.anon.2, ptr %221, i32 0, i32 1
  %223 = load ptr, ptr %222, align 8, !tbaa !23
  call void @pnl_free(ptr noundef %223)
  %224 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %224) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret void
}

declare void @rkl_destroy(ptr noundef) #2

declare void @dpl_release_shadows(ptr noundef) #2

declare void @dpl_free(ptr noundef) #2

declare void @pnl_free(ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

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

!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, !6, i64 24}
!10 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !12, i64 64, !12, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !15, i64 128, !6, i64 160, !7, i64 168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"geo", !14, i64 0, !14, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!14 = !{!"short", !7, i64 0}
!15 = !{!"MDBX_canary", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!16 = !{!17, !7, i64 25}
!17 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !18, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !12, i64 80, !6, i64 88}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!10, !11, i64 4}
!20 = !{!10, !6, i64 80}
!21 = !{!10, !11, i64 0}
!22 = !{!10, !12, i64 16}
!23 = !{!7, !7, i64 0}
!24 = !{!11, !11, i64 0}
!25 = !{!12, !12, i64 0}


; 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.14 }
%struct.anon.14 = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@__func__.txn_nested_abort = external hidden unnamed_addr constant [17 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1

declare i32 @audit_ex(ptr noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #0

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

declare zeroext i1 @dpl_check(ptr noundef) local_unnamed_addr #0

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

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !19
  %9 = and i32 %8, 256
  %.not23 = icmp eq i32 %9, 0
  br i1 %.not23, label %13, label %10, !prof !20

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load ptr, ptr %11, align 8, !tbaa !21
  tail call void @mdbx_assert_fail(ptr noundef %12, ptr noundef nonnull @.str.9, ptr noundef nonnull @__func__.txn_nested_abort, i32 noundef 442) #4
  unreachable

13:                                               ; preds = %6, %1
  store i32 0, ptr %0, align 8, !tbaa !22
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %14, align 8, !tbaa !23
  %15 = getelementptr inbounds i8, ptr %0, i64 208
  tail call void @rkl_destroy(ptr noundef nonnull %15) #5
  %16 = getelementptr inbounds i8, ptr %0, i64 504
  %17 = load ptr, ptr %16, align 8, !tbaa !24
  %.not24 = icmp eq ptr %17, null
  %.pre = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %.pre39 = and i8 %.pre, 1
  br i1 %.not24, label %._crit_edge38, label %18

18:                                               ; preds = %13
  %.not25 = icmp eq i8 %.pre39, 0
  br i1 %.not25, label %.thread, label %21, !prof !18

.thread:                                          ; preds = %18
  %19 = getelementptr inbounds i8, ptr %3, i64 504
  %20 = load ptr, ptr %19, align 8, !tbaa !24
  %.pre36 = ptrtoint ptr %20 to i64
  br label %32

21:                                               ; preds = %18
  %22 = load i32, ptr %17, align 4, !tbaa !25
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %3, i64 504
  %25 = load ptr, ptr %24, align 8, !tbaa !24
  %26 = ptrtoint ptr %25 to i64
  %.not26 = icmp ult i64 %23, %26
  br i1 %.not26, label %27, label %30, !prof !18

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %3, i64 80
  %29 = load ptr, ptr %28, align 8, !tbaa !21
  tail call void @mdbx_assert_fail(ptr noundef %29, ptr noundef nonnull @.str.10, ptr noundef nonnull @__func__.txn_nested_abort, i32 noundef 449) #4
  unreachable

30:                                               ; preds = %21
  %.not28 = icmp ult ptr %25, inttoptr (i64 2147483647 to ptr)
  br i1 %.not28, label %32, label %31, !prof !26

31:                                               ; preds = %30
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.11, ptr noundef nonnull @__func__.txn_nested_abort, i32 noundef 450) #4
  unreachable

32:                                               ; preds = %.thread, %30
  %.pre-phi37 = phi i64 [ %.pre36, %.thread ], [ %26, %30 ]
  %33 = phi ptr [ %19, %.thread ], [ %24, %30 ]
  %34 = trunc i64 %.pre-phi37 to i32
  store i32 %34, ptr %17, align 4, !tbaa !25
  %35 = load ptr, ptr %16, align 8, !tbaa !24
  store ptr %35, ptr %33, align 8, !tbaa !24
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %13, %32
  %.not29 = icmp eq i8 %.pre39, 0
  br i1 %.not29, label %.thread41, label %36, !prof !18

36:                                               ; preds = %._crit_edge38
  %37 = tail call zeroext i1 @dpl_check(ptr noundef %3) #5
  br i1 %37, label %41, label %38, !prof !20

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %3, i64 80
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  tail call void @mdbx_assert_fail(ptr noundef %40, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.txn_nested_abort, i32 noundef 454) #4
  unreachable

41:                                               ; preds = %36
  %.pre34 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %.pre35 = and i8 %.pre34, 1
  %42 = icmp eq i8 %.pre35, 0
  br i1 %42, label %.thread41, label %43, !prof !27

43:                                               ; preds = %41
  %44 = tail call i32 @audit_ex(ptr noundef %3, i64 noundef 0, i1 noundef zeroext false) #5
  %.not31 = icmp eq i32 %44, 0
  br i1 %.not31, label %.thread41, label %45, !prof !20

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %3, i64 80
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  tail call void @mdbx_assert_fail(ptr noundef %47, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.txn_nested_abort, i32 noundef 455) #4
  unreachable

.thread41:                                        ; preds = %._crit_edge38, %43, %41
  tail call void @dpl_release_shadows(ptr noundef nonnull %0) #5
  tail call void @dpl_free(ptr noundef nonnull %0) #5
  %48 = getelementptr inbounds i8, ptr %0, i64 200
  %49 = load ptr, ptr %48, align 8, !tbaa !24
  tail call void @pnl_free(ptr noundef %49) #5
  tail call void @free(ptr noundef nonnull %0) #5
  ret void
}

declare void @rkl_destroy(ptr noundef) local_unnamed_addr #0

declare void @dpl_release_shadows(ptr noundef) local_unnamed_addr #0

declare void @dpl_free(ptr noundef) local_unnamed_addr #0

declare void @pnl_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

attributes #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 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 24}
!6 = !{!"MDBX_txn", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !11, i64 24, !11, i64 32, !12, i64 40, !10, i64 64, !10, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !14, i64 128, !11, i64 160, !8, i64 168}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"geo", !13, i64 0, !13, i64 2, !7, i64 4, !7, i64 8, !8, i64 12, !8, i64 16}
!13 = !{!"short", !8, i64 0}
!14 = !{!"MDBX_canary", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!16, !8, i64 25}
!16 = !{!"libmdbx_globals", !8, i64 0, !7, i64 16, !7, i64 20, !8, i64 24, !8, i64 25, !8, i64 26, !17, i64 27, !7, i64 28, !8, i64 32, !8, i64 40, !10, i64 80, !11, i64 88}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!19 = !{!6, !7, i64 4}
!20 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!21 = !{!6, !11, i64 80}
!22 = !{!6, !7, i64 0}
!23 = !{!6, !10, i64 16}
!24 = !{!8, !8, i64 0}
!25 = !{!7, !7, i64 0}
!26 = !{!"branch_weights", i32 2146410443, i32 1073205}
!27 = !{!"branch_weights", !"expected", i32 0, i32 -2147483648}


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