// File: /workspace/github_cpp_makefile_star2_O3/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, 0x20(%rsp)
movq %rdi, %rbx
movq 0x230(%rdi), %rax
movq %rax, 0x28(%rsp)
movl 0x1a4(%rdi), %eax
decl %eax
movl %eax, 0x1c(%rsp)
movl 0xb4(%rbx), %eax
cmpl %eax, 0xac(%rbx)
jl 0x8023b
jne 0x80252
movl 0xb0(%rbx), %eax
cmpl 0xb8(%rbx), %eax
ja 0x80252
movq 0x240(%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testl %eax, %eax
jne 0x8021d
xorl %eax, %eax
jmp 0x803b2
cmpl $0x0, 0x38(%rbx)
jle 0x80396
movq 0x130(%rbx), %r12
movq $0x0, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
cmpl $0x0, 0x30(%r12)
je 0x80373
movq 0x10(%rsp), %rbx
movq 0x8(%rbx), %rax
movq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rdx
movq 0x88(%rcx,%rdx,8), %rsi
movl 0xc(%r12), %ecx
movl 0xb8(%rbx), %edx
imull %ecx, %edx
movq %rbx, %rdi
xorl %r8d, %r8d
callq *0x40(%rax)
movq %rax, 0x30(%rsp)
movl 0x1c(%rsp), %eax
cmpl %eax, 0xb8(%rbx)
jae 0x802c7
movl 0xc(%r12), %edx
jmp 0x802da
movl 0xc(%r12), %ecx
movl 0x20(%r12), %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
cmovel %ecx, %edx
testl %edx, %edx
jle 0x80373
movq 0x10(%rsp), %rax
movq 0x258(%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %r13
movq 0x20(%rsp), %rax
movq (%rax,%rcx,8), %rcx
movl %edx, %eax
movq %rax, 0x38(%rsp)
movl 0x1c(%r12), %eax
xorl %edx, %edx
testl %eax, %eax
movq %rdx, 0x40(%rsp)
je 0x80356
movq 0x30(%rsp), %rax
movq (%rax,%rdx,8), %rbp
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %rcx, %r15
movl %r14d, %r8d
callq *%r13
movq %r15, %rcx
subq $-0x80, %rbp
movl 0x1c(%r12), %eax
movl 0x24(%r12), %edx
addl %edx, %r14d
incl %ebx
cmpl %eax, %ebx
jb 0x80326
jmp 0x8035d
movl 0x24(%r12), %edx
xorl %eax, %eax
movslq %edx, %rdx
leaq (%rcx,%rdx,8), %rcx
movq 0x40(%rsp), %rdx
incq %rdx
cmpq 0x38(%rsp), %rdx
jne 0x8030f
movq 0x8(%rsp), %rdx
incq %rdx
addq $0x60, %r12
movq 0x10(%rsp), %rbx
movslq 0x38(%rbx), %rax
movq %rdx, 0x8(%rsp)
cmpq %rax, %rdx
jl 0x80271
movl 0xb8(%rbx), %eax
incl %eax
movl %eax, 0xb8(%rbx)
cmpl 0x1a4(%rbx), %eax
movl $0x4, %eax
sbbl $0x0, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq