// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jchuff.c
// Function: encode_mcu_gather
METHODDEF(jboolean)
encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
  huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
  int blkn, ci;
  jpeg_component_info * compptr;

  /* Take care of restart intervals if needed */
  if (cinfo->restart_interval) {
    if (entropy->restarts_to_go == 0) {
      /* Re-initialize DC predictions to 0 */
      for (ci = 0; ci < cinfo->comps_in_scan; ci++)
	entropy->saved.last_dc_val[ci] = 0;
      /* Update restart state */
      entropy->restarts_to_go = cinfo->restart_interval;
    }
    entropy->restarts_to_go--;
  }

  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
    ci = cinfo->MCU_membership[blkn];
    compptr = cinfo->cur_comp_info[ci];
    htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
		    entropy->dc_count_ptrs[compptr->dc_tbl_no],
		    entropy->ac_count_ptrs[compptr->ac_tbl_no]);
    entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
  }

  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x1f0(%rdi), %rdx
cmpl $0x0, 0x118(%rdi)
je 0x7812d
cmpl $0x0, 0x38(%rdx)
jne 0x7812a
cmpl $0x0, 0x144(%r14)
jle 0x78120
xorl %eax, %eax
movl $0x0, 0x24(%rdx,%rax,4)
incq %rax
movslq 0x144(%r14), %rcx
cmpq %rcx, %rax
jl 0x78109
movl 0x118(%r14), %eax
movl %eax, 0x38(%rdx)
decl 0x38(%rdx)
cmpl $0x0, 0x170(%r14)
jle 0x782c3
xorl %ecx, %ecx
leaq 0x32b3c(%rip), %rdi     # 0xaac80
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movslq 0x174(%r14,%rcx,4), %r8
movq %rcx, 0x20(%rsp)
movq (%rsi,%rcx,8), %rbx
movswl (%rbx), %ecx
movl $0x0, %ebp
subl 0x24(%rdx,%r8,4), %ecx
je 0x78184
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
xorl %ebp, %ebp
movl %eax, %ecx
incl %ebp
shrl %ecx
cmpl $0x1, %eax
movl %ecx, %eax
ja 0x78179
movq %r8, 0x18(%rsp)
movq 0x148(%r14,%r8,8), %rax
movslq 0x14(%rax), %rcx
movq 0x80(%rdx,%rcx,8), %r12
movslq 0x18(%rax), %rax
movq 0xa0(%rdx,%rax,8), %r15
cmpl $0xc, %ebp
jb 0x781c4
movq (%r14), %rax
movl $0x6, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
leaq 0x32abc(%rip), %rdi     # 0xaac80
movl %ebp, %eax
incq (%r12,%rax,8)
xorl %r12d, %r12d
movl $0x1, %ebp
movslq (%rdi,%rbp,4), %rax
movzwl (%rbx,%rax,2), %eax
testw %ax, %ax
je 0x78278
cmpl $0xf, %r12d
jle 0x78223
cmpl $0x1f, %r12d
movl $0x1f, %ecx
cmovll %r12d, %ecx
negl %ecx
addl %r12d, %ecx
addl $0xf, %ecx
movl %ecx, %edx
andl $-0x10, %edx
movq 0x780(%r15), %rsi
shrl $0x4, %ecx
addq %rsi, %rcx
incq %rcx
negl %edx
addl %edx, %r12d
addl $-0x10, %r12d
movq %rcx, 0x780(%r15)
movl %eax, %ecx
negw %cx
cmovsw %ax, %cx
movl $0x1, %r13d
cmpw $0x2, %cx
jb 0x78249
movzwl %cx, %eax
movl %eax, %ecx
shrl %ecx
incl %r13d
cmpl $0x3, %eax
movl %ecx, %eax
ja 0x7823d
cmpl $0xb, %r13d
jb 0x78265
movq (%r14), %rax
movl $0x6, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
leaq 0x32a1b(%rip), %rdi     # 0xaac80
shll $0x4, %r12d
addl %r12d, %r13d
movslq %r13d, %rax
incq (%r15,%rax,8)
xorl %r12d, %r12d
jmp 0x7827b
incl %r12d
incq %rbp
cmpq $0x40, %rbp
jne 0x781d2
testl %r12d, %r12d
jle 0x78290
incq (%r15)
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq (%rsi,%rcx,8), %rax
movswl (%rax), %eax
movq 0x8(%rsp), %rdx
movq 0x18(%rsp), %r8
movl %eax, 0x24(%rdx,%r8,4)
incq %rcx
movslq 0x170(%r14), %rax
cmpq %rax, %rcx
jl 0x7814e
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq