// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jdcoefct.c
// Function: decompress_onepass
METHODDEF(int)
decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
{
  my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
  JDIMENSION MCU_col_num;	/* index of current MCU within row */
  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  int blkn, ci, xindex, yindex, yoffset, useful_width;
  JSAMPARRAY output_ptr;
  JDIMENSION start_col, output_col;
  jpeg_component_info *compptr;
  inverse_DCT_method_ptr inverse_DCT;

  /* Loop to process as much as 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 <= last_MCU_col;
	 MCU_col_num++) {
      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
      jzero_far((void FAR *) coef->MCU_buffer[0],
		(size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
      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;
      }
      /* Determine where data should go in output_buf and do the IDCT thing.
       * We skip dummy blocks at the right and bottom edges (but blkn gets
       * incremented past them!).  Note the inner loop relies on having
       * allocated the MCU_buffer[] blocks sequentially.
       */
      blkn = 0;			/* index of current DCT block within MCU */
      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
	compptr = cinfo->cur_comp_info[ci];
	/* Don't bother to IDCT an uninteresting component. */
	if (! compptr->component_needed) {
	  blkn += compptr->MCU_blocks;
	  continue;
	}
	inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
	useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
						    : compptr->last_col_width;
	output_ptr = output_buf[compptr->component_index] +
	  yoffset * compptr->DCT_scaled_size;
	start_col = MCU_col_num * compptr->MCU_sample_width;
	for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
	  if (cinfo->input_iMCU_row < last_iMCU_row ||
	      yoffset+yindex < compptr->last_row_height) {
	    output_col = start_col;
	    for (xindex = 0; xindex < useful_width; xindex++) {
	      (*inverse_DCT) (cinfo, compptr,
			      (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
			      output_ptr, output_col);
	      output_col += compptr->DCT_scaled_size;
	    }
	  }
	  blkn += compptr->MCU_width;
	  output_ptr += compptr->DCT_scaled_size;
	}
      }
    }
    /* Completed an MCU row, but perhaps not an iMCU row */
    coef->MCU_ctr = 0;
  }
  /* Completed the iMCU row, advance counters for next one */
  cinfo->output_iMCU_row++;
  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 $0x58, %rsp
movq %rsi, 0x38(%rsp)
movq %rdi, %rsi
movq 0x230(%rdi), %rax
movl 0x1a4(%rdi), %ecx
movl 0x1d8(%rdi), %edx
decl %edx
movl %edx, 0x4(%rsp)
decl %ecx
movl %ecx, 0x10(%rsp)
movl 0x2c(%rax), %r14d
leaq 0x38(%rax), %rcx
movq %rcx, 0x28(%rsp)
movq %rdi, 0x30(%rsp)
movq %rax, 0x18(%rsp)
cmpl 0x30(%rax), %r14d
jge 0x74147
movl 0x28(%rax), %ebp
movq %r14, 0x20(%rsp)
cmpl 0x4(%rsp), %ebp
ja 0x7411e
movq 0x28(%rsp), %r15
movq (%r15), %rdi
movq %rsi, %rbx
movslq 0x1e0(%rsi), %rsi
shlq $0x7, %rsi
callq 0x791cd
movq 0x250(%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rax)
testl %eax, %eax
je 0x7412a
xorl %ecx, %ecx
xorl %r8d, %r8d
movq 0x30(%rsp), %rsi
movl %ebp, 0x8(%rsp)
movslq 0x1b0(%rsi), %rax
cmpq %rax, %rcx
jge 0x74112
movq 0x1b8(%rsi,%rcx,8), %r12
cmpl $0x0, 0x30(%r12)
je 0x74105
movq %rcx, 0x40(%rsp)
xorl %eax, %eax
cmpl 0x4(%rsp), %ebp
setae %al
movq 0x258(%rsi), %rcx
movslq 0x4(%r12), %rdx
movq 0x8(%rcx,%rdx,8), %rcx
movq %rcx, 0x50(%rsp)
shll $0x4, %eax
movl 0x34(%rax,%r12), %r15d
movl 0x24(%r12), %eax
movl %eax, %ecx
imull %r14d, %ecx
movslq %ecx, %r13
shlq $0x3, %r13
movq 0x38(%rsp), %rcx
addq (%rcx,%rdx,8), %r13
movl 0x40(%r12), %ecx
imull %ebp, %ecx
movl %ecx, 0xc(%rsp)
xorl %edx, %edx
testl %r15d, %r15d
cmovlel %edx, %r15d
cmpl 0x38(%r12), %edx
jge 0x740f5
movl 0x10(%rsp), %ecx
cmpl %ecx, 0xb0(%rsi)
movl %r8d, 0x14(%rsp)
movq %rdx, 0x48(%rsp)
jb 0x7409a
movq 0x20(%rsp), %rcx
addl %edx, %ecx
cmpl 0x48(%r12), %ecx
jge 0x740d7
movslq %r8d, %rcx
movq 0x28(%rsp), %rdx
leaq (%rdx,%rcx,8), %rbx
xorl %r14d, %r14d
movl 0xc(%rsp), %ebp
cmpq %r14, %r15
je 0x740d7
movq (%rbx,%r14,8), %rdx
movq %rsi, %rdi
movq %r12, %rsi
movq %r13, %rcx
movl %ebp, %r8d
callq *0x50(%rsp)
movq 0x30(%rsp), %rsi
movl 0x24(%r12), %eax
addl %eax, %ebp
incq %r14
jmp 0x740ad
movl 0x14(%rsp), %r8d
addl 0x34(%r12), %r8d
movslq %eax, %rcx
leaq (%r13,%rcx,8), %r13
movq 0x48(%rsp), %rdx
incl %edx
jmp 0x7406f
movq 0x20(%rsp), %r14
movl 0x8(%rsp), %ebp
movq 0x40(%rsp), %rcx
jmp 0x7410a
addl 0x3c(%r12), %r8d
incq %rcx
jmp 0x73fef
incl %ebp
movq 0x18(%rsp), %rax
jmp 0x73fa4
andl $0x0, 0x28(%rax)
incl %r14d
jmp 0x73f92
movq 0x18(%rsp), %rax
movl %r14d, 0x2c(%rax)
movl %ebp, 0x28(%rax)
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl 0xb8(%rsi)
movl 0xb0(%rsi), %eax
incl %eax
movl %eax, 0xb0(%rsi)
cmpl 0x1a4(%rsi), %eax
jae 0x7416f
movq %rsi, %rdi
callq 0x74181
pushq $0x3
jmp 0x7417e
movq 0x240(%rsi), %rax
movq %rsi, %rdi
callq *0x18(%rax)
pushq $0x4
popq %rax
jmp 0x74138