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

; 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_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }

@globals = external global %struct.libmdbx_globals, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.rkl_pop = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: nounwind willreturn memory(read) uwtable
declare dso_local zeroext i1 @rkl_check(ptr noundef) #1

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @rkl_empty(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i64 @rkl_pop(ptr noundef %0, i1 noundef zeroext %1) #4 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  %6 = zext i1 %1 to i8
  store i8 %6, ptr %5, align 1, !tbaa !9
  br label %7

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

18:                                               ; preds = %7
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call zeroext i1 @rkl_check(ptr noundef %20) #6
  %22 = xor i1 %21, true
  %23 = xor i1 %22, true
  %24 = xor i1 %23, true
  %25 = zext i1 %24 to i32
  %26 = sext i32 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %19
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.1, ptr noundef @__func__.rkl_pop, i32 noundef 365) #7
  unreachable

30:                                               ; preds = %19
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31, %7
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.MDBX_rkl, ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 8, !tbaa !15
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %126

38:                                               ; preds = %33
  br label %39

39:                                               ; preds = %38
  %40 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !11
  %41 = zext i8 %40 to i32
  %42 = and i32 %41, 1
  %43 = icmp ne i32 %42, 0
  %44 = xor i1 %43, true
  %45 = xor i1 %44, true
  %46 = zext i1 %45 to i32
  %47 = sext i32 %46 to i64
  %48 = call i64 @llvm.expect.i64(i64 %47, i64 1)
  %49 = icmp ne i64 %48, 0
  br i1 %49, label %50, label %69

50:                                               ; preds = %39
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MDBX_rkl, ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !17
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MDBX_rkl, ptr %55, i32 0, i32 1
  %57 = load i64, ptr %56, align 8, !tbaa !18
  %58 = icmp ule i64 %54, %57
  %59 = xor i1 %58, true
  %60 = xor i1 %59, true
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i32
  %63 = sext i32 %62 to i64
  %64 = call i64 @llvm.expect.i64(i64 %63, i64 0)
  %65 = icmp ne i64 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %51
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.7, ptr noundef @__func__.rkl_pop, i32 noundef 368) #7
  unreachable

67:                                               ; preds = %51
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68, %39
  br label %70

70:                                               ; preds = %69
  %71 = load i8, ptr %5, align 1, !tbaa !9, !range !19, !noundef !20
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %104

73:                                               ; preds = %70
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = call zeroext i1 @solid_empty(ptr noundef %74)
  br i1 %75, label %91, label %76

76:                                               ; preds = %73
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.MDBX_rkl, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !18
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.MDBX_rkl, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.MDBX_rkl, ptr %83, i32 0, i32 2
  %85 = load i32, ptr %84, align 8, !tbaa !15
  %86 = sub i32 %85, 1
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds i64, ptr %82, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !22
  %90 = icmp ult i64 %79, %89
  br i1 %90, label %91, label %104

91:                                               ; preds = %76, %73
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.MDBX_rkl, ptr %93, i32 0, i32 4
  %95 = load ptr, ptr %94, align 8, !tbaa !21
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.MDBX_rkl, ptr %96, i32 0, i32 2
  %98 = load i32, ptr %97, align 8, !tbaa !15
  %99 = sub i32 %98, 1
  store i32 %99, ptr %97, align 8, !tbaa !15
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds i64, ptr %95, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !22
  %103 = call i64 @after_cut(ptr noundef %92, i64 noundef %102)
  store i64 %103, ptr %3, align 8
  br label %174

104:                                              ; preds = %76, %70
  %105 = load i8, ptr %5, align 1, !tbaa !9, !range !19, !noundef !20
  %106 = trunc i8 %105 to i1
  br i1 %106, label %125, label %107

107:                                              ; preds = %104
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = call zeroext i1 @solid_empty(ptr noundef %108)
  br i1 %109, label %120, label %110

110:                                              ; preds = %107
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MDBX_rkl, ptr %111, i32 0, i32 0
  %113 = load i64, ptr %112, align 8, !tbaa !17
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.MDBX_rkl, ptr %114, i32 0, i32 4
  %116 = load ptr, ptr %115, align 8, !tbaa !21
  %117 = getelementptr inbounds i64, ptr %116, i64 0
  %118 = load i64, ptr %117, align 8, !tbaa !22
  %119 = icmp ugt i64 %113, %118
  br i1 %119, label %120, label %125

120:                                              ; preds = %110, %107
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = call i64 @list_remove_first(ptr noundef %122)
  %124 = call i64 @after_cut(ptr noundef %121, i64 noundef %123)
  store i64 %124, ptr %3, align 8
  br label %174

125:                                              ; preds = %110, %104
  br label %126

126:                                              ; preds = %125, %33
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = call zeroext i1 @solid_empty(ptr noundef %127)
  br i1 %128, label %146, label %129

129:                                              ; preds = %126
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = load i8, ptr %5, align 1, !tbaa !9, !range !19, !noundef !20
  %132 = trunc i8 %131 to i1
  br i1 %132, label %133, label %138

133:                                              ; preds = %129
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.MDBX_rkl, ptr %134, i32 0, i32 1
  %136 = load i64, ptr %135, align 8, !tbaa !18
  %137 = add i64 %136, -1
  store i64 %137, ptr %135, align 8, !tbaa !18
  br label %143

138:                                              ; preds = %129
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.MDBX_rkl, ptr %139, i32 0, i32 0
  %141 = load i64, ptr %140, align 8, !tbaa !17
  %142 = add i64 %141, 1
  store i64 %142, ptr %140, align 8, !tbaa !17
  br label %143

143:                                              ; preds = %138, %133
  %144 = phi i64 [ %137, %133 ], [ %141, %138 ]
  %145 = call i64 @after_cut(ptr noundef %130, i64 noundef %144)
  store i64 %145, ptr %3, align 8
  br label %174

146:                                              ; preds = %126
  br label %147

147:                                              ; preds = %146
  %148 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !11
  %149 = zext i8 %148 to i32
  %150 = and i32 %149, 1
  %151 = icmp ne i32 %150, 0
  %152 = xor i1 %151, true
  %153 = xor i1 %152, true
  %154 = zext i1 %153 to i32
  %155 = sext i32 %154 to i64
  %156 = call i64 @llvm.expect.i64(i64 %155, i64 1)
  %157 = icmp ne i64 %156, 0
  br i1 %157, label %158, label %172

158:                                              ; preds = %147
  br label %159

159:                                              ; preds = %158
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = call zeroext i1 @rkl_empty(ptr noundef %160) #6
  %162 = xor i1 %161, true
  %163 = xor i1 %162, true
  %164 = xor i1 %163, true
  %165 = zext i1 %164 to i32
  %166 = sext i32 %165 to i64
  %167 = call i64 @llvm.expect.i64(i64 %166, i64 0)
  %168 = icmp ne i64 %167, 0
  br i1 %168, label %169, label %170

169:                                              ; preds = %159
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.8, ptr noundef @__func__.rkl_pop, i32 noundef 378) #7
  unreachable

170:                                              ; preds = %159
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171, %147
  br label %173

173:                                              ; preds = %172
  store i64 0, ptr %3, align 8
  br label %174

174:                                              ; preds = %173, %143, %120, %91
  %175 = load i64, ptr %3, align 8
  ret i64 %175
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @solid_empty(ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @after_cut(ptr noundef, i64 noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @list_remove_first(ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #6 = { nounwind willreturn memory(read) }
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 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !7, i64 25}
!12 = !{!"libmdbx_globals", !7, i64 0, !13, i64 16, !13, i64 20, !7, i64 24, !7, i64 25, !7, i64 26, !10, i64 27, !13, i64 28, !7, i64 32, !7, i64 40, !14, i64 80, !6, i64 88}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !13, i64 16}
!16 = !{!"MDBX_rkl", !14, i64 0, !14, i64 8, !13, i64 16, !13, i64 20, !6, i64 24, !7, i64 32}
!17 = !{!16, !14, i64 0}
!18 = !{!16, !14, i64 8}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!16, !6, i64 24}
!22 = !{!14, !14, 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 }
%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 [15 x i8], align 1
@__func__.rkl_pop = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read) uwtable
declare dso_local zeroext i1 @rkl_check(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare hidden zeroext i1 @rkl_empty(ptr noundef) local_unnamed_addr #2

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

5:                                                ; preds = %2
  %6 = tail call zeroext i1 @rkl_check(ptr noundef %0) #5
  br i1 %6, label %.thread, label %7, !prof !14

7:                                                ; preds = %5
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.rkl_pop, i32 noundef 365) #6
  unreachable

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load i32, ptr %9, align 8, !tbaa !15
  %.not24 = icmp eq i32 %10, 0
  br i1 %.not24, label %45, label %18

.thread:                                          ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %.not2428 = icmp eq i32 %12, 0
  br i1 %.not2428, label %45, label %13

13:                                               ; preds = %.thread
  %14 = load i64, ptr %0, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !18
  %.not26 = icmp ugt i64 %14, %16
  br i1 %.not26, label %17, label %18, !prof !13

17:                                               ; preds = %13
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.rkl_pop, i32 noundef 368) #6
  unreachable

18:                                               ; preds = %8, %13
  %19 = phi ptr [ %11, %13 ], [ %9, %8 ]
  %20 = tail call zeroext i1 @solid_empty(ptr noundef nonnull %0)
  br i1 %1, label %21, label %.critedge

21:                                               ; preds = %18
  br i1 %20, label %._crit_edge, label %22

._crit_edge:                                      ; preds = %21
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 24
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !19
  %.pre34 = load i32, ptr %19, align 8, !tbaa !15
  %.pre35 = add i32 %.pre34, -1
  %.pre36 = zext i32 %.pre35 to i64
  br label %33

22:                                               ; preds = %21
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i64, ptr %23, align 8, !tbaa !18
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = load i32, ptr %19, align 8, !tbaa !15
  %28 = add i32 %27, -1
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds i64, ptr %26, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !20
  %32 = icmp ult i64 %24, %31
  br i1 %32, label %33, label %.thread32

33:                                               ; preds = %._crit_edge, %22
  %.pre-phi37 = phi i64 [ %.pre36, %._crit_edge ], [ %29, %22 ]
  %.pre-phi = phi i32 [ %.pre35, %._crit_edge ], [ %28, %22 ]
  %34 = phi ptr [ %.pre, %._crit_edge ], [ %26, %22 ]
  store i32 %.pre-phi, ptr %19, align 8, !tbaa !15
  %35 = getelementptr inbounds i64, ptr %34, i64 %.pre-phi37
  %36 = load i64, ptr %35, align 8, !tbaa !20
  br label %.sink.split

.critedge:                                        ; preds = %18
  br i1 %20, label %43, label %37

37:                                               ; preds = %.critedge
  %38 = load i64, ptr %0, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = load i64, ptr %40, align 8, !tbaa !20
  %42 = icmp ugt i64 %38, %41
  br i1 %42, label %43, label %.thread30

43:                                               ; preds = %37, %.critedge
  %44 = tail call i64 @list_remove_first(ptr noundef nonnull %0)
  br label %.sink.split

45:                                               ; preds = %.thread, %8
  %46 = tail call zeroext i1 @solid_empty(ptr noundef nonnull %0)
  br i1 %46, label %55, label %49

.thread32:                                        ; preds = %22
  %47 = tail call zeroext i1 @solid_empty(ptr noundef nonnull %0)
  br i1 %47, label %55, label %.thread33

.thread30:                                        ; preds = %37
  %48 = tail call zeroext i1 @solid_empty(ptr noundef nonnull %0)
  br i1 %48, label %55, label %.thread31

49:                                               ; preds = %45
  br i1 %1, label %.thread33, label %.thread31

.thread33:                                        ; preds = %.thread32, %49
  %50 = getelementptr inbounds i8, ptr %0, i64 8
  %51 = load i64, ptr %50, align 8, !tbaa !18
  %52 = add i64 %51, -1
  store i64 %52, ptr %50, align 8, !tbaa !18
  br label %.sink.split

.thread31:                                        ; preds = %.thread30, %49
  %53 = load i64, ptr %0, align 8, !tbaa !17
  %54 = add i64 %53, 1
  store i64 %54, ptr %0, align 8, !tbaa !17
  br label %.sink.split

55:                                               ; preds = %.thread32, %.thread30, %45
  %56 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !5
  %57 = and i8 %56, 1
  %.not27 = icmp eq i8 %57, 0
  br i1 %.not27, label %62, label %58, !prof !13

58:                                               ; preds = %55
  %59 = tail call zeroext i1 @rkl_empty(ptr noundef nonnull %0) #5
  br i1 %59, label %62, label %60, !prof !14

60:                                               ; preds = %58
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.8, ptr noundef nonnull @__func__.rkl_pop, i32 noundef 378) #6
  unreachable

.sink.split:                                      ; preds = %.thread33, %.thread31, %33, %43
  %.sink = phi i64 [ %44, %43 ], [ %36, %33 ], [ %52, %.thread33 ], [ %53, %.thread31 ]
  %61 = tail call i64 @after_cut(ptr noundef nonnull %0, i64 noundef %.sink)
  br label %62

62:                                               ; preds = %.sink.split, %58, %55
  %.0 = phi i64 [ 0, %55 ], [ 0, %58 ], [ %61, %.sink.split ]
  ret i64 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @solid_empty(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @after_cut(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @list_remove_first(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!14 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!15 = !{!16, !9, i64 16}
!16 = !{!"MDBX_rkl", !11, i64 0, !11, i64 8, !9, i64 16, !9, i64 20, !12, i64 24, !7, i64 32}
!17 = !{!16, !11, i64 0}
!18 = !{!16, !11, i64 8}
!19 = !{!16, !12, i64 24}
!20 = !{!11, !11, i64 0}


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