// File: /workspace/github_cpp_makefile_star2_O3/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, %r15
movq %rax, 0x228(%rbx)
leaq 0x173(%rip), %rax       # 0x7f737
movq %rax, (%r15)
testl %ebp, %ebp
je 0x7f5da
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 0x7f6d1
cmpl $0x1, %ebp
jg 0x7f60b
movq (%rbx), %rax
movl $0x2f, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movl 0x1a0(%rbx), %ebp
movq 0x228(%rbx), %r12
movq 0x8(%rbx), %rax
movslq 0x38(%rbx), %rdx
shlq $0x4, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq *(%rax)
movq %rax, 0x68(%r12)
movslq 0x38(%rbx), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x70(%r12)
testq %rcx, %rcx
jle 0x7f6c6
movq %r15, 0x10(%rsp)
movq 0x130(%rbx), %r13
addl $0x4, %ebp
movl %ebp, 0xc(%rsp)
addq $0x24, %r13
xorl %r14d, %r14d
movl (%r13), %eax
imull -0x18(%r13), %eax
cltd
idivl 0x1a0(%rbx)
movl %eax, %ebp
movq 0x8(%rbx), %rax
movl %ebp, %r15d
imull 0xc(%rsp), %r15d
leal (%r15,%r15), %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq *(%rax)
movslq %ebp, %rcx
leaq (%rax,%rcx,8), %rax
movq 0x68(%r12), %rcx
movq %rax, (%rcx,%r14,8)
movslq %r15d, %rcx
leaq (%rax,%rcx,8), %rax
movq 0x70(%r12), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
movslq 0x38(%rbx), %rcx
addq $0x60, %r13
cmpq %rcx, %r14
jl 0x7f65d
movq 0x10(%rsp), %r15
movl 0x1a0(%rbx), %ebp
addl $0x2, %ebp
jmp 0x7f6d4
movl 0x38(%rbx), %ecx
testl %ecx, %ecx
jle 0x7f728
movq 0x130(%rbx), %r14
addq $0x24, %r14
xorl %r12d, %r12d
movl (%r14), %ecx
movl -0x18(%r14), %eax
imull %ecx, %eax
cltd
idivl 0x1a0(%rbx)
movq 0x8(%rbx), %r8
imull -0x8(%r14), %ecx
imull %ebp, %eax
movq %rbx, %rdi
movl $0x1, %esi
movl %ecx, %edx
movl %eax, %ecx
callq *0x10(%r8)
movq %rax, 0x10(%r15,%r12,8)
incq %r12
movslq 0x38(%rbx), %rax
addq $0x60, %r14
cmpq %rax, %r12
jl 0x7f6e6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq