// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdcoefct.c
// Function: jinit_d_coef_controller
GLOBAL(void)
jinit_d_coef_controller (j_decompress_ptr cinfo, jboolean need_full_buffer)
{
  my_coef_ptr coef;

  coef = (my_coef_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_coef_controller));
  cinfo->coef = (struct jpeg_d_coef_controller *) coef;
  coef->pub.start_input_pass = start_input_pass;
  coef->pub.start_output_pass = start_output_pass;
#ifdef BLOCK_SMOOTHING_SUPPORTED
  coef->coef_bits_latch = NULL;
#endif

  /* Create the coefficient buffer. */
  if (need_full_buffer) {
#ifdef D_MULTISCAN_FILES_SUPPORTED
    /* Allocate a full-image virtual array for each component, */
    /* padded to a multiple of samp_factor DCT blocks in each direction. */
    /* Note we ask for a pre-zeroed array. */
    int ci, access_rows;
    jpeg_component_info *compptr;

    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      access_rows = compptr->v_samp_factor;
#ifdef BLOCK_SMOOTHING_SUPPORTED
      /* If block smoothing could be used, need a bigger window */
      if (cinfo->progressive_mode)
	access_rows *= 3;
#endif
      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
	((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
				(long) compptr->h_samp_factor),
	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
				(long) compptr->v_samp_factor),
	 (JDIMENSION) access_rows);
    }
    coef->pub.consume_data = consume_data;
    coef->pub.decompress_data = decompress_data;
    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
#else
    ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
  } else {
    /* We only need a single-MCU buffer. */
    JBLOCKROW buffer;
    int i;

    buffer = (JBLOCKROW)
      (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
      coef->MCU_buffer[i] = buffer + i;
    }
    coef->pub.consume_data = dummy_consume_data;
    coef->pub.decompress_data = decompress_onepass;
    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movq 0x8(%rdi), %rax
movl $0xe0, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %rbx
movq %rax, 0x230(%r14)
leaq 0x14a(%rip), %rax       # 0x80d03
movq %rax, (%rbx)
leaq 0x14f(%rip), %rax       # 0x80d12
movq %rax, 0x10(%rbx)
movq $0x0, 0xd8(%rbx)
testl %ebp, %ebp
je 0x80c87
cmpl $0x0, 0x38(%r14)
jle 0x80c66
movq 0x130(%r14), %r12
addq $0x8, %r12
xorl %r13d, %r13d
movq %rbx, (%rsp)
cmpl $0x0, 0x138(%r14)
movl 0x4(%r12), %eax
leal (%rax,%rax,2), %ebp
cmovel %eax, %ebp
movl 0x14(%r12), %edi
movq 0x8(%r14), %rax
movq 0x28(%rax), %rbx
movslq (%r12), %rsi
callq 0x86aa9
movq %rax, %r15
movl 0x18(%r12), %edi
movslq 0x4(%r12), %rsi
callq 0x86aa9
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl %r15d, %ecx
movl %eax, %r8d
movl %ebp, %r9d
callq *%rbx
movq (%rsp), %rbx
movq %rax, 0x88(%rbx,%r13,8)
incq %r13
movslq 0x38(%r14), %rax
addq $0x60, %r12
cmpq %rax, %r13
jl 0x80bf7
leaq 0x1f6(%rip), %rax       # 0x80e63
movq %rax, 0x8(%rbx)
leaq 0x39d(%rip), %rax       # 0x81015
movq %rax, 0x18(%rbx)
movq %rbx, %rax
addq $0x88, %rax
jmp 0x80cf0
movq 0x8(%r14), %rax
movl $0x500, %edx            # imm = 0x500
movq %r14, %rdi
movl $0x1, %esi
callq *0x8(%rax)
movdqa 0x215dd(%rip), %xmm0    # 0xa2280
xorl %ecx, %ecx
movq %rax, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqa 0x215e9(%rip), %xmm2    # 0xa22a0
movdqa %xmm0, %xmm3
psllq $0x7, %xmm3
paddq %xmm1, %xmm3
movdqu %xmm3, 0x38(%rbx,%rcx,8)
addq $0x2, %rcx
paddq %xmm2, %xmm0
cmpq $0xa, %rcx
jne 0x80cb7
leaq 0x509(%rip), %rax       # 0x811e8
movq %rax, 0x8(%rbx)
leaq 0x501(%rip), %rax       # 0x811eb
movq %rax, 0x18(%rbx)
xorl %eax, %eax
movq %rax, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq