// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant2.c
// Function: finish_pass1
METHODDEF(void)
finish_pass1 (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;

  /* Select the representative colors and fill in cinfo->colormap */
  cinfo->colormap = cquantize->sv_colormap;
  select_colors(cinfo, cquantize->desired);
  /* Force next pass to zero the color index table */
  cquantize->needs_zeroed = TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x270(%rdi), %rcx
movq 0x20(%rcx), %rax
movq %rax, 0xa0(%rdi)
movq %rcx, 0x28(%rsp)
movslq 0x28(%rcx), %r12
movq 0x8(%rdi), %rax
imulq $0x28, %r12, %rdx
pushq $0x1
popq %rbp
movl %ebp, %esi
callq *(%rax)
movq %rax, %rsi
movaps 0x23da5(%rip), %xmm0    # 0x9b9d0
movups %xmm0, (%rax)
movabsq $0x1f00000000, %rax     # imm = 0x1F00000000
movq %rax, 0x10(%rsi)
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
movq %rsi, (%rsp)
callq 0x783a3
cmpl $0x2, %r12d
cmovgel %r12d, %ebp
movl %ebp, 0x18(%rsp)
pushq $0x1
popq %r8
pushq $0x2
popq %r14
movq (%rsp), %r13
cmpq %r12, %r8
jge 0x77dc5
leal (%r8,%r8), %eax
cmpl %r12d, %eax
jle 0x77c9d
movq %r8, %rax
movq (%rsp), %rcx
xorl %edx, %edx
xorl %esi, %esi
subq $0x1, %rax
jb 0x77cca
movq 0x18(%rcx), %rdi
cmpq %rdx, %rdi
cmovgq %rdi, %rdx
cmovgq %rcx, %rsi
addq $0x28, %rcx
jmp 0x77c82
movq %r8, %rax
movq (%rsp), %rcx
xorl %edx, %edx
xorl %esi, %esi
subq $0x1, %rax
jb 0x77cca
movq 0x20(%rcx), %rdi
cmpq %rdx, %rdi
jle 0x77cc4
cmpq $0x0, 0x18(%rcx)
cmovgq %rdi, %rdx
cmovgq %rcx, %rsi
addq $0x28, %rcx
jmp 0x77ca8
testq %rsi, %rsi
je 0x77dcc
movq %r12, %rbp
movq %r8, 0x10(%rsp)
imulq $0x28, %r8, %rcx
movl 0x4(%rsi), %edx
movl %edx, 0x4(%r13,%rcx)
movl 0xc(%rsi), %edi
movl %edi, 0xc(%r13,%rcx)
movl 0x14(%rsi), %r9d
movl %r9d, 0x14(%r13,%rcx)
movl (%rsi), %eax
movl %eax, (%r13,%rcx)
movl 0x8(%rsi), %r8d
movl %r8d, 0x8(%r13,%rcx)
movl 0x10(%rsi), %r10d
movl %edx, %ebx
subl %eax, %ebx
shll $0x4, %ebx
movl %edi, %r11d
subl %r8d, %r11d
movl %r14d, %r12d
imull $0xc, %r11d, %r14d
movl %r9d, %r15d
subl %r10d, %r15d
shll $0x3, %r15d
xorl %r11d, %r11d
cmpl %r14d, %ebx
cmovlel %r14d, %ebx
movl %r12d, %r14d
setle %r11b
cmpl %ebx, %r15d
leaq (%r13,%rcx), %r15
movl %r10d, 0x10(%r13,%rcx)
cmovgl %r12d, %r11d
cmpl $0x2, %r11d
je 0x77d72
cmpl $0x1, %r11d
movq %rbp, %r12
jne 0x77d8c
leaq 0xc(%rsi), %r11
movq (%rsp), %rax
addq %rax, %rcx
addq $0x8, %rcx
addl %edi, %r8d
movl %r8d, %eax
jmp 0x77d95
leaq 0x14(%rsi), %r11
movq (%rsp), %rax
addq %rax, %rcx
addq $0x10, %rcx
addl %r9d, %r10d
movl %r10d, %eax
movq %rbp, %r12
jmp 0x77d95
leaq 0x4(%rsi), %r11
addl %edx, %eax
movq %r15, %rcx
cltd
idivl %r14d
movl %eax, (%r11)
incl %eax
movl %eax, (%rcx)
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x783a3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x783a3
movq 0x10(%rsp), %r8
incq %r8
jmp 0x77c65
movl 0x18(%rsp), %eax
movl %eax, %r8d
movl %r8d, %eax
movq %rax, 0x30(%rsp)
xorl %r10d, %r10d
movq %r8, 0x10(%rsp)
cmpq 0x30(%rsp), %r10
je 0x77f4f
movq %r10, 0x38(%rsp)
imulq $0x28, %r10, %rax
movq 0x8(%rsp), %rcx
movq 0x270(%rcx), %rcx
movq 0x30(%rcx), %rcx
movq %rcx, 0x60(%rsp)
movq (%rsp), %rcx
movslq (%rcx,%rax), %r10
movslq 0x4(%rcx,%rax), %rdx
movq %rdx, 0x50(%rsp)
movslq 0x8(%rcx,%rax), %rdx
movslq 0xc(%rcx,%rax), %rsi
movq %rsi, 0x18(%rsp)
movslq 0x10(%rcx,%rax), %rsi
movslq 0x14(%rcx,%rax), %rdi
movq %rsi, 0x58(%rsp)
leal 0x4(,%rsi,8), %eax
movl %eax, 0x24(%rsp)
movq %rdx, 0x48(%rsp)
shlq $0x6, %rdx
movq %rdx, 0x40(%rsp)
xorl %r9d, %r9d
xorl %eax, %eax
xorl %esi, %esi
xorl %ecx, %ecx
cmpq 0x50(%rsp), %r10
jg 0x77ee8
leal 0x4(,%r10,8), %r8d
movslq %r8d, %r14
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %r8
cmpq 0x18(%rsp), %r8
jg 0x77ee0
leal 0x2(,%r8,4), %r11d
movslq %r11d, %r11
movq 0x60(%rsp), %rdx
movq (%rdx,%r10,8), %rbx
addq %r15, %rbx
movl 0x24(%rsp), %r13d
movq 0x58(%rsp), %rbp
cmpq %rdi, %rbp
jg 0x77ed7
movzwl (%rbx,%rbp,2), %edx
testq %rdx, %rdx
je 0x77ece
addq %rdx, %r9
movq %rdx, %r12
imulq %r14, %r12
addq %r12, %rax
movq %rdx, %r12
imulq %r11, %r12
addq %r12, %rsi
movslq %r13d, %r12
imulq %rdx, %r12
addq %r12, %rcx
incq %rbp
addl $0x8, %r13d
jmp 0x77e9f
incq %r8
addq $0x40, %r15
jmp 0x77e77
incq %r10
jmp 0x77e57
movq %r9, %rdi
sarq %rdi
addq %rdi, %rax
cqto
idivq %r9
movq 0x8(%rsp), %r8
movq 0xa0(%r8), %rdx
movq (%rdx), %rdx
movq 0x38(%rsp), %r10
movb %al, (%rdx,%r10)
addq %rdi, %rsi
movq %rsi, %rax
cqto
idivq %r9
movq 0xa0(%r8), %rdx
movq 0x8(%rdx), %rdx
movb %al, (%rdx,%r10)
addq %rdi, %rcx
movq %rcx, %rax
cqto
idivq %r9
movq 0xa0(%r8), %rcx
movq 0x10(%rcx), %rcx
movb %al, (%rcx,%r10)
incq %r10
movq 0x10(%rsp), %r8
jmp 0x77ddc
movq 0x8(%rsp), %rdi
movl %r8d, 0x9c(%rdi)
movq (%rdi), %rax
movl $0x60, 0x28(%rax)
movl %r8d, 0x2c(%rax)
movq (%rdi), %rax
pushq $0x1
popq %rsi
callq *0x8(%rax)
movq 0x28(%rsp), %rax
movl $0x1, 0x38(%rax)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq