// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/vp8_dec.c
// Function: ParsePartitions
static VP8StatusCode ParsePartitions(VP8Decoder* const dec,
                                     const uint8_t* buf, size_t size) {
  VP8BitReader* const br = &dec->br_;
  const uint8_t* sz = buf;
  const uint8_t* buf_end = buf + size;
  const uint8_t* part_start;
  size_t size_left = size;
  size_t last_part;
  size_t p;

  dec->num_parts_minus_one_ = (1 << VP8GetValue(br, 2, "global-header")) - 1;
  last_part = dec->num_parts_minus_one_;
  if (size < 3 * last_part) {
    // we can't even read the sizes with sz[]! That's a failure.
    return VP8_STATUS_NOT_ENOUGH_DATA;
  }
  part_start = buf + last_part * 3;
  size_left -= last_part * 3;
  for (p = 0; p < last_part; ++p) {
    size_t psize = sz[0] | (sz[1] << 8) | (sz[2] << 16);
    if (psize > size_left) psize = size_left;
    VP8InitBitReader(dec->parts_ + p, part_start, psize);
    part_start += psize;
    size_left -= psize;
    sz += 3;
  }
  VP8InitBitReader(dec->parts_ + last_part, part_start, size_left);
  if (part_start < buf_end) return VP8_STATUS_OK;
  return dec->incremental_
             ? VP8_STATUS_SUSPENDED  // Init is ok, but there's not enough data
             : VP8_STATUS_NOT_ENOUGH_DATA;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
movl $0x2, %esi
callq 0x181ef0
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
subl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1b0(%rax)
movq -0x10(%rbp), %rax
movl 0x1b0(%rax), %eax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
imulq $0x3, -0x50(%rbp), %rcx
cmpq %rcx, %rax
jae 0x14319a
movl $0x7, -0x4(%rbp)
jmp 0x1432ae
movq -0x18(%rbp), %rax
imulq $0x3, -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
imulq $0x3, -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x143261
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
movq -0x30(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x30(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
cltq
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jbe 0x143209
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
addq $0x1b8, %rdi            # imm = 0x1B8
imulq $0x30, -0x58(%rbp), %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x181c20
movq -0x60(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x1431c2
movq -0x10(%rbp), %rdi
addq $0x1b8, %rdi            # imm = 0x1B8
imulq $0x30, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x181c20
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x143294
movl $0x0, -0x4(%rbp)
jmp 0x1432ae
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
movl $0x7, %eax
movl $0x5, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)