// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jcprepct.c
// Function: jinit_c_prep_controller
GLOBAL(void)
jinit_c_prep_controller (j_compress_ptr cinfo, jboolean need_full_buffer)
{
  my_prep_ptr prep;
  int ci;
  jpeg_component_info * compptr;

  if (need_full_buffer)		/* safety check */
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  prep = (my_prep_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_prep_controller));
  cinfo->prep = (struct jpeg_c_prep_controller *) prep;
  prep->pub.start_pass = start_pass_prep;

  /* Allocate the color conversion buffer.
   * We make the buffer wide enough to allow the downsampler to edge-expand
   * horizontally within the buffer, if it so chooses.
   */
  if (cinfo->downsample->need_context_rows) {
    /* Set up to provide context rows */
#ifdef CONTEXT_ROWS_SUPPORTED
    prep->pub.pre_process_data = pre_process_context;
    create_context_buffer(cinfo);
#else
    ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
  } else {
    /* No context, just make it tall enough for one row group */
    prep->pub.pre_process_data = pre_process_data;
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
	((j_common_ptr) cinfo, JPOOL_IMAGE,
	 (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
			cinfo->max_h_samp_factor) / compptr->h_samp_factor),
	 (JDIMENSION) cinfo->max_v_samp_factor);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r12
testl %esi, %esi
je 0x6a849
movq (%r12), %rax
movl $0x4, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movq 0x8(%r12), %rax
pushq $0x1
popq %rsi
pushq $0x70
popq %rdx
movq %r12, %rdi
callq *(%rax)
movq %rax, 0x1c0(%r12)
leaq 0x1db(%rip), %rcx       # 0x6aa43
movq %rcx, (%rax)
movq 0x1e0(%r12), %rcx
cmpl $0x0, 0x10(%rcx)
je 0x6a9cc
leaq 0x200(%rip), %rcx       # 0x6aa84
movq %rax, 0x30(%rsp)
movq %rcx, 0x8(%rax)
movslq 0x13c(%r12), %rbp
movq 0x8(%r12), %rax
leal (%rbp,%rbp,4), %ebx
movl 0x4c(%r12), %ecx
imull %ebx, %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
pushq $0x1
popq %rsi
movq %r12, %rdi
callq *(%rax)
movq %rax, %r15
movq 0x58(%r12), %rdx
leaq (,%rbp,2), %rax
addq %rbp, %rax
movq %rax, 0x20(%rsp)
shlq $0x3, %rax
movq %rax, 0x18(%rsp)
leal (,%rbp,2), %eax
leal (,%rbp,4), %ecx
movslq %ebx, %rsi
movslq %ecx, %rcx
xorl %r13d, %r13d
testl %ebp, %ebp
movl $0x0, %r14d
movq %rbp, 0x28(%rsp)
cmovgl %ebp, %r14d
cltq
leaq (%r15,%rcx,8), %rbx
shlq $0x3, %rsi
movq %rsi, 0x10(%rsp)
shlq $0x3, %rax
movq %rax, 0x8(%rsp)
movq %r12, 0x38(%rsp)
movslq 0x4c(%r12), %rax
cmpq %rax, %r13
jge 0x6aa34
movq 0x8(%r12), %r8
movl 0x1c(%rdx), %ecx
movslq 0x138(%r12), %rax
imulq %rcx, %rax
shlq $0x3, %rax
movq %rdx, 0x40(%rsp)
movslq 0x8(%rdx), %rcx
cqto
idivq %rcx
movq %r12, %rdi
pushq $0x1
popq %rsi
movl %eax, %edx
movq 0x20(%rsp), %rcx
callq *0x10(%r8)
movq %rax, %rbp
movq 0x28(%rsp), %rax
leaq (%r15,%rax,8), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
callq 0xe380
movq %rbp, %rax
addq 0x8(%rsp), %rax
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x6a9a1
movq (%rax,%rcx,8), %rdx
movq %rdx, (%r15,%rcx,8)
movq (%rbp,%rcx,8), %rdx
movq %rdx, (%rbx,%rcx,8)
incq %rcx
jmp 0x6a986
movq 0x30(%rsp), %rax
movq %r12, 0x10(%rax,%r13,8)
movq 0x10(%rsp), %rax
addq %rax, %r15
incq %r13
movq 0x40(%rsp), %rdx
addq $0x60, %rdx
addq %rax, %rbx
movq 0x38(%rsp), %r12
jmp 0x6a91b
leaq 0x280(%rip), %rcx       # 0x6ac53
movq %rax, %r15
movq %rcx, 0x8(%rax)
movq 0x58(%r12), %rbx
addq $0x1c, %rbx
xorl %r14d, %r14d
pushq $0x1
popq %rbp
movslq 0x4c(%r12), %rax
cmpq %rax, %r14
jge 0x6aa34
movq 0x8(%r12), %r8
movl (%rbx), %ecx
movslq 0x138(%r12), %rax
imulq %rcx, %rax
shlq $0x3, %rax
movslq -0x14(%rbx), %rcx
cqto
idivq %rcx
movl 0x13c(%r12), %ecx
movq %r12, %rdi
movl %ebp, %esi
movl %eax, %edx
callq *0x10(%r8)
movq %rax, 0x10(%r15,%r14,8)
incq %r14
addq $0x60, %rbx
jmp 0x6a9e9
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq