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

; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.6, i64 }
%union.anon.6 = type { ptr }
%struct.MDBX_txn = type { i32, i32, i64, i64, ptr, ptr, %struct.geo, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.MDBX_canary, ptr, %union.anon.1 }
%struct.geo = type { i16, i16, i32, i32, %union.anon, %union.anon.0 }
%union.anon = type { i32 }
%union.anon.0 = type { i32 }
%struct.MDBX_canary = type { i64, i64, i64, i64 }
%union.anon.1 = type { %struct.anon.2 }
%struct.anon.2 = type { %struct.troika, ptr, %struct.anon.3, i8, i32, i32, i64, ptr, ptr, ptr, i64, %union.anon.4 }
%struct.anon.3 = type { %struct.MDBX_rkl, i64, %struct.MDBX_rkl }
%struct.MDBX_rkl = type { i64, i64, i32, i32, ptr, [12 x i64] }
%union.anon.4 = type { %struct.anon.5 }
%struct.anon.5 = type { i64, ptr }
%struct.meta = type { [2 x i32], %union.anon.7, i16, i8, i8, %struct.geo, %union.anon.8, %struct.MDBX_canary, %union.anon.11, [2 x %union.mdbx_atomic_uint32_t], [2 x i32], %union.bin128, %union.bin128 }
%union.anon.7 = type { i64 }
%union.anon.8 = type { %struct.anon.9 }
%struct.anon.9 = type { %struct.tree, %struct.tree }
%struct.tree = type { i16, i16, i32, i32, i32, i32, i32, i64, i64, i64 }
%union.anon.11 = type { i64 }
%union.mdbx_atomic_uint32_t = type { i32 }
%union.bin128 = type { %struct.anon.12 }
%struct.anon.12 = type { i64, i64 }

@__func__.mdbx_txn_straggler = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_straggler(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %struct.troika, align 8
  %10 = alloca %struct.meta_ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call i32 @check_txn(ptr noundef %12, i32 noundef 19)
  store i32 %13, ptr %6, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = icmp eq i32 %14, 0
  %16 = xor i1 %15, true
  %17 = xor i1 %16, true
  %18 = zext i1 %17 to i32
  %19 = sext i32 %18 to i64
  %20 = call i64 @llvm.expect.i64(i64 %19, i64 1)
  %21 = icmp ne i64 %20, 0
  br i1 %21, label %22, label %27

22:                                               ; preds = %2
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MDBX_txn, ptr %23, i32 0, i32 9
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = call i32 @check_env(ptr noundef %25, i1 noundef zeroext true)
  store i32 %26, ptr %6, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %22, %2
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  %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 %47

36:                                               ; preds = %27
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = sub nsw i32 0, %40
  br label %44

42:                                               ; preds = %36
  %43 = load i32, ptr %6, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %42, %39
  %45 = phi i32 [ %41, %39 ], [ %43, %42 ]
  %46 = call i32 @log_if_error(i32 noundef %45, ptr noundef @__func__.mdbx_txn_straggler, i32 noundef 16)
  store i32 %46, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

47:                                               ; preds = %27
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.MDBX_txn, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !17
  %51 = and i32 %50, 131072
  %52 = icmp eq i32 %51, 0
  %53 = xor i1 %52, true
  %54 = xor i1 %53, true
  %55 = zext i1 %54 to i32
  %56 = sext i32 %55 to i64
  %57 = call i64 @llvm.expect.i64(i64 %56, i64 0)
  %58 = icmp ne i64 %57, 0
  br i1 %58, label %59, label %85

59:                                               ; preds = %47
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %84

62:                                               ; preds = %59
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.MDBX_txn, ptr %63, i32 0, i32 6
  %65 = getelementptr inbounds %struct.geo, ptr %64, i32 0, i32 5
  %66 = load i32, ptr %65, align 8, !tbaa !18
  %67 = zext i32 %66 to i64
  %68 = mul i64 %67, 100
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.MDBX_txn, ptr %69, i32 0, i32 6
  %71 = getelementptr inbounds %struct.geo, ptr %70, i32 0, i32 4
  %72 = load i32, ptr %71, align 4, !tbaa !18
  %73 = udiv i32 %72, 2
  %74 = zext i32 %73 to i64
  %75 = add i64 %68, %74
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MDBX_txn, ptr %76, i32 0, i32 6
  %78 = getelementptr inbounds %struct.geo, ptr %77, i32 0, i32 4
  %79 = load i32, ptr %78, align 4, !tbaa !18
  %80 = zext i32 %79 to i64
  %81 = udiv i64 %75, %80
  %82 = trunc i64 %81 to i32
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %82, ptr %83, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %62, %59
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

85:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.MDBX_txn, ptr %86, i32 0, i32 9
  %88 = load ptr, ptr %87, align 8, !tbaa !11
  call void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8 %9, ptr noundef %88)
  br label %89

89:                                               ; preds = %125, %85
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #6
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.MDBX_txn, ptr %90, i32 0, i32 9
  %92 = load ptr, ptr %91, align 8, !tbaa !11
  call void @meta_recent(ptr dead_on_unwind writable sret(%struct.meta_ptr) align 8 %10, ptr noundef %92, ptr noundef %9)
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %117

95:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %96 = getelementptr inbounds %struct.meta_ptr, ptr %10, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !18
  %98 = getelementptr inbounds %struct.meta, ptr %97, i32 0, i32 5
  %99 = getelementptr inbounds %struct.geo, ptr %98, i32 0, i32 4
  %100 = load volatile i32, ptr %99, align 4, !tbaa !18
  store i32 %100, ptr %11, align 4, !tbaa !9
  %101 = getelementptr inbounds %struct.meta_ptr, ptr %10, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !18
  %103 = getelementptr inbounds %struct.meta, ptr %102, i32 0, i32 5
  %104 = getelementptr inbounds %struct.geo, ptr %103, i32 0, i32 5
  %105 = load volatile i32, ptr %104, align 4, !tbaa !18
  %106 = zext i32 %105 to i64
  %107 = mul i64 %106, 100
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = udiv i32 %108, 2
  %110 = zext i32 %109 to i64
  %111 = add i64 %107, %110
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = zext i32 %112 to i64
  %114 = udiv i64 %111, %113
  %115 = trunc i64 %114 to i32
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %115, ptr %116, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %117

117:                                              ; preds = %95, %89
  %118 = getelementptr inbounds %struct.meta_ptr, ptr %10, i32 0, i32 0
  %119 = load i64, ptr %118, align 8, !tbaa !19
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MDBX_txn, ptr %120, i32 0, i32 7
  %122 = load i64, ptr %121, align 8, !tbaa !21
  %123 = sub i64 %119, %122
  %124 = udiv i64 %123, 1
  store i64 %124, ptr %8, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #6
  br label %125

125:                                              ; preds = %117
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MDBX_txn, ptr %126, i32 0, i32 9
  %128 = load ptr, ptr %127, align 8, !tbaa !11
  %129 = call zeroext i1 @meta_should_retry(ptr noundef %128, ptr noundef %9)
  %130 = xor i1 %129, true
  %131 = xor i1 %130, true
  %132 = zext i1 %131 to i32
  %133 = sext i32 %132 to i64
  %134 = call i64 @llvm.expect.i64(i64 %133, i64 0)
  %135 = icmp ne i64 %134, 0
  br i1 %135, label %89, label %136, !llvm.loop !23

136:                                              ; preds = %125
  %137 = load i64, ptr %8, align 8, !tbaa !22
  %138 = icmp ugt i64 %137, 2147483647
  br i1 %138, label %139, label %140

139:                                              ; preds = %136
  br label %143

140:                                              ; preds = %136
  %141 = load i64, ptr %8, align 8, !tbaa !22
  %142 = trunc i64 %141 to i32
  br label %143

143:                                              ; preds = %140, %139
  %144 = phi i32 [ 2147483647, %139 ], [ %142, %140 ]
  store i32 %144, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %145

145:                                              ; preds = %143, %84, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %146 = load i32, ptr %3, align 4
  ret i32 %146
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr noundef, i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @check_env(ptr noundef, i1 noundef zeroext) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @log_if_error(i32 noundef, ptr noundef, i32 noundef) #4

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) #4

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

declare zeroext i1 @meta_should_retry(ptr noundef, ptr noundef) #5

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

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 80}
!12 = !{!"MDBX_txn", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !14, 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, !16, i64 128, !6, i64 160, !7, i64 168}
!13 = !{!"long", !7, i64 0}
!14 = !{!"geo", !15, i64 0, !15, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MDBX_canary", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!17 = !{!12, !10, i64 4}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !13, i64 0}
!20 = !{!"meta_ptr", !13, i64 0, !7, i64 8, !13, i64 16}
!21 = !{!12, !13, i64 64}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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.troika = type { i8, i8, i8, i8, i32, [3 x i64] }
%struct.meta_ptr = type { i64, %union.anon.6, i64 }
%union.anon.6 = type { ptr }

@__func__.mdbx_txn_straggler = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @mdbx_txn_straggler(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.troika, align 8
  %4 = alloca %struct.meta_ptr, align 8
  %5 = tail call i32 @check_txn(ptr noundef %0, i32 noundef 19)
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %.thread, !prof !5

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  %9 = load ptr, ptr %8, align 8, !tbaa !6
  %10 = tail call i32 @check_env(ptr noundef %9, i1 noundef zeroext true)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %14, label %.thread, !prof !16

.thread:                                          ; preds = %2, %7
  %.02330 = phi i32 [ %10, %7 ], [ %5, %2 ]
  %11 = tail call i32 @llvm.abs.i32(i32 %.02330, i1 false)
  %12 = sub i32 0, %11
  %13 = tail call i32 @log_if_error(i32 noundef %12, ptr noundef nonnull @__func__.mdbx_txn_straggler, i32 noundef 16)
  br label %63

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = and i32 %16, 131072
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %33, !prof !18

19:                                               ; preds = %14
  %.not27 = icmp eq ptr %1, null
  br i1 %.not27, label %63, label %20

20:                                               ; preds = %19
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  %22 = load i32, ptr %21, align 8, !tbaa !19
  %23 = zext i32 %22 to i64
  %24 = mul nuw nsw i64 %23, 100
  %25 = getelementptr inbounds i8, ptr %0, i64 52
  %26 = load i32, ptr %25, align 4, !tbaa !19
  %27 = lshr i32 %26, 1
  %28 = zext nneg i32 %27 to i64
  %29 = add nuw nsw i64 %24, %28
  %30 = zext i32 %26 to i64
  %31 = udiv i64 %29, %30
  %32 = trunc i64 %31 to i32
  store i32 %32, ptr %1, align 4, !tbaa !20
  br label %63

33:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  %34 = load ptr, ptr %8, align 8, !tbaa !6
  call void @meta_tap(ptr dead_on_unwind nonnull writable sret(%struct.troika) align 8 %3, ptr noundef %34) #6
  %.not26 = icmp eq ptr %1, null
  %35 = getelementptr inbounds i8, ptr %4, i64 8
  %36 = getelementptr inbounds i8, ptr %0, i64 64
  br i1 %.not26, label %.split.us, label %.split

.split.us:                                        ; preds = %33, %.split.us
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %37 = load ptr, ptr %8, align 8, !tbaa !6
  call void @meta_recent(ptr dead_on_unwind nonnull writable sret(%struct.meta_ptr) align 8 %4, ptr noundef %37, ptr noundef nonnull %3)
  %38 = load i64, ptr %4, align 8, !tbaa !21
  %39 = load i64, ptr %36, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  %40 = load ptr, ptr %8, align 8, !tbaa !6
  %41 = call zeroext i1 @meta_should_retry(ptr noundef %40, ptr noundef nonnull %3) #6
  br i1 %41, label %.split.us, label %.split33.us, !prof !18, !llvm.loop !24

.split:                                           ; preds = %33, %.split
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %42 = load ptr, ptr %8, align 8, !tbaa !6
  call void @meta_recent(ptr dead_on_unwind nonnull writable sret(%struct.meta_ptr) align 8 %4, ptr noundef %42, ptr noundef nonnull %3)
  %43 = load ptr, ptr %35, align 8, !tbaa !19
  %44 = getelementptr inbounds i8, ptr %43, i64 32
  %45 = load volatile i32, ptr %44, align 4, !tbaa !19
  %46 = getelementptr inbounds i8, ptr %43, i64 36
  %47 = load volatile i32, ptr %46, align 4, !tbaa !19
  %48 = zext i32 %47 to i64
  %49 = mul nuw nsw i64 %48, 100
  %50 = lshr i32 %45, 1
  %51 = zext nneg i32 %50 to i64
  %52 = add nuw nsw i64 %49, %51
  %53 = zext i32 %45 to i64
  %54 = udiv i64 %52, %53
  %55 = trunc i64 %54 to i32
  store i32 %55, ptr %1, align 4, !tbaa !20
  %56 = load i64, ptr %4, align 8, !tbaa !21
  %57 = load i64, ptr %36, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  %58 = load ptr, ptr %8, align 8, !tbaa !6
  %59 = call zeroext i1 @meta_should_retry(ptr noundef %58, ptr noundef nonnull %3) #6
  br i1 %59, label %.split, label %.split33.us, !prof !18, !llvm.loop !24

.split33.us:                                      ; preds = %.split, %.split.us
  %.us-phi = phi i64 [ %38, %.split.us ], [ %56, %.split ]
  %.us-phi34 = phi i64 [ %39, %.split.us ], [ %57, %.split ]
  %60 = sub i64 %.us-phi, %.us-phi34
  %61 = call i64 @llvm.umin.i64(i64 %60, i64 2147483647)
  %62 = trunc nuw nsw i64 %61 to i32
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  br label %63

63:                                               ; preds = %19, %20, %.split33.us, %.thread
  %.0 = phi i32 [ %13, %.thread ], [ %62, %.split33.us ], [ 0, %20 ], [ 0, %19 ]
  ret i32 %.0
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @check_txn(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @check_env(ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @log_if_error(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare void @meta_tap(ptr dead_on_unwind writable sret(%struct.troika) align 8, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @meta_recent(ptr dead_on_unwind noalias writable sret(%struct.meta_ptr) align 8, ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare zeroext i1 @meta_should_retry(ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

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

!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 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!6 = !{!7, !12, i64 80}
!7 = !{!"MDBX_txn", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !13, 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, !15, i64 128, !12, i64 160, !9, i64 168}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"geo", !14, i64 0, !14, i64 2, !8, i64 4, !8, i64 8, !9, i64 12, !9, i64 16}
!14 = !{!"short", !9, i64 0}
!15 = !{!"MDBX_canary", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!16 = !{!"branch_weights", !"expected", i32 -2147483648, i32 0}
!17 = !{!7, !8, i64 4}
!18 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!19 = !{!9, !9, i64 0}
!20 = !{!8, !8, i64 0}
!21 = !{!22, !11, i64 0}
!22 = !{!"meta_ptr", !11, i64 0, !9, i64 8, !11, i64 16}
!23 = !{!7, !11, i64 64}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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