; LLVM IR from erthink/libmdbx :: src (spill)

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

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

@globals = external global %struct.libmdbx_globals, align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@__func__.spill_purge = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @spill_purge(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %10

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

21:                                               ; preds = %10
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MDBX_txn, ptr %23, i32 0, i32 17
  %25 = getelementptr inbounds %struct.anon.4, ptr %24, i32 0, i32 11
  %26 = getelementptr inbounds %struct.anon.7, ptr %25, i32 0, i32 0
  %27 = load i64, ptr %26, align 8, !tbaa !14
  %28 = icmp ugt i64 %27, 0
  %29 = xor i1 %28, true
  %30 = xor i1 %29, true
  %31 = xor i1 %30, true
  %32 = zext i1 %31 to i32
  %33 = sext i32 %32 to i64
  %34 = call i64 @llvm.expect.i64(i64 %33, i64 0)
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %22
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.MDBX_txn, ptr %37, i32 0, i32 9
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  call void @mdbx_assert_fail(ptr noundef %39, ptr noundef @.str.2, ptr noundef @__func__.spill_purge, i32 noundef 31) #4
  unreachable

40:                                               ; preds = %22
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41, %10
  br label %43

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MDBX_txn, ptr %44, i32 0, i32 17
  %46 = getelementptr inbounds %struct.anon.4, ptr %45, i32 0, i32 11
  %47 = getelementptr inbounds %struct.anon.7, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  store ptr %48, ptr %3, align 8, !tbaa !5
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MDBX_txn, ptr %49, i32 0, i32 17
  %51 = getelementptr inbounds %struct.anon.4, ptr %50, i32 0, i32 11
  %52 = getelementptr inbounds %struct.anon.7, ptr %51, i32 0, i32 0
  %53 = load i64, ptr %52, align 8, !tbaa !14
  %54 = icmp ne i64 %53, 2147483647
  br i1 %54, label %55, label %178

55:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds i32, ptr %56, i64 0
  %58 = load i32, ptr %57, align 4, !tbaa !20
  %59 = zext i32 %58 to i64
  store i64 %59, ptr %4, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.MDBX_txn, ptr %60, i32 0, i32 17
  %62 = getelementptr inbounds %struct.anon.4, ptr %61, i32 0, i32 11
  %63 = getelementptr inbounds %struct.anon.7, ptr %62, i32 0, i32 0
  %64 = load i64, ptr %63, align 8, !tbaa !14
  store i64 %64, ptr %5, align 8, !tbaa !21
  store i64 %64, ptr %6, align 8, !tbaa !21
  br label %65

65:                                               ; preds = %86, %55
  %66 = load i64, ptr %5, align 8, !tbaa !21
  %67 = load i64, ptr %4, align 8, !tbaa !21
  %68 = icmp ule i64 %66, %67
  br i1 %68, label %69, label %89

69:                                               ; preds = %65
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = load i64, ptr %5, align 8, !tbaa !21
  %72 = getelementptr inbounds i32, ptr %70, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !20
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = load i64, ptr %6, align 8, !tbaa !21
  %76 = getelementptr inbounds i32, ptr %74, i64 %75
  store i32 %73, ptr %76, align 4, !tbaa !20
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = load i64, ptr %5, align 8, !tbaa !21
  %79 = getelementptr inbounds i32, ptr %77, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !20
  %81 = and i32 %80, 1
  %82 = sub i32 1, %81
  %83 = zext i32 %82 to i64
  %84 = load i64, ptr %6, align 8, !tbaa !21
  %85 = add i64 %84, %83
  store i64 %85, ptr %6, align 8, !tbaa !21
  br label %86

86:                                               ; preds = %69
  %87 = load i64, ptr %5, align 8, !tbaa !21
  %88 = add i64 %87, 1
  store i64 %88, ptr %5, align 8, !tbaa !21
  br label %65, !llvm.loop !22

89:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 1, ptr %7, align 8, !tbaa !21
  br label %90

90:                                               ; preds = %132, %89
  %91 = load i64, ptr %7, align 8, !tbaa !21
  %92 = load i64, ptr %6, align 8, !tbaa !21
  %93 = icmp ult i64 %91, %92
  br i1 %93, label %95, label %94

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

95:                                               ; preds = %90
  br label %96

96:                                               ; preds = %95
  %97 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %98 = zext i8 %97 to i32
  %99 = and i32 %98, 1
  %100 = icmp ne i32 %99, 0
  %101 = xor i1 %100, true
  %102 = xor i1 %101, true
  %103 = zext i1 %102 to i32
  %104 = sext i32 %103 to i64
  %105 = call i64 @llvm.expect.i64(i64 %104, i64 1)
  %106 = icmp ne i64 %105, 0
  br i1 %106, label %107, label %129

107:                                              ; preds = %96
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = load i64, ptr %7, align 8, !tbaa !21
  %111 = getelementptr inbounds i32, ptr %109, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !20
  %113 = and i32 %112, 1
  %114 = icmp eq i32 %113, 0
  %115 = xor i1 %114, true
  %116 = xor i1 %115, true
  %117 = xor i1 %116, true
  %118 = zext i1 %117 to i32
  %119 = sext i32 %118 to i64
  %120 = call i64 @llvm.expect.i64(i64 %119, i64 0)
  %121 = icmp ne i64 %120, 0
  br i1 %121, label %122, label %126

122:                                              ; preds = %108
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MDBX_txn, ptr %123, i32 0, i32 9
  %125 = load ptr, ptr %124, align 8, !tbaa !15
  call void @mdbx_assert_fail(ptr noundef %125, ptr noundef @.str.3, ptr noundef @__func__.spill_purge, i32 noundef 40) #4
  unreachable

126:                                              ; preds = %108
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128, %96
  br label %130

130:                                              ; preds = %129
  br label %131

131:                                              ; preds = %130
  br label %132

132:                                              ; preds = %131
  %133 = load i64, ptr %7, align 8, !tbaa !21
  %134 = add i64 %133, 1
  store i64 %134, ptr %7, align 8, !tbaa !21
  br label %90, !llvm.loop !24

135:                                              ; preds = %94
  br label %136

136:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %137 = load i64, ptr %6, align 8, !tbaa !21
  %138 = sub i64 %137, 1
  store i64 %138, ptr %8, align 8, !tbaa !21
  br label %139

139:                                              ; preds = %136
  %140 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %141 = zext i8 %140 to i32
  %142 = and i32 %141, 1
  %143 = icmp ne i32 %142, 0
  %144 = xor i1 %143, true
  %145 = xor i1 %144, true
  %146 = zext i1 %145 to i32
  %147 = sext i32 %146 to i64
  %148 = call i64 @llvm.expect.i64(i64 %147, i64 1)
  %149 = icmp ne i64 %148, 0
  br i1 %149, label %150, label %165

150:                                              ; preds = %139
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %8, align 8, !tbaa !21
  %153 = icmp ult i64 %152, 2147483647
  %154 = xor i1 %153, true
  %155 = xor i1 %154, true
  %156 = xor i1 %155, true
  %157 = zext i1 %156 to i32
  %158 = sext i32 %157 to i64
  %159 = call i64 @llvm.expect.i64(i64 %158, i64 0)
  %160 = icmp ne i64 %159, 0
  br i1 %160, label %161, label %162

161:                                              ; preds = %151
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.1, ptr noundef @__func__.spill_purge, i32 noundef 41) #4
  unreachable

162:                                              ; preds = %151
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164, %139
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  %168 = load i64, ptr %8, align 8, !tbaa !21
  %169 = trunc i64 %168 to i32
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds i32, ptr %170, i64 0
  store i32 %169, ptr %171, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %172

172:                                              ; preds = %167
  br label %173

173:                                              ; preds = %172
  %174 = load ptr, ptr %2, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.MDBX_txn, ptr %174, i32 0, i32 17
  %176 = getelementptr inbounds %struct.anon.4, ptr %175, i32 0, i32 11
  %177 = getelementptr inbounds %struct.anon.7, ptr %176, i32 0, i32 0
  store i64 2147483647, ptr %177, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %228

178:                                              ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 1, ptr %9, align 8, !tbaa !21
  br label %179

179:                                              ; preds = %224, %178
  %180 = load i64, ptr %9, align 8, !tbaa !21
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds i32, ptr %181, i64 0
  %183 = load i32, ptr %182, align 4, !tbaa !20
  %184 = zext i32 %183 to i64
  %185 = icmp ule i64 %180, %184
  br i1 %185, label %187, label %186

186:                                              ; preds = %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %227

187:                                              ; preds = %179
  br label %188

188:                                              ; preds = %187
  %189 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !9
  %190 = zext i8 %189 to i32
  %191 = and i32 %190, 1
  %192 = icmp ne i32 %191, 0
  %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 1)
  %198 = icmp ne i64 %197, 0
  br i1 %198, label %199, label %221

199:                                              ; preds = %188
  br label %200

200:                                              ; preds = %199
  %201 = load ptr, ptr %3, align 8, !tbaa !5
  %202 = load i64, ptr %9, align 8, !tbaa !21
  %203 = getelementptr inbounds i32, ptr %201, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !20
  %205 = and i32 %204, 1
  %206 = icmp eq i32 %205, 0
  %207 = xor i1 %206, true
  %208 = xor i1 %207, true
  %209 = xor i1 %208, true
  %210 = zext i1 %209 to i32
  %211 = sext i32 %210 to i64
  %212 = call i64 @llvm.expect.i64(i64 %211, i64 0)
  %213 = icmp ne i64 %212, 0
  br i1 %213, label %214, label %218

214:                                              ; preds = %200
  %215 = load ptr, ptr %2, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.MDBX_txn, ptr %215, i32 0, i32 9
  %217 = load ptr, ptr %216, align 8, !tbaa !15
  call void @mdbx_assert_fail(ptr noundef %217, ptr noundef @.str.3, ptr noundef @__func__.spill_purge, i32 noundef 45) #4
  unreachable

218:                                              ; preds = %200
  br label %219

219:                                              ; preds = %218
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220, %188
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223
  %225 = load i64, ptr %9, align 8, !tbaa !21
  %226 = add i64 %225, 1
  store i64 %226, ptr %9, align 8, !tbaa !21
  br label %179, !llvm.loop !25

227:                                              ; preds = %186
  br label %228

228:                                              ; preds = %227, %173
  %229 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret ptr %229
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 25}
!10 = !{!"libmdbx_globals", !7, i64 0, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !12, i64 27, !11, i64 28, !7, i64 32, !7, i64 40, !13, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !6, i64 80}
!16 = !{!"MDBX_txn", !11, i64 0, !11, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !17, 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, !19, i64 128, !6, i64 160, !7, i64 168}
!17 = !{!"geo", !18, i64 0, !18, i64 2, !11, i64 4, !11, i64 8, !7, i64 12, !7, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!20 = !{!11, !11, i64 0}
!21 = !{!13, !13, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = distinct !{!25, !23}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%struct.anon = type { i64, i64 }
%union.logger_union = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@globals = external local_unnamed_addr global %struct.libmdbx_globals, align 8
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@__func__.spill_purge = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @spill_purge(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %3 = and i8 %2, 1
  %.not = icmp eq i8 %3, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 528
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !13
  %.not37 = icmp ne i64 %.pre, 0
  %or.cond62.not = select i1 %.not, i1 true, i1 %.not37
  br i1 %or.cond62.not, label %._crit_edge59, label %4, !prof !14

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load ptr, ptr %5, align 8, !tbaa !15
  tail call void @mdbx_assert_fail(ptr noundef %6, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.spill_purge, i32 noundef 31) #2
  unreachable

._crit_edge59:                                    ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 528
  %8 = getelementptr inbounds i8, ptr %0, i64 536
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %.not38 = icmp eq i64 %.pre, 2147483647
  %10 = load i32, ptr %9, align 4, !tbaa !20
  %11 = zext i32 %10 to i64
  br i1 %.not38, label %.preheader, label %12

.preheader:                                       ; preds = %._crit_edge59
  %.not3952 = icmp eq i32 %10, 0
  %brmerge = or i1 %.not3952, %.not
  br i1 %brmerge, label %.loopexit, label %.lr.ph54.split, !prof !21

12:                                               ; preds = %._crit_edge59
  %.not4247 = icmp ugt i64 %.pre, %11
  br i1 %.not4247, label %.preheader46, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %12
  %13 = add i64 %.pre, %11
  %14 = and i64 %13, 1
  %lcmp.mod.not.not = icmp eq i64 %14, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph.prol, label %.lr.ph.prol.loopexit

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader
  %15 = getelementptr inbounds i32, ptr %9, i64 %.pre
  %16 = load i32, ptr %15, align 4, !tbaa !20
  %17 = and i32 %16, 1
  %18 = xor i32 %17, 1
  %19 = zext nneg i32 %18 to i64
  %20 = add i64 %.pre, %19
  %21 = add nuw nsw i64 %.pre, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %.lcssa.unr = phi i64 [ poison, %.lr.ph.preheader ], [ %20, %.lr.ph.prol ]
  %.03349.unr = phi i64 [ %.pre, %.lr.ph.preheader ], [ %21, %.lr.ph.prol ]
  %.03548.unr = phi i64 [ %.pre, %.lr.ph.preheader ], [ %20, %.lr.ph.prol ]
  %22 = icmp eq i64 %.pre, %11
  br i1 %22, label %.preheader46, label %.lr.ph

.preheader46:                                     ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %12
  %.035.lcssa = phi i64 [ %.pre, %12 ], [ %.lcssa.unr, %.lr.ph.prol.loopexit ], [ %39, %.lr.ph ]
  %23 = icmp ugt i64 %.035.lcssa, 1
  br i1 %23, label %.lr.ph51, label %._crit_edge

.lr.ph51:                                         ; preds = %.preheader46
  br i1 %.not, label %._crit_edge.thread, label %.lr.ph51.split, !prof !22

._crit_edge.thread:                               ; preds = %.lr.ph51
  %24 = add i64 %.035.lcssa, -1
  br label %52

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.03349 = phi i64 [ %40, %.lr.ph ], [ %.03349.unr, %.lr.ph.prol.loopexit ]
  %.03548 = phi i64 [ %39, %.lr.ph ], [ %.03548.unr, %.lr.ph.prol.loopexit ]
  %25 = getelementptr inbounds i32, ptr %9, i64 %.03349
  %26 = load i32, ptr %25, align 4, !tbaa !20
  %27 = getelementptr inbounds i32, ptr %9, i64 %.03548
  store i32 %26, ptr %27, align 4, !tbaa !20
  %28 = and i32 %26, 1
  %29 = xor i32 %28, 1
  %30 = zext nneg i32 %29 to i64
  %31 = add i64 %.03548, %30
  %32 = add nuw nsw i64 %.03349, 1
  %33 = getelementptr inbounds i32, ptr %9, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !20
  %35 = getelementptr inbounds i32, ptr %9, i64 %31
  store i32 %34, ptr %35, align 4, !tbaa !20
  %36 = and i32 %34, 1
  %37 = xor i32 %36, 1
  %38 = zext nneg i32 %37 to i64
  %39 = add i64 %31, %38
  %40 = add nuw nsw i64 %.03349, 2
  %exitcond.1 = icmp eq i64 %32, %11
  br i1 %exitcond.1, label %.preheader46, label %.lr.ph, !llvm.loop !23

._crit_edge:                                      ; preds = %49, %.preheader46
  %41 = add i64 %.035.lcssa, -1
  %.not43 = icmp ne i8 %3, 0
  %42 = icmp ugt i64 %41, 2147483646
  %or.cond = and i1 %.not43, %42
  br i1 %or.cond, label %51, label %52, !prof !25

.lr.ph51.split:                                   ; preds = %.lr.ph51, %49
  %.03450 = phi i64 [ %50, %49 ], [ 1, %.lr.ph51 ]
  %43 = getelementptr inbounds i32, ptr %9, i64 %.03450
  %44 = load i32, ptr %43, align 4, !tbaa !20
  %45 = and i32 %44, 1
  %.not45 = icmp eq i32 %45, 0
  br i1 %.not45, label %49, label %46, !prof !26

46:                                               ; preds = %.lr.ph51.split
  %47 = getelementptr inbounds i8, ptr %0, i64 80
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  tail call void @mdbx_assert_fail(ptr noundef %48, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.spill_purge, i32 noundef 40) #2
  unreachable

49:                                               ; preds = %.lr.ph51.split
  %50 = add nuw i64 %.03450, 1
  %exitcond57.not = icmp eq i64 %50, %.035.lcssa
  br i1 %exitcond57.not, label %._crit_edge, label %.lr.ph51.split, !llvm.loop !27

51:                                               ; preds = %._crit_edge
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.spill_purge, i32 noundef 41) #2
  unreachable

52:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %53 = phi i64 [ %24, %._crit_edge.thread ], [ %41, %._crit_edge ]
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %9, align 4, !tbaa !20
  store i64 2147483647, ptr %7, align 8, !tbaa !13
  br label %.loopexit

.lr.ph54.split:                                   ; preds = %.preheader, %61
  %.053 = phi i64 [ %62, %61 ], [ 1, %.preheader ]
  %55 = getelementptr inbounds i32, ptr %9, i64 %.053
  %56 = load i32, ptr %55, align 4, !tbaa !20
  %57 = and i32 %56, 1
  %.not41 = icmp eq i32 %57, 0
  br i1 %.not41, label %61, label %58, !prof !26

58:                                               ; preds = %.lr.ph54.split
  %59 = getelementptr inbounds i8, ptr %0, i64 80
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  tail call void @mdbx_assert_fail(ptr noundef %60, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.spill_purge, i32 noundef 45) #2
  unreachable

61:                                               ; preds = %.lr.ph54.split
  %62 = add nuw nsw i64 %.053, 1
  %exitcond58.not = icmp eq i64 %.053, %11
  br i1 %exitcond58.not, label %.loopexit, label %.lr.ph54.split, !llvm.loop !28

.loopexit:                                        ; preds = %61, %.preheader, %52
  ret ptr %9
}

attributes #0 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 = !{!6, !7, i64 25}
!6 = !{!"libmdbx_globals", !7, i64 0, !9, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !9, i64 28, !7, i64 32, !7, i64 40, !11, i64 80, !12, i64 88}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!"branch_weights", i32 4002001, i32 2000}
!15 = !{!16, !12, i64 80}
!16 = !{!"MDBX_txn", !9, i64 0, !9, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !17, 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, !19, i64 128, !12, i64 160, !7, i64 168}
!17 = !{!"geo", !18, i64 0, !18, i64 2, !9, i64 4, !9, i64 8, !7, i64 12, !7, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!20 = !{!9, !9, i64 0}
!21 = !{!"branch_weights", i32 2002, i32 2000}
!22 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!"branch_weights", i32 1072939, i32 2146410709}
!26 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!27 = distinct !{!27, !24}
!28 = distinct !{!28, !24}


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