// File: tomfunkhouser[P]gaps/pkgs/jpeg/jdpostct.c
// Function: jinit_d_post_controller
GLOBAL(void)
jinit_d_post_controller (j_decompress_ptr cinfo, jboolean need_full_buffer)
{
  my_post_ptr post;

  post = (my_post_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_post_controller));
  cinfo->post = (struct jpeg_d_post_controller *) post;
  post->pub.start_pass = start_pass_dpost;
  post->whole_image = NULL;	/* flag for no virtual arrays */
  post->buffer = NULL;		/* flag for no strip buffer */

  /* Create the quantization buffer, if needed */
  if (cinfo->quantize_colors) {
    /* The buffer strip height is max_v_samp_factor, which is typically
     * an efficient number of rows for upsampling to return.
     * (In the presence of output rescaling, we might want to be smarter?)
     */
    post->strip_height = (JDIMENSION) cinfo->max_v_samp_factor;
    if (need_full_buffer) {
      /* Two-pass color quantization: need full-image storage. */
      /* We round up the number of rows to a multiple of the strip height. */
#ifdef QUANT_2PASS_SUPPORTED
      post->whole_image = (*cinfo->mem->request_virt_sarray)
	((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
	 cinfo->output_width * cinfo->out_color_components,
	 (JDIMENSION) jround_up((long) cinfo->output_height,
				(long) post->strip_height),
	 post->strip_height);
#else
      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif /* QUANT_2PASS_SUPPORTED */
    } else {
      /* One-pass color quantization: just make a strip buffer. */
      post->buffer = (*cinfo->mem->alloc_sarray)
	((j_common_ptr) cinfo, JPOOL_IMAGE,
	 cinfo->output_width * cinfo->out_color_components,
	 post->strip_height);
    }
  }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq 0x30(%rsp), %rdi
movl $0x1, %esi
movl $0x30, %edx
callq *%rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x238(%rax)
movq 0x20(%rsp), %rax
leaq 0x124(%rip), %rcx       # 0xeed70
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x30(%rsp), %rax
cmpl $0x0, 0x6c(%rax)
je 0xeed63
movq 0x30(%rsp), %rax
movl 0x19c(%rax), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x20(%rax)
cmpl $0x0, 0x2c(%rsp)
je 0xeed1d
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movl 0x88(%rax), %eax
movq 0x30(%rsp), %rcx
imull 0x90(%rcx), %eax
movl %eax, 0x14(%rsp)
movq 0x30(%rsp), %rax
movl 0x8c(%rax), %eax
movl %eax, %edi
movq 0x20(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, %esi
callq 0xf9330
movq 0x8(%rsp), %rdi
movl 0x14(%rsp), %ecx
movq %rax, %rdx
movq 0x18(%rsp), %rax
movl %edx, %r8d
movq 0x20(%rsp), %rdx
movl 0x20(%rdx), %r9d
movl $0x1, %esi
xorl %edx, %edx
callq *%rax
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0xeed61
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x30(%rsp), %rdi
movq 0x30(%rsp), %rcx
movl 0x88(%rcx), %edx
movq 0x30(%rsp), %rcx
imull 0x90(%rcx), %edx
movq 0x20(%rsp), %rcx
movl 0x20(%rcx), %ecx
movl $0x1, %esi
callq *%rax
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0xeed63
addq $0x38, %rsp
retq
nopl (%rax,%rax)