; LLVM IR from pixelsdb/mini-pixels :: pixels-core/lib/encoding/RunLenIntEncoder.ll (ZN16RunLenIntEncoder16writeDeltaValuesEv)

; 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.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%class.RunLenIntEncoder = type { i32, i32, i32, i32, i8, i8, i64, i64, i32, i8, i32, i32, i32, ptr, i32, i32, i32, i32, i32, i64, ptr, ptr, ptr, ptr, %class.EncodingUtils, %"class.std::shared_ptr" }
%class.EncodingUtils = type { ptr, ptr }

@_ZN9Constants10MIN_REPEATE = external global i32, align 4

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16RunLenIntEncoder16writeDeltaValuesEv(ptr noundef nonnull align 8 dereferenceable(168) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::shared_ptr", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::shared_ptr", align 8
  %13 = alloca %"class.std::shared_ptr", align 8
  %14 = alloca %"class.std::shared_ptr", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %16 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 8
  %17 = load i32, ptr %16, align 8, !tbaa !9
  store i32 %17, ptr %4, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !19
  %18 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 5
  %19 = load i8, ptr %18, align 1, !tbaa !20, !range !21, !noundef !22
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %24

21:                                               ; preds = %1
  %22 = load i32, ptr %4, align 4, !tbaa !19
  %23 = call noundef i32 @_ZN16RunLenIntEncoder26getClosestAlignedFixedBitsEi(ptr noundef nonnull align 8 dereferenceable(168) %15, i32 noundef %22)
  store i32 %23, ptr %4, align 4, !tbaa !19
  br label %24

24:                                               ; preds = %21, %1
  %25 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 9
  %26 = load i8, ptr %25, align 4, !tbaa !23, !range !21, !noundef !22
  %27 = trunc i8 %26 to i1
  br i1 %27, label %28, label %44

28:                                               ; preds = %24
  %29 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !24
  %31 = load i32, ptr @_ZN9Constants10MIN_REPEATE, align 4, !tbaa !19
  %32 = icmp sgt i32 %30, %31
  br i1 %32, label %33, label %38

33:                                               ; preds = %28
  %34 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 2
  %35 = load i32, ptr %34, align 8, !tbaa !24
  %36 = sub nsw i32 %35, 1
  store i32 %36, ptr %3, align 4, !tbaa !19
  %37 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 2
  store i32 0, ptr %37, align 8, !tbaa !24
  br label %43

38:                                               ; preds = %28
  %39 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 3
  %40 = load i32, ptr %39, align 4, !tbaa !25
  %41 = sub nsw i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !19
  %42 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 3
  store i32 0, ptr %42, align 4, !tbaa !25
  br label %43

43:                                               ; preds = %38, %33
  br label %58

44:                                               ; preds = %24
  %45 = load i32, ptr %4, align 4, !tbaa !19
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  store i32 2, ptr %4, align 4, !tbaa !19
  br label %48

48:                                               ; preds = %47, %44
  %49 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 24
  %50 = load i32, ptr %4, align 4, !tbaa !19
  %51 = call noundef i32 @_ZN13EncodingUtils14encodeBitWidthEi(ptr noundef nonnull align 8 dereferenceable(16) %49, i32 noundef %50)
  store i32 %51, ptr %5, align 4, !tbaa !19
  %52 = load i32, ptr %5, align 4, !tbaa !19
  %53 = shl i32 %52, 1
  store i32 %53, ptr %5, align 4, !tbaa !19
  %54 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 3
  %55 = load i32, ptr %54, align 4, !tbaa !25
  %56 = sub nsw i32 %55, 1
  store i32 %56, ptr %3, align 4, !tbaa !19
  %57 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 3
  store i32 0, ptr %57, align 4, !tbaa !25
  br label %58

58:                                               ; preds = %48, %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %59 = load i32, ptr %3, align 4, !tbaa !19
  %60 = and i32 %59, 256
  %61 = lshr i32 %60, 8
  store i32 %61, ptr %6, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %62 = call noundef i32 @_ZN16RunLenIntEncoder9getOpcodeEv(ptr noundef nonnull align 8 dereferenceable(168) %15)
  %63 = load i32, ptr %5, align 4, !tbaa !19
  %64 = or i32 %62, %63
  %65 = load i32, ptr %6, align 4, !tbaa !19
  %66 = or i32 %64, %65
  store i32 %66, ptr %7, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %67 = load i32, ptr %3, align 4, !tbaa !19
  %68 = and i32 %67, 255
  store i32 %68, ptr %8, align 4, !tbaa !19
  %69 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  %70 = call noundef ptr @_ZNKSt19__shared_ptr_accessI10ByteBufferLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %69) #4
  %71 = load i32, ptr %7, align 4, !tbaa !19
  %72 = trunc i32 %71 to i8
  call void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62) %70, i8 noundef zeroext %72)
  %73 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  %74 = call noundef ptr @_ZNKSt19__shared_ptr_accessI10ByteBufferLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %73) #4
  %75 = load i32, ptr %8, align 4, !tbaa !19
  %76 = trunc i32 %75 to i8
  call void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62) %74, i8 noundef zeroext %76)
  %77 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 4
  %78 = load i8, ptr %77, align 8, !tbaa !26, !range !21, !noundef !22
  %79 = trunc i8 %78 to i1
  br i1 %79, label %80, label %91

80:                                               ; preds = %58
  %81 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %81) #4
  %82 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 20
  %83 = load ptr, ptr %82, align 8, !tbaa !27
  %84 = getelementptr inbounds i64, ptr %83, i64 0
  %85 = load i64, ptr %84, align 8, !tbaa !28
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef %9, i64 noundef %85)
          to label %86 unwind label %87

86:                                               ; preds = %80
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %102

87:                                               ; preds = %80
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %10, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %11, align 4
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %133

91:                                               ; preds = %58
  %92 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %92) #4
  %93 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 20
  %94 = load ptr, ptr %93, align 8, !tbaa !27
  %95 = getelementptr inbounds i64, ptr %94, i64 0
  %96 = load i64, ptr %95, align 8, !tbaa !28
  invoke void @_ZN16RunLenIntEncoder11writeVulongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef %12, i64 noundef %96)
          to label %97 unwind label %98

97:                                               ; preds = %91
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  br label %102

98:                                               ; preds = %91
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %10, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %11, align 4
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  br label %133

102:                                              ; preds = %97, %86
  %103 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 9
  %104 = load i8, ptr %103, align 4, !tbaa !23, !range !21, !noundef !22
  %105 = trunc i8 %104 to i1
  br i1 %105, label %106, label %115

106:                                              ; preds = %102
  %107 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %107) #4
  %108 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 7
  %109 = load i64, ptr %108, align 8, !tbaa !29
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef %13, i64 noundef %109)
          to label %110 unwind label %111

110:                                              ; preds = %106
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  br label %132

111:                                              ; preds = %106
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %10, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %11, align 4
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #4
  br label %133

115:                                              ; preds = %102
  %116 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 25
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %116) #4
  %117 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 23
  %118 = load ptr, ptr %117, align 8, !tbaa !30
  %119 = getelementptr inbounds i64, ptr %118, i64 0
  %120 = load i64, ptr %119, align 8, !tbaa !28
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef %14, i64 noundef %120)
          to label %121 unwind label %128

121:                                              ; preds = %115
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #4
  %122 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 23
  %123 = load ptr, ptr %122, align 8, !tbaa !30
  %124 = getelementptr inbounds %class.RunLenIntEncoder, ptr %15, i32 0, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !31
  %126 = sub nsw i32 %125, 2
  %127 = load i32, ptr %4, align 4, !tbaa !19
  call void @_ZN16RunLenIntEncoder9writeIntsEPliii(ptr noundef nonnull align 8 dereferenceable(168) %15, ptr noundef %123, i32 noundef 1, i32 noundef %126, i32 noundef %127)
  br label %132

128:                                              ; preds = %115
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %10, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %11, align 4
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #4
  br label %133

132:                                              ; preds = %121, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void

133:                                              ; preds = %128, %111, %98, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr %10, align 8
  %136 = load i32, ptr %11, align 4
  %137 = insertvalue { ptr, i32 } poison, ptr %135, 0
  %138 = insertvalue { ptr, i32 } %137, i32 %136, 1
  resume { ptr, i32 } %138
}

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

declare void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62), i8 noundef zeroext) #3

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

declare noundef i32 @_ZN13EncodingUtils14encodeBitWidthEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16RunLenIntEncoder9writeIntsEPliii(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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, !12, i64 40}
!10 = !{!"_ZTS16RunLenIntEncoder", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !13, i64 16, !13, i64 17, !14, i64 24, !14, i64 32, !12, i64 40, !13, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !14, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !15, i64 136, !16, i64 152}
!11 = !{!"_ZTSN16RunLenIntEncoder12EncodingTypeE", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTS13EncodingUtils", !6, i64 0, !6, i64 8}
!16 = !{!"_ZTSSt10shared_ptrI10ByteBufferE", !17, i64 0}
!17 = !{!"_ZTSSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !18, i64 8}
!18 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!19 = !{!12, !12, i64 0}
!20 = !{!10, !13, i64 17}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!10, !13, i64 44}
!24 = !{!10, !12, i64 8}
!25 = !{!10, !12, i64 12}
!26 = !{!10, !13, i64 16}
!27 = !{!10, !6, i64 104}
!28 = !{!14, !14, i64 0}
!29 = !{!10, !14, i64 32}
!30 = !{!10, !6, i64 128}
!31 = !{!10, !12, i64 4}


; 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.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@_ZN9Constants10MIN_REPEATE = external local_unnamed_addr global i32, align 4

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16RunLenIntEncoder16writeDeltaValuesEv(ptr noundef nonnull align 8 dereferenceable(168) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::shared_ptr", align 8
  %3 = alloca %"class.std::shared_ptr", align 8
  %4 = alloca %"class.std::shared_ptr", align 8
  %5 = alloca %"class.std::shared_ptr", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 17
  %9 = load i8, ptr %8, align 1, !tbaa !18, !range !19, !noundef !20
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %11, label %13

11:                                               ; preds = %1
  %12 = tail call noundef i32 @_ZN16RunLenIntEncoder26getClosestAlignedFixedBitsEi(ptr noundef nonnull align 8 dereferenceable(168) %0, i32 noundef %7)
  br label %13

13:                                               ; preds = %11, %1
  %.015 = phi i32 [ %12, %11 ], [ %7, %1 ]
  %14 = getelementptr inbounds i8, ptr %0, i64 44
  %15 = load i8, ptr %14, align 4, !tbaa !21, !range !19, !noundef !20
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %17, label %26

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !22
  %20 = load i32, ptr @_ZN9Constants10MIN_REPEATE, align 4, !tbaa !23
  %21 = icmp sgt i32 %19, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  store i32 0, ptr %18, align 8, !tbaa !22
  br label %33

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !24
  store i32 0, ptr %24, align 4, !tbaa !24
  br label %33

26:                                               ; preds = %13
  %27 = icmp eq i32 %.015, 1
  %spec.store.select = select i1 %27, i32 2, i32 %.015
  %28 = getelementptr inbounds i8, ptr %0, i64 136
  %29 = tail call noundef i32 @_ZN13EncodingUtils14encodeBitWidthEi(ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef %spec.store.select)
  %30 = shl i32 %29, 1
  %31 = getelementptr inbounds i8, ptr %0, i64 12
  %32 = load i32, ptr %31, align 4, !tbaa !24
  store i32 0, ptr %31, align 4, !tbaa !24
  br label %33

33:                                               ; preds = %22, %23, %26
  %.016 = phi i32 [ 0, %22 ], [ 0, %23 ], [ %30, %26 ]
  %.1 = phi i32 [ %.015, %22 ], [ %.015, %23 ], [ %spec.store.select, %26 ]
  %.014.in = phi i32 [ %19, %22 ], [ %25, %23 ], [ %32, %26 ]
  %.014 = add nsw i32 %.014.in, -1
  %34 = lshr i32 %.014, 8
  %35 = and i32 %34, 1
  %36 = tail call noundef i32 @_ZN16RunLenIntEncoder9getOpcodeEv(ptr noundef nonnull align 8 dereferenceable(168) %0)
  %37 = or i32 %36, %.016
  %38 = or i32 %37, %35
  %39 = getelementptr inbounds i8, ptr %0, i64 152
  %40 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessI10ByteBufferLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %39) #3
  %41 = trunc i32 %38 to i8
  tail call void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62) %40, i8 noundef zeroext %41)
  %42 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessI10ByteBufferLN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %39) #3
  %43 = trunc i32 %.014 to i8
  tail call void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62) %42, i8 noundef zeroext %43)
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  %45 = load i8, ptr %44, align 8, !tbaa !25, !range !19, !noundef !20
  %46 = trunc nuw i8 %45 to i1
  %47 = getelementptr inbounds i8, ptr %0, i64 104
  br i1 %46, label %48, label %53

48:                                               ; preds = %33
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %39) #3
  %49 = load ptr, ptr %47, align 8, !tbaa !26
  %50 = load i64, ptr %49, align 8, !tbaa !27
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull %2, i64 noundef %50)
          to label %58 unwind label %51

51:                                               ; preds = %48
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %79

53:                                               ; preds = %33
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %39) #3
  %54 = load ptr, ptr %47, align 8, !tbaa !26
  %55 = load i64, ptr %54, align 8, !tbaa !27
  invoke void @_ZN16RunLenIntEncoder11writeVulongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull %3, i64 noundef %55)
          to label %58 unwind label %56

56:                                               ; preds = %53
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %79

58:                                               ; preds = %53, %48
  %.sink = phi ptr [ %2, %48 ], [ %3, %53 ]
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %.sink) #3
  %59 = load i8, ptr %14, align 4, !tbaa !21, !range !19, !noundef !20
  %60 = trunc nuw i8 %59 to i1
  br i1 %60, label %61, label %67

61:                                               ; preds = %58
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %39) #3
  %62 = getelementptr inbounds i8, ptr %0, i64 32
  %63 = load i64, ptr %62, align 8, !tbaa !28
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull %4, i64 noundef %63)
          to label %64 unwind label %65

64:                                               ; preds = %61
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #3
  br label %78

65:                                               ; preds = %61
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %79

67:                                               ; preds = %58
  call void @_ZNSt10shared_ptrI10ByteBufferEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %39) #3
  %68 = getelementptr inbounds i8, ptr %0, i64 128
  %69 = load ptr, ptr %68, align 8, !tbaa !29
  %70 = load i64, ptr %69, align 8, !tbaa !27
  invoke void @_ZN16RunLenIntEncoder11writeVslongESt10shared_ptrI10ByteBufferEl(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull %5, i64 noundef %70)
          to label %71 unwind label %76

71:                                               ; preds = %67
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #3
  %72 = load ptr, ptr %68, align 8, !tbaa !29
  %73 = getelementptr inbounds i8, ptr %0, i64 4
  %74 = load i32, ptr %73, align 4, !tbaa !30
  %75 = add nsw i32 %74, -2
  call void @_ZN16RunLenIntEncoder9writeIntsEPliii(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef %72, i32 noundef 1, i32 noundef %75, i32 noundef %.1)
  br label %78

76:                                               ; preds = %67
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %79

78:                                               ; preds = %71, %64
  ret void

79:                                               ; preds = %76, %65, %56, %51
  %.sink19 = phi ptr [ %5, %76 ], [ %4, %65 ], [ %3, %56 ], [ %2, %51 ]
  %.pn = phi { ptr, i32 } [ %77, %76 ], [ %66, %65 ], [ %57, %56 ], [ %52, %51 ]
  call void @_ZNSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %.sink19) #3
  resume { ptr, i32 } %.pn
}

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

declare void @_ZN10ByteBuffer3putEh(ptr noundef nonnull align 8 dereferenceable(62), i8 noundef zeroext) local_unnamed_addr #2

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

declare noundef i32 @_ZN13EncodingUtils14encodeBitWidthEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN16RunLenIntEncoder9writeIntsEPliii(ptr noundef nonnull align 8 dereferenceable(168), ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

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

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

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!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 40}
!6 = !{!"_ZTS16RunLenIntEncoder", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !11, i64 16, !11, i64 17, !12, i64 24, !12, i64 32, !10, i64 40, !11, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !12, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !14, i64 136, !15, i64 152}
!7 = !{!"_ZTSN16RunLenIntEncoder12EncodingTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"_ZTS13EncodingUtils", !13, i64 0, !13, i64 8}
!15 = !{!"_ZTSSt10shared_ptrI10ByteBufferE", !16, i64 0}
!16 = !{!"_ZTSSt12__shared_ptrI10ByteBufferLN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0}
!18 = !{!6, !11, i64 17}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!6, !11, i64 44}
!22 = !{!6, !10, i64 8}
!23 = !{!10, !10, i64 0}
!24 = !{!6, !10, i64 12}
!25 = !{!6, !11, i64 16}
!26 = !{!6, !13, i64 104}
!27 = !{!12, !12, i64 0}
!28 = !{!6, !12, i64 32}
!29 = !{!6, !13, i64 128}
!30 = !{!6, !10, i64 4}


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