// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rsi
movl $0x88, %edx
callq *(%rax)
movq %rax, %r12
movq %rax, 0x228(%rbx)
leaq 0x16a(%rip), %rax       # 0x73464
movq %rax, (%r12)
testl %ebp, %ebp
je 0x73311
movq (%rbx), %rax
movl $0x4, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq 0x260(%rbx), %rax
cmpl $0x0, 0x10(%rax)
movl 0x1a0(%rbx), %r13d
je 0x73402
movq %r12, 0x10(%rsp)
cmpl $0x1, %r13d
jg 0x7334a
movq (%rbx), %rax
movl $0x2f, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movl 0x1a0(%rbx), %r13d
movl %r13d, %r14d
movq 0x228(%rbx), %r13
movq 0x8(%rbx), %rax
movslq 0x38(%rbx), %rdx
shlq $0x4, %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq *(%rax)
movq %rax, 0x68(%r13)
movslq 0x38(%rbx), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, 0x70(%r13)
movq 0x130(%rbx), %rbp
addl $0x4, %r14d
movl %r14d, 0xc(%rsp)
addq $0x24, %rbp
xorl %r14d, %r14d
movslq %ecx, %rax
cmpq %rax, %r14
jge 0x733f2
movl (%rbp), %eax
imull -0x18(%rbp), %eax
cltd
idivl 0x1a0(%rbx)
movl %eax, %r15d
movq 0x8(%rbx), %rax
movl %r15d, %r12d
imull 0xc(%rsp), %r12d
leal (%r12,%r12), %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq *(%rax)
movslq %r15d, %rcx
leaq (%rax,%rcx,8), %rax
movq 0x68(%r13), %rcx
movq %rax, (%rcx,%r14,8)
movslq %r12d, %rcx
leaq (%rax,%rcx,8), %rax
movq 0x70(%r13), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
movl 0x38(%rbx), %ecx
addq $0x60, %rbp
jmp 0x7338f
movl 0x1a0(%rbx), %r13d
addl $0x2, %r13d
movq 0x10(%rsp), %r12
movq 0x130(%rbx), %r14
addq $0x24, %r14
xorl %r15d, %r15d
pushq $0x1
popq %rbp
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jge 0x73455
movl (%r14), %ecx
movl -0x18(%r14), %eax
imull %ecx, %eax
cltd
idivl 0x1a0(%rbx)
movq 0x8(%rbx), %r8
imull -0x8(%r14), %ecx
imull %r13d, %eax
movq %rbx, %rdi
movl %ebp, %esi
movl %ecx, %edx
movl %eax, %ecx
callq *0x10(%r8)
movq %rax, 0x10(%r12,%r15,8)
incq %r15
addq $0x60, %r14
jmp 0x73413
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq