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

; 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.iovec = type { ptr, i64 }

@globals = external global %struct.libmdbx_globals, align 8
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__.mdbx_dump_val = external hidden unnamed_addr constant [14 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.mdbx_dump_val.hex = external hidden unnamed_addr constant [16 x i8], align 16

; 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: cold nounwind optsize uwtable
define dso_local ptr @mdbx_dump_val(ptr noundef %0, ptr noundef %1, i64 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca [16 x i8], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %3
  store ptr @.str.9, ptr %4, align 8
  br label %230

21:                                               ; preds = %3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.iovec, ptr %22, i32 0, i32 1
  %24 = load i64, ptr %23, align 8, !tbaa !11
  %25 = icmp ne i64 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  store ptr @.str.10, ptr %4, align 8
  br label %230

27:                                               ; preds = %21
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = icmp ult i64 %31, 4
  br i1 %32, label %33, label %34

33:                                               ; preds = %30, %27
  store ptr null, ptr %4, align 8
  br label %230

34:                                               ; preds = %30
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.iovec, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %38 = icmp ne ptr %37, null
  br i1 %38, label %84, label %39

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.iovec, ptr %42, i32 0, i32 1
  %44 = load i64, ptr %43, align 8, !tbaa !11
  %45 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %40, i64 noundef %41, ptr noundef @.str.11, i64 noundef %44) #6
  store i32 %45, ptr %8, align 4, !tbaa !14
  br label %46

46:                                               ; preds = %39
  %47 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !16
  %48 = zext i8 %47 to i32
  %49 = and i32 %48, 1
  %50 = icmp ne i32 %49, 0
  %51 = xor i1 %50, true
  %52 = xor i1 %51, true
  %53 = zext i1 %52 to i32
  %54 = sext i32 %53 to i64
  %55 = call i64 @llvm.expect.i64(i64 %54, i64 1)
  %56 = icmp ne i64 %55, 0
  br i1 %56, label %57, label %79

57:                                               ; preds = %46
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %8, align 4, !tbaa !14
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %61, label %66

61:                                               ; preds = %58
  %62 = load i32, ptr %8, align 4, !tbaa !14
  %63 = sext i32 %62 to i64
  %64 = load i64, ptr %7, align 8, !tbaa !9
  %65 = icmp ult i64 %63, %64
  br label %66

66:                                               ; preds = %61, %58
  %67 = phi i1 [ false, %58 ], [ %65, %61 ]
  %68 = xor i1 %67, true
  %69 = xor i1 %68, true
  %70 = xor i1 %69, true
  %71 = zext i1 %70 to i32
  %72 = sext i32 %71 to i64
  %73 = call i64 @llvm.expect.i64(i64 %72, i64 0)
  %74 = icmp ne i64 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %66
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.12, ptr noundef @__func__.mdbx_dump_val, i32 noundef 80) #7
  unreachable

76:                                               ; preds = %66
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78, %46
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %8, align 4, !tbaa !14
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %83, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %230

84:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  store i8 1, ptr %9, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.iovec, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !13
  store ptr %87, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %88

88:                                               ; preds = %111, %84
  %89 = load i64, ptr %11, align 8, !tbaa !9
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.iovec, ptr %90, i32 0, i32 1
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = icmp ult i64 %89, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %88
  store i32 6, ptr %12, align 4
  br label %114

95:                                               ; preds = %88
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = load i64, ptr %11, align 8, !tbaa !9
  %98 = getelementptr inbounds i8, ptr %96, i64 %97
  %99 = load i8, ptr %98, align 1, !tbaa !20
  %100 = zext i8 %99 to i32
  %101 = icmp slt i32 %100, 32
  br i1 %101, label %109, label %102

102:                                              ; preds = %95
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = load i64, ptr %11, align 8, !tbaa !9
  %105 = getelementptr inbounds i8, ptr %103, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !20
  %107 = zext i8 %106 to i32
  %108 = icmp sgt i32 %107, 126
  br i1 %108, label %109, label %110

109:                                              ; preds = %102, %95
  store i8 0, ptr %9, align 1, !tbaa !19
  store i32 6, ptr %12, align 4
  br label %114

110:                                              ; preds = %102
  br label %111

111:                                              ; preds = %110
  %112 = load i64, ptr %11, align 8, !tbaa !9
  %113 = add i64 %112, 1
  store i64 %113, ptr %11, align 8, !tbaa !9
  br label %88, !llvm.loop !21

114:                                              ; preds = %109, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %115

115:                                              ; preds = %114
  %116 = load i8, ptr %9, align 1, !tbaa !19, !range !23, !noundef !24
  %117 = trunc i8 %116 to i1
  br i1 %117, label %118, label %172

118:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = load i64, ptr %7, align 8, !tbaa !9
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.iovec, ptr %121, i32 0, i32 1
  %123 = load i64, ptr %122, align 8, !tbaa !11
  %124 = icmp ugt i64 %123, 2147483647
  br i1 %124, label %125, label %126

125:                                              ; preds = %118
  br label %131

126:                                              ; preds = %118
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.iovec, ptr %127, i32 0, i32 1
  %129 = load i64, ptr %128, align 8, !tbaa !11
  %130 = trunc i64 %129 to i32
  br label %131

131:                                              ; preds = %126, %125
  %132 = phi i32 [ 2147483647, %125 ], [ %130, %126 ]
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %119, i64 noundef %120, ptr noundef @.str.13, i32 noundef %132, ptr noundef %133) #6
  store i32 %134, ptr %13, align 4, !tbaa !14
  br label %135

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

146:                                              ; preds = %135
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %13, align 4, !tbaa !14
  %149 = icmp sgt i32 %148, 0
  br i1 %149, label %150, label %155

150:                                              ; preds = %147
  %151 = load i32, ptr %13, align 4, !tbaa !14
  %152 = sext i32 %151 to i64
  %153 = load i64, ptr %7, align 8, !tbaa !9
  %154 = icmp ult i64 %152, %153
  br label %155

155:                                              ; preds = %150, %147
  %156 = phi i1 [ false, %147 ], [ %154, %150 ]
  %157 = xor i1 %156, true
  %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 0)
  %163 = icmp ne i64 %162, 0
  br i1 %163, label %164, label %165

164:                                              ; preds = %155
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.12, ptr noundef @__func__.mdbx_dump_val, i32 noundef 95) #7
  unreachable

165:                                              ; preds = %155
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167, %135
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %13, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %228

172:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = load i64, ptr %7, align 8, !tbaa !9
  %175 = getelementptr inbounds i8, ptr %173, i64 %174
  %176 = getelementptr inbounds i8, ptr %175, i64 -2
  store ptr %176, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %177, ptr %15, align 8, !tbaa !5
  %178 = load ptr, ptr %15, align 8, !tbaa !5
  %179 = getelementptr inbounds i8, ptr %178, i32 1
  store ptr %179, ptr %15, align 8, !tbaa !5
  store i8 60, ptr %178, align 1, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %180

180:                                              ; preds = %216, %172
  %181 = load i64, ptr %16, align 8, !tbaa !9
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.iovec, ptr %182, i32 0, i32 1
  %184 = load i64, ptr %183, align 8, !tbaa !11
  %185 = icmp ult i64 %181, %184
  br i1 %185, label %186, label %190

186:                                              ; preds = %180
  %187 = load ptr, ptr %15, align 8, !tbaa !5
  %188 = load ptr, ptr %14, align 8, !tbaa !5
  %189 = icmp ult ptr %187, %188
  br label %190

190:                                              ; preds = %186, %180
  %191 = phi i1 [ false, %180 ], [ %189, %186 ]
  br i1 %191, label %193, label %192

192:                                              ; preds = %190
  store i32 13, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %219

193:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %17, ptr align 16 @__const.mdbx_dump_val.hex, i64 16, i1 false)
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  %195 = load i64, ptr %16, align 8, !tbaa !9
  %196 = getelementptr inbounds i8, ptr %194, i64 %195
  %197 = load i8, ptr %196, align 1, !tbaa !20
  %198 = zext i8 %197 to i32
  %199 = ashr i32 %198, 4
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 %200
  %202 = load i8, ptr %201, align 1, !tbaa !20
  %203 = load ptr, ptr %15, align 8, !tbaa !5
  %204 = getelementptr inbounds i8, ptr %203, i32 1
  store ptr %204, ptr %15, align 8, !tbaa !5
  store i8 %202, ptr %203, align 1, !tbaa !20
  %205 = load ptr, ptr %10, align 8, !tbaa !5
  %206 = load i64, ptr %16, align 8, !tbaa !9
  %207 = getelementptr inbounds i8, ptr %205, i64 %206
  %208 = load i8, ptr %207, align 1, !tbaa !20
  %209 = zext i8 %208 to i32
  %210 = and i32 %209, 15
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 %211
  %213 = load i8, ptr %212, align 1, !tbaa !20
  %214 = load ptr, ptr %15, align 8, !tbaa !5
  %215 = getelementptr inbounds i8, ptr %214, i32 1
  store ptr %215, ptr %15, align 8, !tbaa !5
  store i8 %213, ptr %214, align 1, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  br label %216

216:                                              ; preds = %193
  %217 = load i64, ptr %16, align 8, !tbaa !9
  %218 = add i64 %217, 1
  store i64 %218, ptr %16, align 8, !tbaa !9
  br label %180, !llvm.loop !25

219:                                              ; preds = %192
  %220 = load ptr, ptr %15, align 8, !tbaa !5
  %221 = load ptr, ptr %14, align 8, !tbaa !5
  %222 = icmp ult ptr %220, %221
  br i1 %222, label %223, label %226

223:                                              ; preds = %219
  %224 = load ptr, ptr %15, align 8, !tbaa !5
  %225 = getelementptr inbounds i8, ptr %224, i32 1
  store ptr %225, ptr %15, align 8, !tbaa !5
  store i8 62, ptr %224, align 1, !tbaa !20
  br label %226

226:                                              ; preds = %223, %219
  %227 = load ptr, ptr %15, align 8, !tbaa !5
  store i8 0, ptr %227, align 1, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %228

228:                                              ; preds = %226, %170
  %229 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %229, ptr %4, align 8
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  br label %230

230:                                              ; preds = %228, %81, %33, %26, %20
  %231 = load ptr, ptr %4, align 8
  ret ptr %231
}

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

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

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 = { cold nounwind optsize 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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"iovec", !6, i64 0, !10, i64 8}
!13 = !{!12, !6, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !7, i64 25}
!17 = !{!"libmdbx_globals", !7, i64 0, !15, i64 16, !15, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !18, i64 27, !15, i64 28, !7, i64 32, !7, i64 40, !10, i64 80, !6, i64 88}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!18, !18, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !22}


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

%struct.libmdbx_globals = type { %union.bin128, i32, i32, i8, i8, i8, i8, i32, %union.logger_union, %union.pthread_mutex_t, i64, ptr }
%union.bin128 = type { %struct.anon }
%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.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__.mdbx_dump_val = external hidden unnamed_addr constant [14 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.mdbx_dump_val.hex = external hidden unnamed_addr constant [16 x i8], align 16

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

; Function Attrs: cold nounwind optsize uwtable
define dso_local noundef ptr @mdbx_dump_val(ptr noundef readonly %0, ptr noundef writeonly %1, i64 noundef %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %62, label %4

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %.not63 = icmp eq i64 %6, 0
  br i1 %.not63, label %62, label %7

7:                                                ; preds = %4
  %8 = icmp eq ptr %1, null
  %9 = icmp ult i64 %2, 4
  %or.cond = or i1 %8, %9
  br i1 %or.cond, label %62, label %10

10:                                               ; preds = %7
  %11 = load ptr, ptr %0, align 8, !tbaa !11
  %.not64 = icmp eq ptr %11, null
  br i1 %.not64, label %12, label %.preheader

12:                                               ; preds = %10
  %13 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull %1, i64 noundef %2, ptr noundef nonnull @.str.11, i64 noundef %6) #4
  %14 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !12
  %15 = and i8 %14, 1
  %.not65 = icmp eq i8 %15, 0
  br i1 %.not65, label %62, label %16, !prof !16

16:                                               ; preds = %12
  %17 = icmp slt i32 %13, 1
  %18 = sext i32 %13 to i64
  %19 = icmp uge i64 %18, %2
  %.not68 = or i1 %17, %19
  br i1 %.not68, label %20, label %62, !prof !16

20:                                               ; preds = %16
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.12, ptr noundef nonnull @__func__.mdbx_dump_val, i32 noundef 80) #5
  unreachable

21:                                               ; preds = %.preheader
  %22 = add nuw i64 %.05576, 1
  %exitcond.not = icmp eq i64 %22, %6
  br i1 %exitcond.not, label %.critedge, label %.preheader, !llvm.loop !17

.preheader:                                       ; preds = %10, %21
  %.05576 = phi i64 [ %22, %21 ], [ 0, %10 ]
  %23 = getelementptr inbounds i8, ptr %11, i64 %.05576
  %24 = load i8, ptr %23, align 1, !tbaa !19
  %25 = add i8 %24, -127
  %or.cond74 = icmp ult i8 %25, -95
  br i1 %or.cond74, label %34, label %21

.critedge:                                        ; preds = %21
  %spec.select75 = tail call i64 @llvm.umin.i64(i64 %6, i64 2147483647)
  %spec.select = trunc nuw nsw i64 %spec.select75 to i32
  %26 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %1, i64 noundef %2, ptr noundef nonnull @.str.13, i32 noundef %spec.select, ptr noundef nonnull %11) #4
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !12
  %28 = and i8 %27, 1
  %.not70 = icmp eq i8 %28, 0
  br i1 %.not70, label %62, label %29, !prof !16

29:                                               ; preds = %.critedge
  %30 = icmp slt i32 %26, 1
  %31 = sext i32 %26 to i64
  %32 = icmp uge i64 %31, %2
  %.not73 = or i1 %30, %32
  br i1 %.not73, label %33, label %62, !prof !16

33:                                               ; preds = %29
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.12, ptr noundef nonnull @__func__.mdbx_dump_val, i32 noundef 95) #5
  unreachable

34:                                               ; preds = %.preheader
  %35 = getelementptr i8, ptr %1, i64 %2
  %.ptr80 = getelementptr i8, ptr %35, i64 -2
  %36 = getelementptr inbounds i8, ptr %1, i64 1
  store i8 60, ptr %1, align 1, !tbaa !19
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = icmp ne i64 %37, 0
  %39 = icmp sgt i64 %2, 3
  %40 = and i1 %38, %39
  br i1 %40, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %34
  %.052.lcssa = phi ptr [ %36, %34 ], [ %53, %.lr.ph ]
  %.lcssa = phi i1 [ %39, %34 ], [ %57, %.lr.ph ]
  br i1 %.lcssa, label %59, label %61

.lr.ph:                                           ; preds = %34, %.lr.ph
  %.078 = phi i64 [ %54, %.lr.ph ], [ 0, %34 ]
  %.05277 = phi ptr [ %53, %.lr.ph ], [ %36, %34 ]
  %41 = getelementptr inbounds i8, ptr %11, i64 %.078
  %42 = load i8, ptr %41, align 1, !tbaa !19
  %43 = lshr i8 %42, 4
  %44 = zext nneg i8 %43 to i64
  %45 = getelementptr inbounds [16 x i8], ptr @__const.mdbx_dump_val.hex, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !19
  %47 = getelementptr inbounds i8, ptr %.05277, i64 1
  store i8 %46, ptr %.05277, align 1, !tbaa !19
  %48 = load i8, ptr %41, align 1, !tbaa !19
  %49 = and i8 %48, 15
  %50 = zext nneg i8 %49 to i64
  %51 = getelementptr inbounds [16 x i8], ptr @__const.mdbx_dump_val.hex, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !19
  %53 = getelementptr inbounds i8, ptr %.05277, i64 2
  store i8 %52, ptr %47, align 1, !tbaa !19
  %54 = add nuw i64 %.078, 1
  %55 = load i64, ptr %5, align 8, !tbaa !5
  %56 = icmp ult i64 %54, %55
  %57 = icmp ult ptr %53, %.ptr80
  %58 = select i1 %56, i1 %57, i1 false
  br i1 %58, label %.lr.ph, label %._crit_edge, !llvm.loop !20

59:                                               ; preds = %._crit_edge
  %60 = getelementptr inbounds i8, ptr %.052.lcssa, i64 1
  store i8 62, ptr %.052.lcssa, align 1, !tbaa !19
  br label %61

61:                                               ; preds = %59, %._crit_edge
  %.1 = phi ptr [ %60, %59 ], [ %.052.lcssa, %._crit_edge ]
  store i8 0, ptr %.1, align 1, !tbaa !19
  br label %62

62:                                               ; preds = %61, %29, %.critedge, %12, %16, %7, %4, %3
  %.053 = phi ptr [ @.str.9, %3 ], [ @.str.10, %4 ], [ null, %7 ], [ %1, %16 ], [ %1, %12 ], [ %1, %.critedge ], [ %1, %29 ], [ %1, %61 ]
  ret ptr %.053
}

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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 = { cold nounwind optsize 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 = { nofree 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { 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, !10, i64 8}
!6 = !{!"iovec", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !8, i64 25}
!13 = !{!"libmdbx_globals", !8, i64 0, !14, i64 16, !14, i64 20, !8, i64 24, !8, i64 25, !8, i64 26, !15, i64 27, !14, i64 28, !8, i64 32, !8, i64 40, !10, i64 80, !7, i64 88}
!14 = !{!"int", !8, i64 0}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!8, !8, i64 0}
!20 = distinct !{!20, !18}


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