// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcoefct.c
// Function: decompress_data
METHODDEF(int)
decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  JDIMENSION block_num;
  int ci, block_row, block_rows;
  JBLOCKARRAY buffer;
  JBLOCKROW buffer_ptr;
  JSAMPARRAY output_ptr;
  JDIMENSION output_col;
  jpeg_component_info *compptr;
  inverse_DCT_method_ptr inverse_DCT;

  /* Force some input to be done if we are getting ahead of the input. */
  while (cinfo->input_scan_number < cinfo->output_scan_number ||
	 (cinfo->input_scan_number == cinfo->output_scan_number &&
	  cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
    if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
      return JPEG_SUSPENDED;
  }

  /* OK, output from the virtual arrays. */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Don't bother to IDCT an uninteresting component. */
    if (! compptr->component_needed)
      continue;
    /* Align the virtual buffer for this component. */
    buffer = (*cinfo->mem->access_virt_barray)
      ((j_common_ptr) cinfo, coef->whole_image[ci],
       cinfo->output_iMCU_row * compptr->v_samp_factor,
       (JDIMENSION) compptr->v_samp_factor, FALSE);
    /* Count non-dummy DCT block rows in this iMCU row. */
    if (cinfo->output_iMCU_row < last_iMCU_row)
      block_rows = compptr->v_samp_factor;
    else {
      /* NB: can't use last_row_height here; it is input-side-dependent! */
      block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
      if (block_rows == 0) block_rows = compptr->v_samp_factor;
    }
    inverse_DCT = cinfo->idct->inverse_DCT[ci];
    output_ptr = output_buf[ci];
    /* Loop over all DCT blocks to be processed. */
    for (block_row = 0; block_row < block_rows; block_row++) {
      buffer_ptr = buffer[block_row];
      output_col = 0;
      for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
	(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
			output_ptr, output_col);
	buffer_ptr++;
	output_col += compptr->DCT_scaled_size;
      }
      output_ptr += compptr->DCT_scaled_size;
    }
  }

  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
    return JPEG_ROW_COMPLETED;
  return JPEG_SCAN_COMPLETED;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
movq 0x230(%rdi), %rax
movq %rax, 0x20(%rsp)
movl 0x1a4(%rdi), %eax
decl %eax
movl %eax, 0x14(%rsp)
movl 0xb4(%rbx), %eax
cmpl %eax, 0xac(%rbx)
jl 0x73ded
jne 0x73e04
movl 0xb0(%rbx), %eax
cmpl 0xb8(%rbx), %eax
ja 0x73e04
movq 0x240(%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testl %eax, %eax
jne 0x73dcf
xorl %eax, %eax
jmp 0x73f34
movq 0x130(%rbx), %r15
xorl %ecx, %ecx
movq %rbx, 0x8(%rsp)
movslq 0x38(%rbx), %rax
cmpq %rax, %rcx
jge 0x73f1a
movq %rcx, 0x18(%rsp)
cmpl $0x0, 0x30(%r15)
je 0x73f04
movq 0x8(%rsp), %rbx
movq 0x8(%rbx), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r14
movq 0x88(%rcx,%r14,8), %rsi
movl 0xc(%r15), %ecx
movl 0xb8(%rbx), %edx
imull %ecx, %edx
movq %rbx, %rdi
xorl %r8d, %r8d
callq *0x40(%rax)
movq %rax, 0x38(%rsp)
movl 0x14(%rsp), %eax
cmpl %eax, 0xb8(%rbx)
jae 0x73e77
movl 0xc(%r15), %edx
jmp 0x73e88
movl 0xc(%r15), %ecx
movl 0x20(%r15), %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
cmovel %ecx, %edx
movq 0x258(%rbx), %rax
movq 0x8(%rax,%r14,8), %r13
movq 0x28(%rsp), %rax
movq (%rax,%r14,8), %rbp
testl %edx, %edx
movl $0x0, %eax
cmovlel %eax, %edx
xorl %ecx, %ecx
movq %rdx, 0x30(%rsp)
cmpq %rdx, %rcx
je 0x73f04
movq 0x38(%rsp), %rax
movq %rcx, 0x40(%rsp)
movq (%rax,%rcx,8), %r14
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpl 0x1c(%r15), %ebx
jae 0x73eec
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
movl %r12d, %r8d
callq *%r13
subq $-0x80, %r14
addl 0x24(%r15), %r12d
incl %ebx
jmp 0x73ec6
movslq 0x24(%r15), %rax
leaq (%rbp,%rax,8), %rbp
movq 0x40(%rsp), %rcx
incq %rcx
movq 0x30(%rsp), %rdx
jmp 0x73eae
movq 0x18(%rsp), %rcx
incq %rcx
addq $0x60, %r15
movq 0x8(%rsp), %rbx
jmp 0x73e12
movl 0xb8(%rbx), %eax
incl %eax
movl %eax, 0xb8(%rbx)
cmpl 0x1a4(%rbx), %eax
pushq $0x4
popq %rax
sbbl $0x0, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq