// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/libraries/libwebp/src/dec/tree_dec.c
// Function: ParseIntraMode
static void ParseIntraMode(VP8BitReader* const br,
                           VP8Decoder* const dec, int mb_x) {
  uint8_t* const top = dec->intra_t_ + 4 * mb_x;
  uint8_t* const left = dec->intra_l_;
  VP8MBData* const block = dec->mb_data_ + mb_x;

  // Note: we don't save segment map (yet), as we don't expect
  // to decode more than 1 keyframe.
  if (dec->segment_hdr_.update_map_) {
    // Hardcoded tree parsing
    block->segment_ = !VP8GetBit(br, dec->proba_.segments_[0], "segments")
                    ?  VP8GetBit(br, dec->proba_.segments_[1], "segments")
                    :  VP8GetBit(br, dec->proba_.segments_[2], "segments") + 2;
  } else {
    block->segment_ = 0;  // default for intra
  }
  if (dec->use_skip_proba_) block->skip_ = VP8GetBit(br, dec->skip_p_, "skip");

  block->is_i4x4_ = !VP8GetBit(br, 145, "block-size");
  if (!block->is_i4x4_) {
    // Hardcoded 16x16 intra-mode decision tree.
    const int ymode =
        VP8GetBit(br, 156, "pred-modes") ?
            (VP8GetBit(br, 128, "pred-modes") ? TM_PRED : H_PRED) :
            (VP8GetBit(br, 163, "pred-modes") ? V_PRED : DC_PRED);
    block->imodes_[0] = ymode;
    memset(top, ymode, 4 * sizeof(*top));
    memset(left, ymode, 4 * sizeof(*left));
  } else {
    uint8_t* modes = block->imodes_;
    int y;
    for (y = 0; y < 4; ++y) {
      int ymode = left[y];
      int x;
      for (x = 0; x < 4; ++x) {
        const uint8_t* const prob = kBModesProba[top[x]][ymode];
#if (USE_GENERIC_TREE == 1)
        // Generic tree-parsing
        int i = kYModesIntra4[VP8GetBit(br, prob[0], "pred-modes")];
        while (i > 0) {
          i = kYModesIntra4[2 * i + VP8GetBit(br, prob[i], "pred-modes")];
        }
        ymode = -i;
#else
        // Hardcoded tree parsing
        ymode = !VP8GetBit(br, prob[0], "pred-modes") ? B_DC_PRED :
                  !VP8GetBit(br, prob[1], "pred-modes") ? B_TM_PRED :
                    !VP8GetBit(br, prob[2], "pred-modes") ? B_VE_PRED :
                      !VP8GetBit(br, prob[3], "pred-modes") ?
                        (!VP8GetBit(br, prob[4], "pred-modes") ? B_HE_PRED :
                          (!VP8GetBit(br, prob[5], "pred-modes") ? B_RD_PRED
                                                                 : B_VR_PRED)) :
                        (!VP8GetBit(br, prob[6], "pred-modes") ? B_LD_PRED :
                          (!VP8GetBit(br, prob[7], "pred-modes") ? B_VL_PRED :
                            (!VP8GetBit(br, prob[8], "pred-modes") ? B_HD_PRED
                                                                   : B_HU_PRED))
                        );
#endif  // USE_GENERIC_TREE
        top[x] = ymode;
      }
      memcpy(modes, top, 4 * sizeof(*top));
      modes += 4;
      left[y] = ymode;
    }
  }
  // Hardcoded UVMode decision tree
  block->uvmode_ = !VP8GetBit(br, 142, "pred-modes-uv") ? DC_PRED
                 : !VP8GetBit(br, 114, "pred-modes-uv") ? V_PRED
                 : VP8GetBit(br, 183, "pred-modes-uv") ? TM_PRED : H_PRED;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0xaf8(%rax), %rax
movl -0x14(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0xb00, %rax            # imm = 0xB00
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0xb60(%rax), %rax
movslq -0x14(%rbp), %rcx
imulq $0x320, %rcx, %rcx      # imm = 0x320
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x88(%rax)
je 0x185583
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x4a8(%rax), %esi
callq 0x185a50
cmpl $0x0, %eax
jne 0x185558
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x4a9(%rax), %esi
callq 0x185a50
movl %eax, -0x60(%rbp)
jmp 0x185572
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x4aa(%rax), %esi
callq 0x185a50
addl $0x2, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x31e(%rax)
jmp 0x18558e
movq -0x30(%rbp), %rax
movb $0x0, 0x31e(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xaf0(%rax)
je 0x1855bb
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0xaf4(%rax), %esi
callq 0x185a50
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x31d(%rax)
movq -0x8(%rbp), %rdi
movl $0x91, %esi
callq 0x185a50
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x300(%rax)
movq -0x30(%rbp), %rax
cmpb $0x0, 0x300(%rax)
jne 0x18568d
movq -0x8(%rbp), %rdi
movl $0x9c, %esi
callq 0x185a50
cmpl $0x0, %eax
je 0x18562b
movq -0x8(%rbp), %rdi
movl $0x80, %esi
callq 0x185a50
movl %eax, %edx
movl $0x3, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x64(%rbp)
jmp 0x18564b
movq -0x8(%rbp), %rdi
movl $0xa3, %esi
callq 0x185a50
movl %eax, %edx
xorl %eax, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x301(%rax)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %eax
movl $0x4, %edx
movzbl %al, %esi
callq 0x5a200
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %eax
movl $0x4, %edx
movzbl %al, %esi
callq 0x5a200
jmp 0x1857b3
movq -0x30(%rbp), %rax
addq $0x301, %rax            # imm = 0x301
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
cmpl $0x4, -0x44(%rbp)
jge 0x1857b1
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
cmpl $0x4, -0x4c(%rbp)
jge 0x18577b
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x3d15f(%rip), %rax     # 0x1c2840
imulq $0x5a, %rcx, %rcx
addq %rcx, %rax
movslq -0x48(%rbp), %rcx
imulq $0x9, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movzbl (%rax), %esi
callq 0x185a50
movslq %eax, %rcx
leaq 0x3d4bf(%rip), %rax     # 0x1c2bd0
movsbl (%rax,%rcx), %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x185755
movl -0x5c(%rbp), %eax
shll %eax
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movzbl (%rax,%rcx), %esi
callq 0x185a50
movl %eax, %ecx
movl -0x68(%rbp), %eax
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x3d484(%rip), %rax     # 0x1c2bd0
movsbl (%rax,%rcx), %eax
movl %eax, -0x5c(%rbp)
jmp 0x185718
xorl %eax, %eax
subl -0x5c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movb %al, %dl
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1856c2
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movl -0x48(%rbp), %eax
movb %al, %dl
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1856a2
jmp 0x1857b3
movq -0x8(%rbp), %rdi
movl $0x8e, %esi
callq 0x185a50
cmpl $0x0, %eax
jne 0x1857cd
xorl %eax, %eax
movl %eax, -0x6c(%rbp)
jmp 0x185813
movq -0x8(%rbp), %rdi
movl $0x72, %esi
callq 0x185a50
cmpl $0x0, %eax
jne 0x1857ea
movl $0x2, %eax
movl %eax, -0x70(%rbp)
jmp 0x18580d
movq -0x8(%rbp), %rdi
movl $0xb7, %esi
callq 0x185a50
movl %eax, %edx
movl $0x3, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x311(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)