// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdmainct.c
// Function: jinit_d_main_controller
GLOBAL(void)
jinit_d_main_controller (j_decompress_ptr cinfo, jboolean need_full_buffer)
{
  my_main_ptr mainp;
  int ci, rgroup, ngroups;
  jpeg_component_info *compptr;

  mainp = (my_main_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_main_controller));
  cinfo->main = (struct jpeg_d_main_controller *) mainp;
  mainp->pub.start_pass = start_pass_main;

  if (need_full_buffer)		/* shouldn't happen */
    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);

  /* Allocate the workspace.
   * ngroups is the number of row groups we need.
   */
  if (cinfo->upsample->need_context_rows) {
    if (cinfo->min_DCT_scaled_size < 2) /* unsupported, see comments above */
      ERREXIT(cinfo, JERR_NOTIMPL);
    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
    ngroups = cinfo->min_DCT_scaled_size + 2;
  } else {
    ngroups = cinfo->min_DCT_scaled_size;
  }

  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    rgroup = (compptr->v_samp_factor * compptr->DCT_scaled_size) /
      cinfo->min_DCT_scaled_size; /* height of a row group of component */
    mainp->buffer[ci] = (*cinfo->mem->alloc_sarray)
			((j_common_ptr) cinfo, JPOOL_IMAGE,
			 compptr->width_in_blocks * compptr->DCT_scaled_size,
			 (JDIMENSION) (rgroup * ngroups));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movl $0x88, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %r14
movq %rax, 0x228(%rbx)
leaq 0x166(%rip), %rax       # 0x8050e
movq %rax, (%r14)
testl %ebp, %ebp
je 0x803be
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq 0x260(%rbx), %rax
cmpl $0x0, 0x10(%rax)
movl 0x1a0(%rbx), %ebp
je 0x804a9
movq %r14, 0x10(%rsp)
cmpl $0x1, %ebp
jg 0x803ee
movq (%rbx), %rax
movl $0x2f, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq 0x228(%rbx), %r15
movslq 0x1a0(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rbx), %rax
movslq 0x38(%rbx), %rdx
shlq $0x4, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq *(%rax)
movq %rax, 0x68(%r15)
movslq 0x38(%rbx), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x70(%r15)
testq %rcx, %rcx
jle 0x8049b
movq 0x130(%rbx), %r13
addq $0x4, 0x8(%rsp)
addq $0x24, %r13
xorl %ebp, %ebp
movl (%r13), %eax
imull -0x18(%r13), %eax
cltd
idivl 0x1a0(%rbx)
movq 0x8(%rbx), %rcx
movslq %eax, %r12
movq %r12, %r14
imulq 0x8(%rsp), %r14
movq %r14, %rdx
shlq $0x4, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq *(%rcx)
leaq (%rax,%r12,8), %rax
movq 0x68(%r15), %rcx
movq %rax, (%rcx,%rbp,8)
movslq %r14d, %rcx
leaq (%rax,%rcx,8), %rax
movq 0x70(%r15), %rcx
movq %rax, (%rcx,%rbp,8)
incq %rbp
movslq 0x38(%rbx), %rax
addq $0x60, %r13
cmpq %rax, %rbp
jl 0x8043f
movl 0x1a0(%rbx), %ebp
addl $0x2, %ebp
movq 0x10(%rsp), %r14
cmpl $0x0, 0x38(%rbx)
jle 0x804ff
movq 0x130(%rbx), %r15
addq $0x24, %r15
xorl %r12d, %r12d
movl (%r15), %ecx
movl -0x18(%r15), %eax
imull %ecx, %eax
cltd
idivl 0x1a0(%rbx)
movq 0x8(%rbx), %r8
imull -0x8(%r15), %ecx
imull %ebp, %eax
movq %rbx, %rdi
movl $0x1, %esi
movl %ecx, %edx
movl %eax, %ecx
callq *0x10(%r8)
movq %rax, 0x10(%r14,%r12,8)
incq %r12
movslq 0x38(%rbx), %rax
addq $0x60, %r15
cmpq %rax, %r12
jl 0x804bd
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq