// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcoefct.c
// Function: consume_data
METHODDEF(int)
consume_data (j_decompress_ptr cinfo)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
  JDIMENSION MCU_col_num;	/* index of current MCU within row */
  int blkn, ci, xindex, yindex, yoffset;
  JDIMENSION start_col;
  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  JBLOCKROW buffer_ptr;
  jpeg_component_info *compptr;

  /* Align the virtual buffers for the components used in this scan. */
  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    buffer[ci] = (*cinfo->mem->access_virt_barray)
      ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
       cinfo->input_iMCU_row * compptr->v_samp_factor,
       (JDIMENSION) compptr->v_samp_factor, TRUE);
    /* Note: entropy decoder expects buffer to be zeroed,
     * but this is handled automatically by the memory manager
     * because we requested a pre-zeroed array.
     */
  }

  /* Loop to process one whole iMCU row */
  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
       yoffset++) {
    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
	 MCU_col_num++) {
      /* Construct list of pointers to DCT blocks belonging to this MCU */
      blkn = 0;			/* index of current DCT block within MCU */
      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
	compptr = cinfo->cur_comp_info[ci];
	start_col = MCU_col_num * compptr->MCU_width;
	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
	  buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
	  for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
	    coef->MCU_buffer[blkn++] = buffer_ptr++;
	  }
	}
      }
      /* Try to fetch the MCU. */
      if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
	/* Suspension forced; update state counters and exit */
	coef->MCU_vert_offset = yoffset;
	coef->MCU_ctr = MCU_col_num;
	return JPEG_SUSPENDED;
      }
    }
    /* Completed an MCU row, but perhaps not an iMCU row */
    coef->MCU_ctr = 0;
  }
  /* Completed the iMCU row, advance counters for next one */
  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
    start_iMCU_row(cinfo);
    return JPEG_ROW_COMPLETED;
  }
  /* Completed the scan */
  (*cinfo->inputctl->finish_input_pass) (cinfo);
  return JPEG_SCAN_COMPLETED;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq 0x230(%rdi), %rbx
xorl %r14d, %r14d
pushq $0x1
popq %rbp
movq %rdi, (%rsp)
movslq 0x1b0(%rdi), %rax
cmpq %rax, %r14
jge 0x73c77
movq 0x1b8(%rdi,%r14,8), %rax
movq 0x8(%rdi), %r9
movslq 0x4(%rax), %rcx
movq 0x88(%rbx,%rcx,8), %rsi
movl 0xc(%rax), %ecx
movl 0xb0(%rdi), %edx
imull %ecx, %edx
movq (%rsp), %rdi
movl %ebp, %r8d
callq *0x40(%r9)
movq (%rsp), %rdi
movq %rax, 0x10(%rsp,%r14,8)
incq %r14
jmp 0x73c2e
movslq 0x2c(%rbx), %r12
leaq 0x38(%rbx), %r14
xorl %r13d, %r13d
movq %rbx, 0x8(%rsp)
movslq 0x30(%rbx), %rax
cmpq %rax, %r12
jge 0x73d73
movl 0x28(%rbx), %ebp
cmpl 0x1d8(%rdi), %ebp
jae 0x73d45
movl 0x1b0(%rdi), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %edx, %edx
cmpq %rax, %rcx
je 0x73d29
movq 0x1b8(%rdi,%rcx,8), %r8
movl 0x34(%r8), %esi
movl %esi, %edi
imull %ebp, %edi
testl %esi, %esi
cmovlel %r13d, %esi
movl 0x38(%r8), %r8d
testl %r8d, %r8d
cmovlel %r13d, %r8d
leal (%rdx,%rsi), %r9d
shlq $0x7, %rdi
xorl %r10d, %r10d
cmpq %r8, %r10
je 0x73d20
movslq %r9d, %r11
leaq (,%r10,8), %rbx
addq 0x10(%rsp,%rcx,8), %rbx
movq (%rbx,%r12,8), %r15
addq %rdi, %r15
movslq %edx, %rbx
leal (%rsi,%rbx), %edx
cmpq %rbx, %r11
je 0x73d18
movq %r15, (%r14,%rbx,8)
incq %rbx
subq $-0x80, %r15
jmp 0x73d06
incq %r10
addl %esi, %r9d
jmp 0x73ce4
incq %rcx
movq (%rsp), %rdi
jmp 0x73cb2
movq 0x250(%rdi), %rax
movq %r14, %rsi
callq *0x8(%rax)
testl %eax, %eax
je 0x73d56
incl %ebp
movq (%rsp), %rdi
jmp 0x73c97
movq 0x8(%rsp), %rbx
andl $0x0, 0x28(%rbx)
incq %r12
jmp 0x73c87
movq 0x8(%rsp), %rax
movl %r12d, 0x2c(%rax)
movl %ebp, 0x28(%rax)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xb0(%rdi), %eax
incl %eax
movl %eax, 0xb0(%rdi)
cmpl 0x1a4(%rdi), %eax
jae 0x73d92
callq 0x74181
pushq $0x3
jmp 0x73d9e
movq 0x240(%rdi), %rax
callq *0x18(%rax)
pushq $0x4
popq %rax
jmp 0x73d64