; LLVM IR from nsccgz-storage/nvlsm :: db/log_reader.ll (ZN7leveldb3log6Reader18ReadPhysicalRecordEPNS_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::Reader" = type <{ ptr, ptr, i8, [7 x i8], ptr, %"class.leveldb::Slice", i8, [7 x i8], i64, i64, i64, i8, [7 x i8] }>

@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Reader10ReportDropEmRKNS_6StatusE(ptr noundef nonnull align 8 dereferenceable(81), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; 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 void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7leveldb3log6Reader18ReadPhysicalRecordEPNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(81) %0, ptr noundef %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.leveldb::Status", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca %"class.leveldb::Slice", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8
  br label %21

21:                                               ; preds = %65, %2
  %22 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %23 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = icmp ult i64 %23, 7
  br i1 %24, label %25, label %69

25:                                               ; preds = %21
  %26 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 6
  %27 = load i8, ptr %26, align 8, !tbaa !9, !range !14, !noundef !15
  %28 = trunc i8 %27 to i1
  br i1 %28, label %67, label %29

29:                                               ; preds = %25
  %30 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %31 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %34 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 4
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = load ptr, ptr %32, align 8, !tbaa !18
  %37 = getelementptr inbounds ptr, ptr %36, i64 2
  %38 = load ptr, ptr %37, align 8
  call void %38(ptr dead_on_unwind writable sret(%"class.leveldb::Status") align 8 %6, ptr noundef nonnull align 8 dereferenceable(8) %32, i64 noundef 32768, ptr noundef %33, ptr noundef %35)
  %39 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %40 = invoke noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %39)
          to label %41 unwind label %52

41:                                               ; preds = %29
  %42 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 9
  %43 = load i64, ptr %42, align 8, !tbaa !20
  %44 = add i64 %43, %40
  store i64 %44, ptr %42, align 8, !tbaa !20
  %45 = invoke noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %46 unwind label %52

46:                                               ; preds = %41
  br i1 %45, label %56, label %47

47:                                               ; preds = %46
  %48 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  invoke void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %48)
          to label %49 unwind label %52

49:                                               ; preds = %47
  invoke void @_ZN7leveldb3log6Reader10ReportDropEmRKNS_6StatusE(ptr noundef nonnull align 8 dereferenceable(81) %20, i64 noundef 32768, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %50 unwind label %52

50:                                               ; preds = %49
  %51 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 6
  store i8 1, ptr %51, align 8, !tbaa !9
  store i32 5, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %65

52:                                               ; preds = %56, %49, %47, %41, %29
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %7, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %8, align 4
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %170

56:                                               ; preds = %46
  %57 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %58 = invoke noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %57)
          to label %59 unwind label %52

59:                                               ; preds = %56
  %60 = icmp ult i64 %58, 32768
  br i1 %60, label %61, label %63

61:                                               ; preds = %59
  %62 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 6
  store i8 1, ptr %62, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %61, %59
  br label %64

64:                                               ; preds = %63
  store i32 2, ptr %9, align 4
  br label %65, !llvm.loop !21

65:                                               ; preds = %64, %50
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %66 = load i32, ptr %9, align 4
  switch i32 %66, label %175 [
    i32 1, label %168
    i32 2, label %21
  ]

67:                                               ; preds = %25
  %68 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %68)
  store i32 5, ptr %3, align 4
  br label %168

69:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %70 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %71 = call noundef ptr @_ZNK7leveldb5Slice4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %70)
  store ptr %71, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 4
  %74 = load i8, ptr %73, align 1, !tbaa !23
  %75 = sext i8 %74 to i32
  %76 = and i32 %75, 255
  store i32 %76, ptr %11, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds i8, ptr %77, i64 5
  %79 = load i8, ptr %78, align 1, !tbaa !23
  %80 = sext i8 %79 to i32
  %81 = and i32 %80, 255
  store i32 %81, ptr %12, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i64 6
  %84 = load i8, ptr %83, align 1, !tbaa !23
  %85 = sext i8 %84 to i32
  store i32 %85, ptr %13, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %86 = load i32, ptr %11, align 4, !tbaa !24
  %87 = load i32, ptr %12, align 4, !tbaa !24
  %88 = shl i32 %87, 8
  %89 = or i32 %86, %88
  store i32 %89, ptr %14, align 4, !tbaa !24
  %90 = load i32, ptr %14, align 4, !tbaa !24
  %91 = add i32 7, %90
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %94 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %93)
  %95 = icmp ugt i64 %92, %94
  br i1 %95, label %96, label %107

96:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %97 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %98 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %97)
  store i64 %98, ptr %15, align 8, !tbaa !26
  %99 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %99)
  %100 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 6
  %101 = load i8, ptr %100, align 8, !tbaa !9, !range !14, !noundef !15
  %102 = trunc i8 %101 to i1
  br i1 %102, label %105, label %103

103:                                              ; preds = %96
  %104 = load i64, ptr %15, align 8, !tbaa !26
  call void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81) %20, i64 noundef %104, ptr noundef @.str.6)
  store i32 6, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %106

105:                                              ; preds = %96
  store i32 5, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %106

106:                                              ; preds = %105, %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %167

107:                                              ; preds = %69
  %108 = load i32, ptr %13, align 4, !tbaa !24
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %115

110:                                              ; preds = %107
  %111 = load i32, ptr %14, align 4, !tbaa !24
  %112 = icmp eq i32 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %110
  %114 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %114)
  store i32 6, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %167

115:                                              ; preds = %110, %107
  %116 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 2
  %117 = load i8, ptr %116, align 8, !tbaa !27, !range !14, !noundef !15
  %118 = trunc i8 %117 to i1
  br i1 %118, label %119, label %141

119:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %120 = load ptr, ptr %10, align 8, !tbaa !5
  %121 = call noundef i32 @_ZN7leveldb13DecodeFixed32EPKc(ptr noundef %120)
  %122 = call noundef i32 @_ZN7leveldb6crc32c6UnmaskEj(i32 noundef %121)
  store i32 %122, ptr %16, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i64 6
  %125 = load i32, ptr %14, align 4, !tbaa !24
  %126 = add i32 1, %125
  %127 = zext i32 %126 to i64
  %128 = call noundef i32 @_ZN7leveldb6crc32c5ValueEPKcm(ptr noundef %124, i64 noundef %127)
  store i32 %128, ptr %17, align 4, !tbaa !24
  %129 = load i32, ptr %17, align 4, !tbaa !24
  %130 = load i32, ptr %16, align 4, !tbaa !24
  %131 = icmp ne i32 %129, %130
  br i1 %131, label %132, label %137

132:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %133 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %134 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %133)
  store i64 %134, ptr %18, align 8, !tbaa !26
  %135 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %135)
  %136 = load i64, ptr %18, align 8, !tbaa !26
  call void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81) %20, i64 noundef %136, ptr noundef @.str.7)
  store i32 6, ptr %3, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %138

137:                                              ; preds = %119
  store i32 0, ptr %9, align 4
  br label %138

138:                                              ; preds = %137, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %139 = load i32, ptr %9, align 4
  switch i32 %139, label %167 [
    i32 0, label %140
  ]

140:                                              ; preds = %138
  br label %141

141:                                              ; preds = %140, %115
  %142 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %143 = load i32, ptr %14, align 4, !tbaa !24
  %144 = add i32 7, %143
  %145 = zext i32 %144 to i64
  call void @_ZN7leveldb5Slice13remove_prefixEm(ptr noundef nonnull align 8 dereferenceable(16) %142, i64 noundef %145)
  %146 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 9
  %147 = load i64, ptr %146, align 8, !tbaa !20
  %148 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 5
  %149 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %148)
  %150 = sub i64 %147, %149
  %151 = sub i64 %150, 7
  %152 = load i32, ptr %14, align 4, !tbaa !24
  %153 = zext i32 %152 to i64
  %154 = sub i64 %151, %153
  %155 = getelementptr inbounds %"class.leveldb::log::Reader", ptr %20, i32 0, i32 10
  %156 = load i64, ptr %155, align 8, !tbaa !28
  %157 = icmp ult i64 %154, %156
  br i1 %157, label %158, label %160

158:                                              ; preds = %141
  %159 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %159)
  store i32 6, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %167

160:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds i8, ptr %161, i64 7
  %163 = load i32, ptr %14, align 4, !tbaa !24
  %164 = zext i32 %163 to i64
  call void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef %162, i64 noundef %164)
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %165, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !29
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  %166 = load i32, ptr %13, align 4, !tbaa !24
  store i32 %166, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %167

167:                                              ; preds = %160, %158, %138, %113, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %168

168:                                              ; preds = %167, %67, %65
  %169 = load i32, ptr %3, align 4
  ret i32 %169

170:                                              ; preds = %52
  %171 = load ptr, ptr %7, align 8
  %172 = load i32, ptr %8, align 4
  %173 = insertvalue { ptr, i32 } poison, ptr %171, 0
  %174 = insertvalue { ptr, i32 } %173, i32 %172, 1
  resume { ptr, i32 } %174

175:                                              ; preds = %65
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81), i64 noundef, ptr noundef) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7leveldb6crc32c6UnmaskEj(i32 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7leveldb13DecodeFixed32EPKc(ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN7leveldb6crc32c5ValueEPKcm(ptr noundef, i64 noundef) #5

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

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

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 nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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++ TBAA"}
!9 = !{!10, !11, i64 48}
!10 = !{!"_ZTSN7leveldb3log6ReaderE", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24, !12, i64 32, !11, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !11, i64 80}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN7leveldb5SliceE", !6, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!10, !6, i64 0}
!17 = !{!10, !6, i64 24}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}
!20 = !{!10, !13, i64 64}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!7, !7, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"int", !7, i64 0}
!26 = !{!13, !13, i64 0}
!27 = !{!10, !11, i64 16}
!28 = !{!10, !13, i64 72}
!29 = !{i64 0, i64 8, !5, i64 8, i64 8, !26}


; 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.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Reader10ReportDropEmRKNS_6StatusE(ptr noundef nonnull align 8 dereferenceable(81), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress 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 void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7leveldb3log6Reader18ReadPhysicalRecordEPNS_5SliceE(ptr noundef nonnull align 8 dereferenceable(81) %0, ptr noundef %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.leveldb::Status", align 8
  %4 = alloca %"class.leveldb::Slice", align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = tail call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %7 = icmp ult i64 %6, 7
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  br label %11

11:                                               ; preds = %.lr.ph, %31
  %12 = load i8, ptr %8, align 8, !tbaa !5, !range !13, !noundef !14
  %13 = trunc nuw i8 %12 to i1
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  br i1 %13, label %.loopexit, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %15 = load ptr, ptr %0, align 8, !tbaa !15
  %16 = load ptr, ptr %9, align 8, !tbaa !16
  %17 = load ptr, ptr %15, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %17, i64 16
  %19 = load ptr, ptr %18, align 8
  call void %19(ptr dead_on_unwind nonnull writable sret(%"class.leveldb::Status") align 8 %3, ptr noundef nonnull align 8 dereferenceable(8) %15, i64 noundef 32768, ptr noundef nonnull %5, ptr noundef %16)
  %20 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %21 = load i64, ptr %10, align 8, !tbaa !19
  %22 = add i64 %21, %20
  store i64 %22, ptr %10, align 8, !tbaa !19
  %23 = call noundef zeroext i1 @_ZNK7leveldb6Status2okEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  br i1 %23, label %27, label %24

24:                                               ; preds = %14
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  invoke void @_ZN7leveldb3log6Reader10ReportDropEmRKNS_6StatusE(ptr noundef nonnull align 8 dereferenceable(81) %0, i64 noundef 32768, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %.thread unwind label %25

.thread:                                          ; preds = %24
  store i8 1, ptr %8, align 8, !tbaa !5
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %.loopexit

25:                                               ; preds = %24
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  resume { ptr, i32 } %26

27:                                               ; preds = %14
  %28 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %29 = icmp ult i64 %28, 32768
  br i1 %29, label %30, label %31, !llvm.loop !20

30:                                               ; preds = %27
  store i8 1, ptr %8, align 8, !tbaa !5
  br label %31, !llvm.loop !20

31:                                               ; preds = %30, %27
  call void @_ZN7leveldb6StatusD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %32 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %33 = icmp ult i64 %32, 7
  br i1 %33, label %11, label %._crit_edge

._crit_edge:                                      ; preds = %31, %2
  %34 = call noundef ptr @_ZNK7leveldb5Slice4dataEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i8, ptr %35, align 1, !tbaa !22
  %37 = zext i8 %36 to i32
  %38 = getelementptr inbounds i8, ptr %34, i64 5
  %39 = load i8, ptr %38, align 1, !tbaa !22
  %40 = zext i8 %39 to i32
  %41 = getelementptr inbounds i8, ptr %34, i64 6
  %42 = load i8, ptr %41, align 1, !tbaa !22
  %43 = sext i8 %42 to i32
  %44 = shl nuw nsw i32 %40, 8
  %45 = or disjoint i32 %44, %37
  %46 = add nuw nsw i32 %45, 7
  %47 = zext nneg i32 %46 to i64
  %48 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %49 = icmp ult i64 %48, %47
  br i1 %49, label %50, label %56

50:                                               ; preds = %._crit_edge
  %51 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %52 = getelementptr inbounds i8, ptr %0, i64 48
  %53 = load i8, ptr %52, align 8, !tbaa !5, !range !13, !noundef !14
  %54 = trunc nuw i8 %53 to i1
  br i1 %54, label %.loopexit, label %55

55:                                               ; preds = %50
  call void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81) %0, i64 noundef %51, ptr noundef nonnull @.str.6)
  br label %.loopexit

56:                                               ; preds = %._crit_edge
  %57 = icmp eq i8 %42, 0
  %58 = icmp eq i32 %45, 0
  %or.cond = select i1 %57, i1 %58, i1 false
  br i1 %or.cond, label %59, label %60

59:                                               ; preds = %56
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  br label %.loopexit

60:                                               ; preds = %56
  %61 = getelementptr inbounds i8, ptr %0, i64 16
  %62 = load i8, ptr %61, align 8, !tbaa !23, !range !13, !noundef !14
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %64, label %.thread34

64:                                               ; preds = %60
  %65 = call noundef i32 @_ZN7leveldb13DecodeFixed32EPKc(ptr noundef nonnull %34)
  %66 = call noundef i32 @_ZN7leveldb6crc32c6UnmaskEj(i32 noundef %65)
  %67 = add nuw nsw i32 %45, 1
  %68 = zext nneg i32 %67 to i64
  %69 = call noundef i32 @_ZN7leveldb6crc32c5ValueEPKcm(ptr noundef nonnull %41, i64 noundef %68)
  %.not = icmp eq i32 %69, %66
  br i1 %.not, label %.thread34, label %70

70:                                               ; preds = %64
  %71 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81) %0, i64 noundef %71, ptr noundef nonnull @.str.7)
  br label %.loopexit

.thread34:                                        ; preds = %64, %60
  call void @_ZN7leveldb5Slice13remove_prefixEm(ptr noundef nonnull align 8 dereferenceable(16) %5, i64 noundef %47)
  %72 = getelementptr inbounds i8, ptr %0, i64 64
  %73 = load i64, ptr %72, align 8, !tbaa !19
  %74 = call noundef i64 @_ZNK7leveldb5Slice4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  %75 = zext nneg i32 %45 to i64
  %76 = add i64 %73, -7
  %77 = add i64 %74, %75
  %78 = sub i64 %76, %77
  %79 = getelementptr inbounds i8, ptr %0, i64 72
  %80 = load i64, ptr %79, align 8, !tbaa !24
  %81 = icmp ult i64 %78, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %.thread34
  call void @_ZN7leveldb5Slice5clearEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  br label %.loopexit

83:                                               ; preds = %.thread34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %84 = getelementptr inbounds i8, ptr %34, i64 7
  call void @_ZN7leveldb5SliceC2EPKcm(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull %84, i64 noundef %75)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %.loopexit

.loopexit:                                        ; preds = %11, %70, %.thread, %59, %82, %83, %50, %55
  %.5 = phi i32 [ 6, %59 ], [ 6, %82 ], [ %43, %83 ], [ 6, %70 ], [ 6, %55 ], [ 5, %50 ], [ 5, %.thread ], [ 5, %11 ]
  ret i32 %.5
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7leveldb3log6Reader16ReportCorruptionEmPKc(ptr noundef nonnull align 8 dereferenceable(81), i64 noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress 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) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7leveldb6crc32c6UnmaskEj(i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7leveldb13DecodeFixed32EPKc(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZN7leveldb6crc32c5ValueEPKcm(ptr noundef, i64 noundef) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !10, i64 48}
!6 = !{!"_ZTSN7leveldb3log6ReaderE", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !10, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !10, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN7leveldb5SliceE", !7, i64 0, !12, i64 8}
!12 = !{!"long", !8, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !7, i64 24}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !9, i64 0}
!19 = !{!6, !12, i64 64}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!8, !8, i64 0}
!23 = !{!6, !10, i64 16}
!24 = !{!6, !12, i64 72}
!25 = !{i64 0, i64 8, !26, i64 8, i64 8, !27}
!26 = !{!7, !7, i64 0}
!27 = !{!12, !12, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass