// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdphuff.c
// Function: decode_mcu_DC_first
METHODDEF(jboolean)
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{   
  phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
  int Al = cinfo->Al;
  register int s, r;
  int blkn, ci;
  JBLOCKROW block;
  BITREAD_STATE_VARS;
  savable_state state;
  d_derived_tbl * tbl;
  jpeg_component_info * compptr;

  /* Process restart marker if needed; may have to suspend */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0)
      if (! process_restart(cinfo))
	return FALSE;
  }

  /* If we've run out of data, just leave the MCU set to zeroes.
   * This way, we return uniform gray for the remainder of the segment.
   */
  if (! entropy->pub.insufficient_data) {

    /* Load up working state */
    BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(state, entropy->saved);

    /* Outer loop handles each block in the MCU */

    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
      block = MCU_data[blkn];
      ci = cinfo->MCU_membership[blkn];
      compptr = cinfo->cur_comp_info[ci];
      tbl = entropy->derived_tbls[compptr->dc_tbl_no];

      /* Decode a single block's worth of coefficients */

      /* Section F.2.2.1: decode the DC coefficient difference */
      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
      if (s) {
	CHECK_BIT_BUFFER(br_state, s, return FALSE);
	r = GET_BITS(s);
	s = HUFF_EXTEND(r, s);
      }

      /* Convert DC difference to actual value, update last_dc_val */
      s += state.last_dc_val[ci];
      state.last_dc_val[ci] = s;
      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
      (*block)[0] = (JCOEF) (s << Al);
    }

    /* Completed MCU, so update state */
    BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
    ASSIGN_STATE(entropy->saved, state);
  }

  /* Account for restart interval (no-op if not using restarts) */
  entropy->restarts_to_go--;

  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x250(%rdi), %r13
movl 0x218(%rdi), %r15d
cmpl $0x0, 0x170(%rdi)
je 0x7291c
cmpl $0x0, 0x3c(%r13)
jne 0x7291c
movq %rbx, %rdi
callq 0x73255
testl %eax, %eax
je 0x72a97
cmpl $0x0, 0x10(%r13)
jne 0x72ad2
leaq 0x28(%rsp), %rdx
movq %rbx, 0x20(%rdx)
movq 0x28(%rbx), %rax
movq (%rax), %rcx
movq %rcx, (%rdx)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdx)
movq 0x18(%r13), %rsi
movl 0x20(%r13), %edx
leaq 0x28(%r13), %rax
movq %rax, 0x50(%rsp)
movl 0x38(%r13), %eax
movl %eax, 0x20(%rsp)
movups 0x28(%r13), %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %ebp, %ebp
movslq 0x1e0(%rbx), %rax
cmpq %rax, %rbp
jge 0x72aa1
movq (%r14,%rbp,8), %rax
movq %rax, 0x60(%rsp)
movslq 0x1e4(%rbx,%rbp,4), %rax
movq %rax, 0x58(%rsp)
movq 0x1b8(%rbx,%rax,8), %rax
movslq 0x14(%rax), %rax
movq 0x40(%r13,%rax,8), %r12
cmpl $0x7, %edx
jg 0x729d1
movl $0x0, 0xc(%rsp)
leaq 0x28(%rsp), %rdi
xorl %ecx, %ecx
callq 0x71e39
testl %eax, %eax
je 0x72add
movq 0x38(%rsp), %rsi
movl 0x40(%rsp), %edx
pushq $0x1
popq %r8
cmpl $0x8, %edx
jl 0x729fc
leal -0x8(%rdx), %ecx
movq %rsi, %rax
sarq %cl, %rax
movzbl %al, %eax
movl %eax, %ecx
movl 0x120(%r12,%rcx,4), %ecx
testl %ecx, %ecx
je 0x729f8
subl %ecx, %edx
movzbl 0x520(%r12,%rax), %r12d
jmp 0x72a1d
pushq $0x9
popq %r8
leaq 0x28(%rsp), %rdi
movq %r12, %rcx
callq 0x71f5f
testl %eax, %eax
js 0x72a97
movl %eax, %r12d
movq 0x38(%rsp), %rsi
movl 0x40(%rsp), %edx
testl %r12d, %r12d
je 0x72a73
cmpl %r12d, %edx
jge 0x72a41
leaq 0x28(%rsp), %rdi
movl %r12d, %ecx
callq 0x71e39
testl %eax, %eax
je 0x72a97
movq 0x38(%rsp), %rsi
movl 0x40(%rsp), %edx
subl %r12d, %edx
movq %rsi, %rdi
movl %edx, %ecx
sarq %cl, %rdi
pushq $-0x1
popq %rax
movl %r12d, %ecx
shll %cl, %eax
notl %eax
andl %edi, %eax
movl %r12d, %ecx
leaq 0x28cbe(%rip), %rdi     # 0x9b720
cmpl (%rdi,%rcx,4), %eax
jge 0x72a75
leaq 0x28cf2(%rip), %rdi     # 0x9b760
addl (%rdi,%rcx,4), %eax
jmp 0x72a75
xorl %eax, %eax
movq 0x58(%rsp), %rcx
addl 0x14(%rsp,%rcx,4), %eax
movl %eax, 0x14(%rsp,%rcx,4)
movl %r15d, %ecx
shll %cl, %eax
movq 0x60(%rsp), %rcx
movw %ax, (%rcx)
incq %rbp
jmp 0x72967
movl $0x0, 0xc(%rsp)
jmp 0x72add
movq 0x28(%rsp), %rax
movq 0x28(%rbx), %rcx
movq %rax, (%rcx)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rcx)
movq %rsi, 0x18(%r13)
movl %edx, 0x20(%r13)
movl 0x20(%rsp), %eax
movq 0x50(%rsp), %rcx
movl %eax, 0x10(%rcx)
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rcx)
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
decl 0x3c(%r13)
movl 0xc(%rsp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq