// File: /workspace/github_cpp_makefile_star2_O3/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 0x1f0(%rdi), %rdx
movl 0x118(%rdi), %ecx
testl %ecx, %ecx
je 0x771ed
movl 0x38(%rdx), %eax
testl %eax, %eax
jne 0x771e8
cmpl $0x0, 0x144(%rdi)
movl %ecx, %eax
jle 0x771e8
xorl %eax, %eax
movl $0x0, 0x24(%rdx,%rax,4)
incq %rax
movslq 0x144(%rdi), %rcx
cmpq %rcx, %rax
jl 0x771cb
movl 0x118(%rdi), %eax
decl %eax
movl %eax, 0x38(%rdx)
cmpl $0x0, 0x170(%rdi)
jle 0x77397
leaq 0x33abf(%rip), %r13     # 0xaacc0
xorl %ecx, %ecx
movq %rdi, (%rsp)
movq %rsi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movslq 0x174(%rdi,%rcx,4), %r8
movq 0x148(%rdi,%r8,8), %rax
movq %rcx, 0x20(%rsp)
movq (%rsi,%rcx,8), %rbx
movslq 0x14(%rax), %rcx
movq 0x80(%rdx,%rcx,8), %r12
movslq 0x18(%rax), %rax
movq 0xa0(%rdx,%rax,8), %r15
movswl (%rbx), %eax
movl $0x0, %ebp
movq %r8, 0x18(%rsp)
subl 0x24(%rdx,%r8,4), %eax
je 0x7728b
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %ecx, %edx
shrl %edx
incl %eax
cmpl $0x1, %ecx
movl %edx, %ecx
ja 0x77264
leal 0x1(%rax), %ebp
cmpl $0xb, %eax
jb 0x7728b
movq (%rdi), %rax
movl $0x6, 0x28(%rax)
movq (%rsp), %rdi
callq *(%rax)
movq (%rsp), %rdi
movl %ebp, %eax
incq (%r12,%rax,8)
xorl %eax, %eax
movl $0x1, %r12d
movl %eax, %ebp
movslq (%r13,%r12,4), %rax
movzwl (%rbx,%rax,2), %eax
testw %ax, %ax
je 0x7734d
cmpl $0x10, %ebp
jl 0x772e8
movq 0x780(%r15), %rcx
movl %ebp, %edx
subl $0x1f, %edx
movl $0x0, %esi
cmovbl %esi, %edx
addl $0xf, %edx
movl %edx, %esi
shrl $0x4, %esi
addq %rsi, %rcx
incq %rcx
andl $0x7ffffff0, %edx       # imm = 0x7FFFFFF0
negl %edx
addl %edx, %ebp
addl $-0x10, %ebp
movq %rcx, 0x780(%r15)
movl %eax, %ecx
negw %cx
cmovsw %ax, %cx
movl $0x1, %r14d
cmpw $0x2, %cx
jb 0x7732c
movzwl %cx, %ecx
xorl %eax, %eax
movl %ecx, %edx
shrl %edx
incl %eax
cmpl $0x3, %ecx
movl %edx, %ecx
ja 0x77304
leal 0x1(%rax), %r14d
cmpl $0xa, %eax
jb 0x7732c
movq (%rdi), %rax
movl $0x6, 0x28(%rax)
movq (%rsp), %rdi
callq *(%rax)
movq (%rsp), %rdi
shll $0x4, %ebp
addl %r14d, %ebp
movslq %ebp, %rax
incq (%r15,%rax,8)
incq %r12
movl $0x0, %eax
cmpq $0x40, %r12
jne 0x77299
jmp 0x77364
leal 0x1(%rbp), %eax
incq %r12
cmpq $0x40, %r12
jne 0x77299
testl %ebp, %ebp
js 0x77364
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(%rdi), %rax
cmpq %rax, %rcx
jl 0x77211
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq