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

; 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.6 }
%struct.anon.6 = 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 global %struct.libmdbx_globals, align 8
@osal_iov_max = external hidden global i64, align 8
@monotime_limit = external hidden global i64, align 8
@posix_clockid = external hidden global i32, align 4
@.str.57 = external hidden unnamed_addr constant [85 x i8], align 1
@__func__.osal_ctor = external hidden unnamed_addr constant [10 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [125 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: cold noreturn nounwind optsize uwtable
declare dso_local void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @osal_16dot16_to_monotime(i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @osal_monotime_to_16dot16(i64 noundef) #3

; Function Attrs: nounwind willreturn memory(none)
declare i32 @log2n_powerof2(i64 noundef) #4

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) #5

; 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) #6

; Function Attrs: nounwind uwtable
define dso_local void @osal_ctor() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %union.bin128, align 8
  %7 = call i64 @sysconf(i32 noundef 60) #8
  store i64 %7, ptr @osal_iov_max, align 8, !tbaa !5
  %8 = call i64 @sysconf(i32 noundef 30) #8
  %9 = trunc i64 %8 to i32
  store i32 %9, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  store i32 65536, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  %10 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  %11 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %12 = icmp ugt i32 %10, %11
  br i1 %12, label %13, label %15

13:                                               ; preds = %0
  %14 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  br label %17

15:                                               ; preds = %0
  %16 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  br label %17

17:                                               ; preds = %15, %13
  %18 = phi i32 [ %14, %13 ], [ %16, %15 ]
  store i32 %18, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  br label %19

19:                                               ; preds = %17
  %20 = load i8, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 4), align 1, !tbaa !15
  %21 = zext i8 %20 to i32
  %22 = and i32 %21, 1
  %23 = icmp ne i32 %22, 0
  %24 = xor i1 %23, true
  %25 = xor i1 %24, true
  %26 = zext i1 %25 to i32
  %27 = sext i32 %26 to i64
  %28 = call i64 @llvm.expect.i64(i64 %27, i64 1)
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %52

30:                                               ; preds = %19
  br label %31

31:                                               ; preds = %30
  %32 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %33 = icmp ugt i32 %32, 0
  br i1 %33, label %34, label %40

34:                                               ; preds = %31
  %35 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %36 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %37 = sub i32 %36, 1
  %38 = and i32 %35, %37
  %39 = icmp eq i32 %38, 0
  br label %40

40:                                               ; preds = %34, %31
  %41 = phi i1 [ false, %31 ], [ %39, %34 ]
  %42 = xor i1 %41, true
  %43 = xor i1 %42, true
  %44 = xor i1 %43, true
  %45 = zext i1 %44 to i32
  %46 = sext i32 %45 to i64
  %47 = call i64 @llvm.expect.i64(i64 %46, i64 0)
  %48 = icmp ne i64 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %40
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.57, ptr noundef @__func__.osal_ctor, i32 noundef 3453) #9
  unreachable

50:                                               ; preds = %40
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51, %19
  br label %53

53:                                               ; preds = %52
  br label %54

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

65:                                               ; preds = %54
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  %68 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %69 = icmp uge i32 %67, %68
  br i1 %69, label %70, label %75

70:                                               ; preds = %66
  %71 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 2), align 4, !tbaa !14
  %72 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %73 = urem i32 %71, %72
  %74 = icmp eq i32 %73, 0
  br label %75

75:                                               ; preds = %70, %66
  %76 = phi i1 [ false, %66 ], [ %74, %70 ]
  %77 = xor i1 %76, true
  %78 = xor i1 %77, true
  %79 = xor i1 %78, true
  %80 = zext i1 %79 to i32
  %81 = sext i32 %80 to i64
  %82 = call i64 @llvm.expect.i64(i64 %81, i64 0)
  %83 = icmp ne i64 %82, 0
  br i1 %83, label %84, label %85

84:                                               ; preds = %75
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.58, ptr noundef @__func__.osal_ctor, i32 noundef 3455) #9
  unreachable

85:                                               ; preds = %75
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86, %54
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 1), align 8, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = call i32 @log2n_powerof2(i64 noundef %90) #10
  %92 = trunc i32 %91 to i8
  store i8 %92, ptr getelementptr inbounds (%struct.libmdbx_globals, ptr @globals, i32 0, i32 3), align 8, !tbaa !16
  %93 = call i32 @choice_monoclock() #11
  store i32 %93, ptr @posix_clockid, align 4, !tbaa !17
  %94 = call i64 @osal_16dot16_to_monotime(i32 noundef -2)
  store i64 %94, ptr @monotime_limit, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #8
  store i32 -1, ptr %1, align 4, !tbaa !17
  br label %95

95:                                               ; preds = %147, %88
  br label %96

96:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %97 = load i32, ptr %1, align 4, !tbaa !17
  %98 = call i64 @osal_16dot16_to_monotime(i32 noundef %97)
  %99 = call i32 @osal_monotime_to_16dot16(i64 noundef %98)
  store i32 %99, ptr %2, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %100 = load i32, ptr %1, align 4, !tbaa !17
  %101 = icmp ult i32 %100, -1
  br i1 %101, label %102, label %105

102:                                              ; preds = %96
  %103 = load i32, ptr %1, align 4, !tbaa !17
  %104 = add i32 %103, 1
  br label %107

105:                                              ; preds = %96
  %106 = load i32, ptr %1, align 4, !tbaa !17
  br label %107

107:                                              ; preds = %105, %102
  %108 = phi i32 [ %104, %102 ], [ %106, %105 ]
  store i32 %108, ptr %3, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %109 = load i32, ptr %1, align 4, !tbaa !17
  %110 = icmp ugt i32 %109, 0
  br i1 %110, label %111, label %114

111:                                              ; preds = %107
  %112 = load i32, ptr %1, align 4, !tbaa !17
  %113 = sub i32 %112, 1
  br label %116

114:                                              ; preds = %107
  %115 = load i32, ptr %1, align 4, !tbaa !17
  br label %116

116:                                              ; preds = %114, %111
  %117 = phi i32 [ %113, %111 ], [ %115, %114 ]
  store i32 %117, ptr %4, align 4, !tbaa !17
  br label %118

118:                                              ; preds = %116
  %119 = load i32, ptr %2, align 4, !tbaa !17
  %120 = load i32, ptr %4, align 4, !tbaa !17
  %121 = icmp uge i32 %119, %120
  br i1 %121, label %122, label %126

122:                                              ; preds = %118
  %123 = load i32, ptr %2, align 4, !tbaa !17
  %124 = load i32, ptr %3, align 4, !tbaa !17
  %125 = icmp ule i32 %123, %124
  br label %126

126:                                              ; preds = %122, %118
  %127 = phi i1 [ false, %118 ], [ %125, %122 ]
  %128 = xor i1 %127, true
  %129 = xor i1 %128, true
  %130 = xor i1 %129, true
  %131 = zext i1 %130 to i32
  %132 = sext i32 %131 to i64
  %133 = call i64 @llvm.expect.i64(i64 %132, i64 0)
  %134 = icmp ne i64 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %126
  call void @mdbx_assert_fail(ptr noundef null, ptr noundef @.str.59, ptr noundef @__func__.osal_ctor, i32 noundef 3476) #9
  unreachable

136:                                              ; preds = %126
  br label %137

137:                                              ; preds = %136
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %1, align 4, !tbaa !17
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %138
  store i32 11, ptr %5, align 4
  br label %145

142:                                              ; preds = %138
  %143 = load i32, ptr %1, align 4, !tbaa !17
  %144 = lshr i32 %143, 1
  store i32 %144, ptr %1, align 4, !tbaa !17
  store i32 0, ptr %5, align 4
  br label %145

145:                                              ; preds = %142, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %146 = load i32, ptr %5, align 4
  switch i32 %146, label %155 [
    i32 0, label %147
    i32 11, label %148
  ]

147:                                              ; preds = %145
  br label %95

148:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #8
  %149 = call { i64, i64 } @osal_bootid() #11
  %150 = getelementptr inbounds %union.bin128, ptr %6, i32 0, i32 0
  %151 = getelementptr inbounds { i64, i64 }, ptr %150, i32 0, i32 0
  %152 = extractvalue { i64, i64 } %149, 0
  store i64 %152, ptr %151, align 8
  %153 = getelementptr inbounds { i64, i64 }, ptr %150, i32 0, i32 1
  %154 = extractvalue { i64, i64 } %149, 1
  store i64 %154, ptr %153, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @globals, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #8
  ret void

155:                                              ; preds = %145
  unreachable
}

; Function Attrs: cold nounwind optsize uwtable
declare hidden i32 @choice_monoclock() #7

; Function Attrs: cold nounwind optsize uwtable
declare hidden { i64, i64 } @osal_bootid() #7

attributes #0 = { cold noreturn 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { nounwind willreturn memory(none) "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { cold noreturn }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { cold }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 16}
!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, !6, i64 80, !13, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!10, !11, i64 20}
!15 = !{!10, !7, i64 25}
!16 = !{!10, !7, i64 24}
!17 = !{!11, !11, i64 0}
!18 = !{i64 0, i64 16, !19}
!19 = !{!7, !7, 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.6 }
%struct.anon.6 = 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
@osal_iov_max = external hidden local_unnamed_addr global i64, align 8
@monotime_limit = external hidden local_unnamed_addr global i64, align 8
@posix_clockid = external hidden local_unnamed_addr global i32, align 4
@.str.57 = external hidden unnamed_addr constant [85 x i8], align 1
@__func__.osal_ctor = external hidden unnamed_addr constant [10 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [125 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: cold noreturn nounwind optsize uwtable
declare dso_local void @mdbx_assert_fail(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @osal_16dot16_to_monotime(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @osal_monotime_to_16dot16(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i32 @log2n_powerof2(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @osal_ctor() local_unnamed_addr #1 {
  %1 = tail call i64 @sysconf(i32 noundef 60) #6
  store i64 %1, ptr @osal_iov_max, align 8, !tbaa !5
  %2 = tail call i64 @sysconf(i32 noundef 30) #6
  %3 = trunc i64 %2 to i32
  store i32 %3, ptr getelementptr inbounds (i8, ptr @globals, i64 16), align 8, !tbaa !9
  %4 = tail call i32 @llvm.umax.i32(i32 %3, i32 65536)
  store i32 %4, ptr getelementptr inbounds (i8, ptr @globals, i64 20), align 4, !tbaa !14
  %5 = load i8, ptr getelementptr inbounds (i8, ptr @globals, i64 25), align 1, !tbaa !15
  %6 = and i8 %5, 1
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %.thread, label %7, !prof !16

7:                                                ; preds = %0
  %8 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %3)
  %or.cond.not = icmp eq i32 %8, 1
  br i1 %or.cond.not, label %9, label %.critedge, !prof !17

.critedge:                                        ; preds = %7
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.57, ptr noundef nonnull @__func__.osal_ctor, i32 noundef 3453) #7
  unreachable

9:                                                ; preds = %7
  %10 = urem i32 %4, %3
  %.not31 = icmp eq i32 %10, 0
  br i1 %.not31, label %.thread, label %.critedge29, !prof !18

.critedge29:                                      ; preds = %9
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.58, ptr noundef nonnull @__func__.osal_ctor, i32 noundef 3455) #7
  unreachable

.thread:                                          ; preds = %0, %9
  %11 = and i64 %2, 4294967295
  %12 = tail call i32 @log2n_powerof2(i64 noundef %11) #8
  %13 = trunc i32 %12 to i8
  store i8 %13, ptr getelementptr inbounds (i8, ptr @globals, i64 24), align 8, !tbaa !19
  %14 = tail call i32 @choice_monoclock() #9
  store i32 %14, ptr @posix_clockid, align 4, !tbaa !20
  %15 = tail call i64 @osal_16dot16_to_monotime(i32 noundef -2)
  store i64 %15, ptr @monotime_limit, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %24, %.thread
  %.0 = phi i32 [ -1, %.thread ], [ %26, %24 ]
  %17 = tail call i64 @osal_16dot16_to_monotime(i32 noundef %.0)
  %18 = tail call i32 @osal_monotime_to_16dot16(i64 noundef %17)
  %.not21 = icmp ne i32 %.0, -1
  %19 = add i32 %.0, 1
  %20 = tail call i32 @llvm.usub.sat.i32(i32 %.0, i32 1)
  %21 = icmp ult i32 %18, %20
  %22 = icmp ult i32 %19, %18
  %.not27 = and i1 %.not21, %22
  %.not25 = or i1 %21, %.not27
  br i1 %.not25, label %23, label %24, !prof !16

23:                                               ; preds = %16
  tail call void @mdbx_assert_fail(ptr noundef null, ptr noundef nonnull @.str.59, ptr noundef nonnull @__func__.osal_ctor, i32 noundef 3476) #7
  unreachable

24:                                               ; preds = %16
  %25 = icmp eq i32 %.0, 0
  %26 = lshr i32 %.0, 1
  br i1 %25, label %27, label %16

27:                                               ; preds = %24
  %28 = tail call { i64, i64 } @osal_bootid() #9
  %29 = extractvalue { i64, i64 } %28, 0
  %30 = extractvalue { i64, i64 } %28, 1
  store i64 %29, ptr @globals, align 8
  store i64 %30, ptr getelementptr inbounds (i8, ptr @globals, i64 8), align 8, !tbaa !21
  ret void
}

; Function Attrs: cold nounwind optsize uwtable
declare hidden i32 @choice_monoclock() local_unnamed_addr #4

; Function Attrs: cold nounwind optsize uwtable
declare hidden { i64, i64 } @osal_bootid() local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.usub.sat.i32(i32, i32) #5

attributes #0 = { cold noreturn 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 #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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 "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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { cold noreturn }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { cold }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 16}
!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, !6, i64 80, !13, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!10, !11, i64 20}
!15 = !{!10, !7, i64 25}
!16 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!17 = !{!"branch_weights", i32 4000000, i32 4001}
!18 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!19 = !{!10, !7, i64 24}
!20 = !{!11, !11, i64 0}
!21 = !{!7, !7, i64 0}


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