; LLVM IR from nsccgz-storage/nvlsm :: db/log_writer.ll (ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE)

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

%"class.leveldb::Status" = type { ptr }
%"class.leveldb::Slice" = type { ptr, i64 }
%"class.leveldb::log::Writer" = type { ptr, i32, [5 x i32] }

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE(ptr dead_on_unwind noalias writable sret(%"class.leveldb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i1, align 1
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca %"class.leveldb::Status", align 8
  %13 = alloca %"class.leveldb::Slice", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca %"class.leveldb::Status", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call noundef ptr @_ZNK7leveldb5Slice4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  store ptr %23, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %24)
  store i64 %25, ptr %8, align 8, !tbaa !9
  store i1 false, ptr %9, align 1
  call void @_ZN7leveldb6StatusC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #5
  store i8 1, ptr %10, align 1, !tbaa !11
  br label %26

26:                                               ; preds = %120, %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %27 = getelementptr inbounds %"class.leveldb::log::Writer", ptr %21, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !13
  %29 = sub nsw i32 32768, %28
  store i32 %29, ptr %11, align 4, !tbaa !16
  %30 = load i32, ptr %11, align 4, !tbaa !16
  %31 = icmp sge i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %26
  br label %35

33:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 45, ptr noundef @__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE) #6
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  %36 = load i32, ptr %11, align 4, !tbaa !16
  %37 = icmp slt i32 %36, 7
  br i1 %37, label %38, label %57

38:                                               ; preds = %35
  %39 = load i32, ptr %11, align 4, !tbaa !16
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %55

41:                                               ; preds = %38
  %42 = getelementptr inbounds %"class.leveldb::log::Writer", ptr %21, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  %44 = load i32, ptr %11, align 4, !tbaa !16
  %45 = sext i32 %44 to i64
  invoke void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef @.str.2, i64 noundef %45)
          to label %46 unwind label %51

46:                                               ; preds = %41
  %47 = load ptr, ptr %43, align 8, !tbaa !18
  %48 = getelementptr inbounds ptr, ptr %47, i64 2
  %49 = load ptr, ptr %48, align 8
  invoke void %49(ptr dead_on_unwind writable sret(%"class.leveldb::Status") align 8 %12, ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull align 8 dereferenceable(16) %13)
          to label %50 unwind label %51

50:                                               ; preds = %46
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  br label %55

51:                                               ; preds = %46, %41
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %14, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  br label %128

55:                                               ; preds = %50, %38
  %56 = getelementptr inbounds %"class.leveldb::log::Writer", ptr %21, i32 0, i32 1
  store i32 0, ptr %56, align 8, !tbaa !13
  br label %57

57:                                               ; preds = %55, %35
  %58 = getelementptr inbounds %"class.leveldb::log::Writer", ptr %21, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !13
  %60 = sub nsw i32 32768, %59
  %61 = sub nsw i32 %60, 7
  %62 = icmp sge i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %57
  br label %66

64:                                               ; preds = %57
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 57, ptr noundef @__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE) #6
  unreachable

65:                                               ; No predecessors!
  br label %66

66:                                               ; preds = %65, %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %67 = getelementptr inbounds %"class.leveldb::log::Writer", ptr %21, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !13
  %69 = sub nsw i32 32768, %68
  %70 = sub nsw i32 %69, 7
  %71 = sext i32 %70 to i64
  store i64 %71, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %72 = load i64, ptr %8, align 8, !tbaa !9
  %73 = load i64, ptr %16, align 8, !tbaa !9
  %74 = icmp ult i64 %72, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %66
  %76 = load i64, ptr %8, align 8, !tbaa !9
  br label %79

77:                                               ; preds = %66
  %78 = load i64, ptr %16, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %77, %75
  %80 = phi i64 [ %76, %75 ], [ %78, %77 ]
  store i64 %80, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #5
  %81 = load i64, ptr %8, align 8, !tbaa !9
  %82 = load i64, ptr %17, align 8, !tbaa !9
  %83 = icmp eq i64 %81, %82
  %84 = zext i1 %83 to i8
  store i8 %84, ptr %19, align 1, !tbaa !11
  %85 = load i8, ptr %10, align 1, !tbaa !11, !range !20, !noundef !21
  %86 = trunc i8 %85 to i1
  br i1 %86, label %87, label %91

87:                                               ; preds = %79
  %88 = load i8, ptr %19, align 1, !tbaa !11, !range !20, !noundef !21
  %89 = trunc i8 %88 to i1
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  store i32 1, ptr %18, align 4, !tbaa !22
  br label %102

91:                                               ; preds = %87, %79
  %92 = load i8, ptr %10, align 1, !tbaa !11, !range !20, !noundef !21
  %93 = trunc i8 %92 to i1
  br i1 %93, label %94, label %95

94:                                               ; preds = %91
  store i32 2, ptr %18, align 4, !tbaa !22
  br label %101

95:                                               ; preds = %91
  %96 = load i8, ptr %19, align 1, !tbaa !11, !range !20, !noundef !21
  %97 = trunc i8 %96 to i1
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  store i32 4, ptr %18, align 4, !tbaa !22
  br label %100

99:                                               ; preds = %95
  store i32 3, ptr %18, align 4, !tbaa !22
  br label %100

100:                                              ; preds = %99, %98
  br label %101

101:                                              ; preds = %100, %94
  br label %102

102:                                              ; preds = %101, %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %103 = load i32, ptr %18, align 4, !tbaa !22
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = load i64, ptr %17, align 8, !tbaa !9
  invoke void @_ZN7leveldb3log6Writer18EmitPhysicalRecordENS0_10RecordTypeEPKcm(ptr dead_on_unwind writable sret(%"class.leveldb::Status") align 8 %20, ptr noundef nonnull align 8 dereferenceable(32) %21, i32 noundef %103, ptr noundef %104, i64 noundef %105)
          to label %106 unwind label %124

106:                                              ; preds = %102
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7leveldb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %20) #5
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %108 = load i64, ptr %17, align 8, !tbaa !9
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i64 %108
  store ptr %110, ptr %7, align 8, !tbaa !5
  %111 = load i64, ptr %17, align 8, !tbaa !9
  %112 = load i64, ptr %8, align 8, !tbaa !9
  %113 = sub i64 %112, %111
  store i64 %113, ptr %8, align 8, !tbaa !9
  store i8 0, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %114

114:                                              ; preds = %106
  %115 = invoke noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
          to label %116 unwind label %129

116:                                              ; preds = %114
  br i1 %115, label %117, label %120

117:                                              ; preds = %116
  %118 = load i64, ptr %8, align 8, !tbaa !9
  %119 = icmp ugt i64 %118, 0
  br label %120

120:                                              ; preds = %117, %116
  %121 = phi i1 [ false, %116 ], [ %119, %117 ]
  br i1 %121, label %26, label %122, !llvm.loop !24

122:                                              ; preds = %120
  store i1 true, ptr %9, align 1
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  %123 = load i1, ptr %9, align 1
  br i1 %123, label %135, label %134

124:                                              ; preds = %102
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %14, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %128

128:                                              ; preds = %124, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %133

129:                                              ; preds = %114
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %14, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %15, align 4
  br label %133

133:                                              ; preds = %129, %128
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #5
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %136

134:                                              ; preds = %122
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  br label %135

135:                                              ; preds = %134, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void

136:                                              ; preds = %133
  %137 = load ptr, ptr %14, align 8
  %138 = load i32, ptr %15, align 4
  %139 = insertvalue { ptr, i32 } poison, ptr %137, 0
  %140 = insertvalue { ptr, i32 } %139, i32 %138, 1
  resume { ptr, i32 } %140
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Writer18EmitPhysicalRecordENS0_10RecordTypeEPKcm(ptr dead_on_unwind noalias writable sret(%"class.leveldb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef, i64 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7leveldb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #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 = { nounwind }
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, !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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !15, i64 8}
!14 = !{!"_ZTSN7leveldb3log6WriterE", !6, i64 0, !15, i64 8, !7, i64 12}
!15 = !{!"int", !7, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!14, !6, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !23, i64 0}
!23 = !{!"_ZTSN7leveldb3log10RecordTypeE", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"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"

%"class.leveldb::Status" = type { ptr }
%"class.leveldb::Slice" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE(ptr dead_on_unwind noalias writable sret(%"class.leveldb::Status") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
.peel.begin:
  %3 = alloca %"class.leveldb::Status", align 8
  %4 = alloca %"class.leveldb::Slice", align 8
  %5 = alloca %"class.leveldb::Status", align 8
  %6 = tail call noundef ptr @_ZNK7leveldb5Slice4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %7 = tail call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  tail call void @_ZN7leveldb6StatusC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = sub nsw i32 32768, %9
  %11 = icmp slt i32 %9, 32769
  br i1 %11, label %12, label %.loopexit

12:                                               ; preds = %.peel.begin
  %13 = icmp sgt i32 %9, 32761
  br i1 %13, label %14, label %23

14:                                               ; preds = %12
  %.not.peel = icmp eq i32 %9, 32768
  br i1 %.not.peel, label %22, label %15

15:                                               ; preds = %14
  %16 = load ptr, ptr %1, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %17 = zext nneg i32 %10 to i64
  call void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull @.str.2, i64 noundef %17)
  %18 = load ptr, ptr %16, align 8, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8
  invoke void %20(ptr dead_on_unwind nonnull writable sret(%"class.leveldb::Status") align 8 %3, ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %21 unwind label %.loopexit.split-lp

21:                                               ; preds = %15
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %22

22:                                               ; preds = %21, %14
  store i32 0, ptr %8, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %22, %12
  %24 = phi i32 [ 0, %22 ], [ %9, %12 ]
  %25 = sub i32 32761, %24
  %26 = icmp sgt i32 %25, -1
  br i1 %26, label %27, label %.loopexit39

27:                                               ; preds = %23
  %28 = zext nneg i32 %25 to i64
  %29 = call i64 @llvm.umin.i64(i64 %7, i64 %28)
  %.not35.not.peel = icmp ugt i64 %7, %28
  %spec.select.peel = select i1 %.not35.not.peel, i32 2, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN7leveldb3log6Writer18EmitPhysicalRecordENS0_10RecordTypeEPKcm(ptr dead_on_unwind nonnull writable sret(%"class.leveldb::Status") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %spec.select.peel, ptr noundef %6, i64 noundef %29)
          to label %30 unwind label %.loopexit.split-lp41

30:                                               ; preds = %27
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7leveldb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %32 = sub i64 %7, %29
  %33 = call noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %34 = icmp ne i64 %32, 0
  %35 = and i1 %33, %34
  br i1 %35, label %.peel.next, label %.loopexit45

.peel.next:                                       ; preds = %30
  %36 = getelementptr inbounds i8, ptr %6, i64 %29
  br label %37

37:                                               ; preds = %60, %.peel.next
  %.028 = phi i64 [ %32, %.peel.next ], [ %63, %60 ]
  %.0 = phi ptr [ %36, %.peel.next ], [ %62, %60 ]
  %38 = load i32, ptr %8, align 8, !tbaa !5
  %39 = sub nsw i32 32768, %38
  %40 = icmp slt i32 %38, 32769
  br i1 %40, label %41, label %.loopexit

.loopexit:                                        ; preds = %37, %.peel.begin
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 45, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE) #7
  unreachable

41:                                               ; preds = %37
  %42 = icmp sgt i32 %38, 32761
  br i1 %42, label %43, label %53

43:                                               ; preds = %41
  %.not = icmp eq i32 %38, 32768
  br i1 %.not, label %52, label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %1, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %46 = zext nneg i32 %39 to i64
  call void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull @.str.2, i64 noundef %46)
  %47 = load ptr, ptr %45, align 8, !tbaa !12
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  %49 = load ptr, ptr %48, align 8
  invoke void %49(ptr dead_on_unwind nonnull writable sret(%"class.leveldb::Status") align 8 %3, ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %50 unwind label %.loopexit38

50:                                               ; preds = %44
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %52

.loopexit38:                                      ; preds = %44
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %51

.loopexit.split-lp:                               ; preds = %15
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %51

51:                                               ; preds = %.loopexit.split-lp, %.loopexit38
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit38 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %68

52:                                               ; preds = %50, %43
  store i32 0, ptr %8, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %52, %41
  %54 = phi i32 [ 0, %52 ], [ %38, %41 ]
  %55 = sub i32 32761, %54
  %56 = icmp sgt i32 %55, -1
  br i1 %56, label %57, label %.loopexit39

.loopexit39:                                      ; preds = %53, %23
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 57, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7leveldb3log6Writer9AddRecordERKNS_5SliceE) #7
  unreachable

57:                                               ; preds = %53
  %58 = zext nneg i32 %55 to i64
  %59 = call i64 @llvm.umin.i64(i64 %.028, i64 %58)
  %.not35.not = icmp ugt i64 %.028, %58
  %. = select i1 %.not35.not, i32 3, i32 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN7leveldb3log6Writer18EmitPhysicalRecordENS0_10RecordTypeEPKcm(ptr dead_on_unwind nonnull writable sret(%"class.leveldb::Status") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %., ptr noundef %.0, i64 noundef %59)
          to label %60 unwind label %.loopexit40

60:                                               ; preds = %57
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7leveldb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %62 = getelementptr inbounds i8, ptr %.0, i64 %59
  %63 = sub i64 %.028, %59
  %64 = call noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %65 = icmp ne i64 %63, 0
  %66 = select i1 %64, i1 %65, i1 false
  br i1 %66, label %37, label %.loopexit45, !llvm.loop !14

.loopexit40:                                      ; preds = %57
  %lpad.loopexit42 = landingpad { ptr, i32 }
          cleanup
  br label %67

.loopexit.split-lp41:                             ; preds = %27
  %lpad.loopexit.split-lp43 = landingpad { ptr, i32 }
          cleanup
  br label %67

67:                                               ; preds = %.loopexit.split-lp41, %.loopexit40
  %lpad.phi44 = phi { ptr, i32 } [ %lpad.loopexit42, %.loopexit40 ], [ %lpad.loopexit.split-lp43, %.loopexit.split-lp41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %68

68:                                               ; preds = %67, %51
  %.pn = phi { ptr, i32 } [ %lpad.phi44, %67 ], [ %lpad.phi, %51 ]
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  resume { ptr, i32 } %.pn

.loopexit45:                                      ; preds = %60, %30
  ret void
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Writer18EmitPhysicalRecordENS0_10RecordTypeEPKcm(ptr dead_on_unwind noalias writable sret(%"class.leveldb::Status") align 8, ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7leveldb6StatusaSEOS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!6, !10, i64 8}
!6 = !{!"_ZTSN7leveldb3log6WriterE", !7, i64 0, !10, i64 8, !8, i64 12}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !9, i64 0}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass