; LLVM IR from cruppstahl/upscaledb :: src/4txn/txn_cursor.ll (ZN9upscaledb9TxnCursor4moveEj)

; 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.upscaledb::TxnCursor" = type { %"struct.upscaledb::TxnCursorState" }
%"struct.upscaledb::TxnCursorState" = type { ptr, ptr, ptr, ptr }
%"struct.upscaledb::LocalDb" = type { %"struct.upscaledb::Db", %"struct.upscaledb::ScopedPtr", %"struct.upscaledb::ScopedPtr.1", ptr, %"struct.upscaledb::ScopedPtr.3", i64, %"struct.upscaledb::Histogram" }
%"struct.upscaledb::Db" = type { ptr, ptr, ptr, ptr, %"struct.upscaledb::DbConfig", %"struct.upscaledb::DynamicArray", %"struct.upscaledb::DynamicArray" }
%"struct.upscaledb::DbConfig" = type { i16, i32, i32, i64, i32, i64, i32, i32, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.upscaledb::DynamicArray" = type <{ ptr, i64, i8, [7 x i8] }>
%"struct.upscaledb::ScopedPtr" = type { %"class.boost::scoped_ptr" }
%"class.boost::scoped_ptr" = type { ptr }
%"struct.upscaledb::ScopedPtr.1" = type { %"class.boost::scoped_ptr.2" }
%"class.boost::scoped_ptr.2" = type { ptr }
%"struct.upscaledb::ScopedPtr.3" = type { %"class.boost::scoped_ptr.4" }
%"class.boost::scoped_ptr.4" = type { ptr }
%"struct.upscaledb::Histogram" = type { ptr, %"struct.upscaledb::DynamicArray", %"struct.upscaledb::DynamicArray", %struct.ups_key_t, %struct.ups_key_t }
%struct.ups_key_t = type { i16, ptr, i32, i32 }
%"struct.upscaledb::TxnOperation" = type { ptr, ptr, i32, i32, i32, i64, ptr, ptr, ptr, ptr, ptr, %struct.ups_key_t, %struct.ups_record_t, [1 x i8] }
%struct.ups_record_t = type { i32, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__._ZN9upscaledb9TxnCursor4moveEj = external hidden unnamed_addr constant [50 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9upscaledb9TxnCursor4moveEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) #2 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %10 = load i32, ptr %5, align 4, !tbaa !9
  %11 = and i32 %10, 1
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %30

13:                                               ; preds = %2
  call void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %14 = getelementptr inbounds %"struct.upscaledb::TxnCursor", ptr %9, i32 0, i32 0
  %15 = call noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32) %14)
  %16 = getelementptr inbounds %"struct.upscaledb::LocalDb", ptr %15, i32 0, i32 2
  %17 = call noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  %18 = call noundef ptr @_ZN9upscaledb8TxnIndex5firstEv(ptr noundef nonnull align 8 dereferenceable(72) %17)
  store ptr %18, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  %21 = xor i1 %20, true
  %22 = zext i1 %21 to i64
  %23 = call i64 @llvm.expect.i64(i64 %22, i64 0)
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %13
  store i32 -11, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

26:                                               ; preds = %13
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef %9, ptr noundef %27, i1 noundef zeroext false, i32 noundef %28)
  store i32 %29, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

30:                                               ; preds = %2
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = and i32 %31, 2
  %33 = icmp eq i32 %32, 2
  br i1 %33, label %34, label %51

34:                                               ; preds = %30
  call void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %35 = getelementptr inbounds %"struct.upscaledb::TxnCursor", ptr %9, i32 0, i32 0
  %36 = call noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32) %35)
  %37 = getelementptr inbounds %"struct.upscaledb::LocalDb", ptr %36, i32 0, i32 2
  %38 = call noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %37) #8
  %39 = call noundef ptr @_ZN9upscaledb8TxnIndex4lastEv(ptr noundef nonnull align 8 dereferenceable(72) %38)
  store ptr %39, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  %42 = xor i1 %41, true
  %43 = zext i1 %42 to i64
  %44 = call i64 @llvm.expect.i64(i64 %43, i64 0)
  %45 = icmp ne i64 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %34
  store i32 -11, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

47:                                               ; preds = %34
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef %9, ptr noundef %48, i1 noundef zeroext false, i32 noundef %49)
  store i32 %50, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

51:                                               ; preds = %30
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = and i32 %52, 4
  %54 = icmp eq i32 %53, 4
  br i1 %54, label %55, label %83

55:                                               ; preds = %51
  %56 = call noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %57 = zext i1 %56 to i64
  %58 = call i64 @llvm.expect.i64(i64 %57, i64 0)
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %55
  store i32 -100, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

61:                                               ; preds = %55
  %62 = getelementptr inbounds %"struct.upscaledb::TxnCursor", ptr %9, i32 0, i32 0
  %63 = getelementptr inbounds %"struct.upscaledb::TxnCursorState", ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !11
  %65 = getelementptr inbounds %"struct.upscaledb::TxnOperation", ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  store ptr %66, ptr %7, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %80, %61
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = call noundef ptr @_ZN9upscaledb7TxnNode12next_siblingEv(ptr noundef nonnull align 8 dereferenceable(56) %69)
  store ptr %70, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  store i32 -11, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

74:                                               ; preds = %68
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef %9, ptr noundef %75, i1 noundef zeroext true, i32 noundef %76)
  store i32 %77, ptr %6, align 4, !tbaa !9
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = icmp eq i32 %78, -11
  br i1 %79, label %80, label %81

80:                                               ; preds = %74
  br label %67, !llvm.loop !20

81:                                               ; preds = %74
  %82 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %82, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

83:                                               ; preds = %51
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = and i32 %84, 8
  %86 = icmp eq i32 %85, 8
  br i1 %86, label %87, label %115

87:                                               ; preds = %83
  %88 = call noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %89 = zext i1 %88 to i64
  %90 = call i64 @llvm.expect.i64(i64 %89, i64 0)
  %91 = icmp ne i64 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %87
  store i32 -100, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

93:                                               ; preds = %87
  %94 = getelementptr inbounds %"struct.upscaledb::TxnCursor", ptr %9, i32 0, i32 0
  %95 = getelementptr inbounds %"struct.upscaledb::TxnCursorState", ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !11
  %97 = getelementptr inbounds %"struct.upscaledb::TxnOperation", ptr %96, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  store ptr %98, ptr %7, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %112, %93
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = call noundef ptr @_ZN9upscaledb7TxnNode16previous_siblingEv(ptr noundef nonnull align 8 dereferenceable(56) %101)
  store ptr %102, ptr %7, align 8, !tbaa !5
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = icmp ne ptr %103, null
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  store i32 -11, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

106:                                              ; preds = %100
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = load i32, ptr %5, align 4, !tbaa !9
  %109 = call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef %9, ptr noundef %107, i1 noundef zeroext true, i32 noundef %108)
  store i32 %109, ptr %6, align 4, !tbaa !9
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = icmp eq i32 %110, -11
  br i1 %111, label %112, label %113

112:                                              ; preds = %106
  br label %99, !llvm.loop !22

113:                                              ; preds = %106
  %114 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %114, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %116

115:                                              ; preds = %83
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 226, ptr noundef @__PRETTY_FUNCTION__._ZN9upscaledb9TxnCursor4moveEj) #9
  unreachable

116:                                              ; preds = %113, %105, %92, %81, %73, %60, %47, %46, %26, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %117 = load i32, ptr %3, align 4
  ret i32 %117
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare noundef ptr @_ZN9upscaledb8TxnIndex5firstEv(ptr noundef nonnull align 8 dereferenceable(72)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef, ptr noundef, i1 noundef zeroext, i32 noundef) #6

declare noundef ptr @_ZN9upscaledb8TxnIndex4lastEv(ptr noundef nonnull align 8 dereferenceable(72)) #5

declare noundef ptr @_ZN9upscaledb7TxnNode12next_siblingEv(ptr noundef nonnull align 8 dereferenceable(56)) #5

declare noundef ptr @_ZN9upscaledb7TxnNode16previous_siblingEv(ptr noundef nonnull align 8 dereferenceable(56)) #5

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 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 mustprogress 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 = { inlinehint mustprogress 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 #7 = { noreturn 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 #8 = { nounwind }
attributes #9 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN9upscaledb9TxnCursorE", !13, i64 0}
!13 = !{!"_ZTSN9upscaledb14TxnCursorStateE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!15, !6, i64 8}
!15 = !{!"_ZTSN9upscaledb12TxnOperationE", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !16, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !17, i64 80, !19, i64 104, !7, i64 128}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTS9ups_key_t", !18, i64 0, !6, i64 8, !10, i64 16, !10, i64 20}
!18 = !{!"short", !7, i64 0}
!19 = !{!"_ZTS12ups_record_t", !10, i64 0, !6, i64 8, !10, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; 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"

@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@__PRETTY_FUNCTION__._ZN9upscaledb9TxnCursor4moveEj = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9upscaledb9TxnCursor4moveEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = and i32 %1, 1
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %9, label %4

4:                                                ; preds = %2
  tail call void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %5 = tail call noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %6 = getelementptr inbounds i8, ptr %5, i64 168
  %7 = tail call noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %8 = tail call noundef ptr @_ZN9upscaledb8TxnIndex5firstEv(ptr noundef nonnull align 8 dereferenceable(72) %7)
  %.not34 = icmp eq ptr %8, null
  br i1 %.not34, label %.loopexit, label %.loopexit.sink.split, !prof !5

9:                                                ; preds = %2
  %10 = and i32 %1, 2
  %.not28 = icmp eq i32 %10, 0
  br i1 %.not28, label %16, label %11

11:                                               ; preds = %9
  tail call void @_ZN9upscaledb9TxnCursor10set_to_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %12 = tail call noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %13 = getelementptr inbounds i8, ptr %12, i64 168
  %14 = tail call noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %15 = tail call noundef ptr @_ZN9upscaledb8TxnIndex4lastEv(ptr noundef nonnull align 8 dereferenceable(72) %14)
  %.not33 = icmp eq ptr %15, null
  br i1 %.not33, label %.loopexit, label %.loopexit.sink.split, !prof !5

16:                                               ; preds = %9
  %17 = and i32 %1, 4
  %.not29 = icmp eq i32 %17, 0
  br i1 %.not29, label %30, label %18

18:                                               ; preds = %16
  %19 = tail call noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  br i1 %19, label %.loopexit, label %20, !prof !5

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !6
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  br label %25

25:                                               ; preds = %27, %20
  %.0 = phi ptr [ %24, %20 ], [ %26, %27 ]
  %26 = tail call noundef ptr @_ZN9upscaledb7TxnNode12next_siblingEv(ptr noundef nonnull align 8 dereferenceable(56) %.0)
  %.not32 = icmp eq ptr %26, null
  br i1 %.not32, label %.loopexit, label %27

27:                                               ; preds = %25
  %28 = tail call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef nonnull %0, ptr noundef nonnull %26, i1 noundef zeroext true, i32 noundef %1)
  %29 = icmp eq i32 %28, -11
  br i1 %29, label %25, label %.loopexit, !llvm.loop !19

30:                                               ; preds = %16
  %31 = and i32 %1, 8
  %.not30 = icmp eq i32 %31, 0
  br i1 %.not30, label %44, label %32

32:                                               ; preds = %30
  %33 = tail call noundef zeroext i1 @_ZNK9upscaledb9TxnCursor6is_nilEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  br i1 %33, label %.loopexit, label %34, !prof !5

34:                                               ; preds = %32
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !6
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  br label %39

39:                                               ; preds = %41, %34
  %.1 = phi ptr [ %38, %34 ], [ %40, %41 ]
  %40 = tail call noundef ptr @_ZN9upscaledb7TxnNode16previous_siblingEv(ptr noundef nonnull align 8 dereferenceable(56) %.1)
  %.not31 = icmp eq ptr %40, null
  br i1 %.not31, label %.loopexit, label %41

41:                                               ; preds = %39
  %42 = tail call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef nonnull %0, ptr noundef nonnull %40, i1 noundef zeroext true, i32 noundef %1)
  %43 = icmp eq i32 %42, -11
  br i1 %43, label %39, label %.loopexit, !llvm.loop !21

44:                                               ; preds = %30
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 226, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9upscaledb9TxnCursor4moveEj) #7
  unreachable

.loopexit.sink.split:                             ; preds = %11, %4
  %.sink = phi ptr [ %8, %4 ], [ %15, %11 ]
  %45 = tail call noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef nonnull %0, ptr noundef nonnull %.sink, i1 noundef zeroext false, i32 noundef %1)
  br label %.loopexit

.loopexit:                                        ; preds = %27, %25, %41, %39, %.loopexit.sink.split, %32, %18, %11, %4
  %.023 = phi i32 [ -11, %4 ], [ -11, %11 ], [ -100, %18 ], [ -100, %32 ], [ %45, %.loopexit.sink.split ], [ %42, %41 ], [ -11, %39 ], [ %28, %27 ], [ -11, %25 ]
  ret i32 %.023
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @_ZN9upscaledbL2dbERNS_14TxnCursorStateE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK5boost10scoped_ptrIN9upscaledb8TxnIndexEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

declare noundef ptr @_ZN9upscaledb8TxnIndex5firstEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @_ZN9upscaledbL16move_top_in_nodeEPNS_9TxnCursorEPNS_7TxnNodeEbj(ptr noundef, ptr noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #4

declare noundef ptr @_ZN9upscaledb8TxnIndex4lastEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #3

declare noundef ptr @_ZN9upscaledb7TxnNode12next_siblingEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

declare noundef ptr @_ZN9upscaledb7TxnNode16previous_siblingEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress 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 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 = { inlinehint mustprogress 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 = { "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 mustprogress 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 = { noreturn 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 = { nounwind }
attributes #7 = { 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !9, i64 8}
!7 = !{!"_ZTSN9upscaledb9TxnCursorE", !8, i64 0}
!8 = !{!"_ZTSN9upscaledb14TxnCursorStateE", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!13, !9, i64 8}
!13 = !{!"_ZTSN9upscaledb12TxnOperationE", !9, i64 0, !9, i64 8, !14, i64 16, !14, i64 20, !14, i64 24, !15, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !16, i64 80, !18, i64 104, !10, i64 128}
!14 = !{!"int", !10, i64 0}
!15 = !{!"long", !10, i64 0}
!16 = !{!"_ZTS9ups_key_t", !17, i64 0, !9, i64 8, !14, i64 16, !14, i64 20}
!17 = !{!"short", !10, i64 0}
!18 = !{!"_ZTS12ups_record_t", !14, i64 0, !9, i64 8, !14, i64 16}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


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