// File: /workspace/github_cpp_makefile_star2_O1/adamnovak[P]rlcsa/bits/rlevector.cpp
// Function: CSA::RLEVector::Iterator::valueLoop(unsigned int)
void
RLEVector::Iterator::valueLoop(usint value)
{
  this->getSample(this->sampleForValue(value));
  this->run = 0;

  if(this->val >= value) { return; }
  while(this->cur < this->block_items)
  {
    this->val += this->buffer.readDeltaCode();
    this->cur++;
    this->run = this->buffer.readDeltaCode() - 1;
    if(this->val >= value) { break; }

    this->cur += this->run;
    this->val += this->run;
    if(this->val >= value)
    {
      this->run = this->val - value;
      this->val = value;
      this->cur -= this->run;
      break;
    }
    this->run = 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x12226
movq %rbx, %rdi
movl %eax, %esi
callq 0x130d8
movl $0x0, 0x1c(%rbx)
cmpl %ebp, 0x18(%rbx)
jae 0x13681
movl 0x14(%rbx), %esi
movl 0x20(%rbx), %edi
cmpl %edi, %esi
jae 0x13681
movl 0x18(%rbx), %r8d
movq 0x28(%rbx), %r9
movl 0x44(%rbx), %eax
movl 0x40(%rbx), %r10d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
decl %ecx
movl %ecx, 0x44(%rbx)
movl %r10d, %eax
movl (%r9,%rax,4), %r11d
je 0x13466
movl %ecx, %eax
jmp 0x13479
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
incl %edx
btl %ecx, %r11d
jae 0x13452
movl $0x1, %r14d
movl %edx, %ecx
shll %cl, %r14d
xorl %r11d, %r11d
cmpl %edx, %eax
ja 0x134be
subl %eax, %edx
movl %r10d, %ecx
movl (%r9,%rcx,4), %r11d
negb %al
movl %eax, %ecx
shll %cl, %r11d
shrl %cl, %r11d
movl %edx, %ecx
shll %cl, %r11d
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
movl %r10d, %r15d
testl %edx, %edx
je 0x134e0
subl %edx, %eax
movl %eax, 0x44(%rbx)
movl (%r9,%r15,4), %r12d
movl %eax, %ecx
shrl %cl, %r12d
negb %dl
movl %edx, %ecx
shll %cl, %r12d
shrl %cl, %r12d
orl %r12d, %r11d
orl %r14d, %r11d
decl %r11d
xorl %r14d, %r14d
movl %r11d, %edx
subl %eax, %edx
jae 0x134f5
movl %r11d, %edx
jmp 0x1351b
movl (%r9,%r15,4), %r14d
negb %al
movl %eax, %ecx
shll %cl, %r14d
shrl %cl, %r14d
movl %edx, %ecx
shll %cl, %r14d
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
testl %edx, %edx
je 0x1353d
subl %edx, %eax
movl %eax, 0x44(%rbx)
movl %r10d, %ecx
movl (%r9,%rcx,4), %r15d
movl %eax, %ecx
shrl %cl, %r15d
negb %dl
movl %edx, %ecx
shll %cl, %r15d
shrl %cl, %r15d
orl %r15d, %r14d
btsl %r11d, %r14d
addl %r14d, %r8d
movl %r8d, 0x18(%rbx)
leal 0x1(%rsi), %ecx
movl %ecx, 0x14(%rbx)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
decl %ecx
movl %ecx, 0x44(%rbx)
movl %r10d, %eax
movl (%r9,%rax,4), %r11d
je 0x13567
movl %ecx, %eax
jmp 0x1357a
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
incl %edx
btl %ecx, %r11d
jae 0x13553
movl $0x1, %r14d
movl %edx, %ecx
shll %cl, %r14d
xorl %r11d, %r11d
cmpl %edx, %eax
ja 0x135bf
subl %eax, %edx
movl %r10d, %ecx
movl (%r9,%rcx,4), %r11d
negb %al
movl %eax, %ecx
shll %cl, %r11d
shrl %cl, %r11d
movl %edx, %ecx
shll %cl, %r11d
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
movl %r10d, %r15d
testl %edx, %edx
je 0x135e1
subl %edx, %eax
movl %eax, 0x44(%rbx)
movl (%r9,%r15,4), %r12d
movl %eax, %ecx
shrl %cl, %r12d
negb %dl
movl %edx, %ecx
shll %cl, %r12d
shrl %cl, %r12d
orl %r12d, %r11d
orl %r14d, %r11d
decl %r11d
xorl %r14d, %r14d
movl %r11d, %edx
subl %eax, %edx
jae 0x135f6
movl %r11d, %edx
jmp 0x1361c
movl (%r9,%r15,4), %r14d
negb %al
movl %eax, %ecx
shll %cl, %r14d
shrl %cl, %r14d
movl %edx, %ecx
shll %cl, %r14d
incl %r10d
movl %r10d, 0x40(%rbx)
movl $0x20, 0x44(%rbx)
movl $0x20, %eax
testl %edx, %edx
je 0x13641
subl %edx, %eax
movl %eax, 0x44(%rbx)
movl %r10d, %ecx
movl (%r9,%rcx,4), %r15d
movl %eax, %ecx
shrl %cl, %r15d
negb %dl
movl %edx, %ecx
shll %cl, %r15d
shrl %cl, %r15d
orl %r14d, %r15d
movl %r15d, %r14d
btsl %r11d, %r14d
leal -0x1(%r14), %ecx
movl %ecx, 0x1c(%rbx)
cmpl %ebp, %r8d
jae 0x13681
addl %r14d, %esi
movl %esi, 0x14(%rbx)
addl %ecx, %r8d
movl %r8d, 0x18(%rbx)
movl %r8d, %ecx
subl %ebp, %ecx
jae 0x13676
movl $0x0, 0x1c(%rbx)
cmpl %edi, %esi
jb 0x1344d
jmp 0x13681
movl %ecx, 0x1c(%rbx)
movl %ebp, 0x18(%rbx)
subl %ecx, %esi
movl %esi, 0x14(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq