// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jquant1.c
// Function: jinit_1pass_quantizer
GLOBAL(void)
jinit_1pass_quantizer (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize;

  cquantize = (my_cquantize_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_cquantizer));
  cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
  cquantize->pub.start_pass = start_pass_1_quant;
  cquantize->pub.finish_pass = finish_pass_1_quant;
  cquantize->pub.new_color_map = new_color_map_1_quant;
  cquantize->fserrors[0] = NULL; /* Flag FS workspace not allocated */
  cquantize->odither[0] = NULL;	/* Also flag odither arrays not allocated */

  /* Make sure my internal arrays won't overflow */
  if (cinfo->out_color_components > MAX_Q_COMPS)
    ERREXIT1(cinfo, JERR_QUANT_COMPONENTS, MAX_Q_COMPS);
  /* Make sure colormap indexes can be represented by JSAMPLEs */
  if (cinfo->desired_number_of_colors > (MAXJSAMPLE+1))
    ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXJSAMPLE+1);

  /* Create the colormap and color index table. */
  create_colormap(cinfo);
  create_colorindex(cinfo);

  /* Allocate Floyd-Steinberg workspace now if requested.
   * We do this now since it is FAR storage and may affect the memory
   * manager's space calculations.  If the user changes to FS dither
   * mode in a later pass, we will allocate the space then, and will
   * possibly overrun the max_memory_to_use setting.
   */
  if (cinfo->dither_mode == JDITHER_FS)
    alloc_fs_workspace(cinfo);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
pushq $0x1
popq %rbp
movl $0x98, %edx
movl %ebp, %esi
callq *(%rax)
movq %rax, 0x270(%rbx)
leaq 0x28f(%rip), %rcx       # 0x77052
movq %rcx, (%rax)
leaq 0x45e(%rip), %rcx       # 0x7722b
movq %rcx, 0x10(%rax)
leaq 0x454(%rip), %rcx       # 0x7722c
movq %rcx, 0x18(%rax)
andq $0x0, 0x70(%rax)
andq $0x0, 0x50(%rax)
cmpl $0x5, 0x90(%rbx)
jl 0x76e08
movq (%rbx), %rax
movabsq $0x400000037, %rcx      # imm = 0x400000037
movq %rcx, 0x28(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x78(%rbx), %eax
cmpl $0x101, %eax            # imm = 0x101
jl 0x76e2e
movq (%rbx), %rax
movabsq $0x10000000039, %rcx    # imm = 0x10000000039
movq %rcx, 0x28(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x78(%rbx), %eax
movq 0x270(%rbx), %r10
movl 0x90(%rbx), %r14d
movslq %eax, %r12
pushq $0x1
popq %rcx
movq %rcx, %r13
incq %rcx
movl %ebp, %edx
movq %rcx, %rax
cmpl %r14d, %edx
jge 0x76e5a
imulq %rcx, %rax
incl %edx
jmp 0x76e4d
cmpq %r12, %rax
jle 0x76e42
cmpq $0x1, %r13
movq %r10, 0x8(%rsp)
ja 0x76e84
movq (%rbx), %rcx
movl $0x38, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq 0x8(%rsp), %r10
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
pushq $0x1
popq %rcx
cmpq %rax, %r14
je 0x76ea3
movl %r13d, 0x3c(%r10,%rax,4)
imull %r13d, %ecx
incq %rax
jmp 0x76e90
movl %ecx, 0x4(%rsp)
movb $0x1, %dil
xorl %esi, %esi
leaq 0x24add(%rip), %rcx     # 0x9b990
cmpq %r14, %rsi
je 0x76ee1
cmpl $0x2, 0x40(%rbx)
movl %esi, %eax
jne 0x76ec3
movl (%rcx,%rsi,4), %eax
movslq %eax, %r8
movslq 0x3c(%r10,%r8,4), %r9
movl 0x4(%rsp), %eax
cltd
idivl %r9d
cltq
incq %r9
imulq %r9, %rax
cmpq %r12, %rax
jle 0x76ef1
movl $0x0, %esi
testb $0x1, %dil
movb $0x1, %dil
je 0x76eb3
jmp 0x76f01
movl %r9d, 0x3c(%r10,%r8,4)
incq %rsi
xorl %edi, %edi
movl %eax, 0x4(%rsp)
jmp 0x76eb3
cmpl $0x3, 0x90(%rbx)
movq (%rbx), %rax
movl 0x4(%rsp), %ecx
movl %ecx, 0x2c(%rax)
jne 0x76f31
movl 0x3c(%r10), %ecx
movl %ecx, 0x30(%rax)
movl 0x40(%r10), %ecx
movl %ecx, 0x34(%rax)
movl 0x44(%r10), %ecx
movl %ecx, 0x38(%rax)
pushq $0x5e
popq %rdx
movq %rax, %rcx
jmp 0x76f37
movq (%rbx), %rcx
pushq $0x5f
popq %rdx
movl %edx, 0x28(%rax)
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq *0x8(%rcx)
movq 0x8(%rbx), %rax
movl 0x90(%rbx), %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl 0x4(%rsp), %ebp
movl %ebp, %edx
callq *0x10(%rax)
movq %rax, %rcx
movslq %ebp, %r9
xorl %r10d, %r10d
movq %rbx, 0x10(%rsp)
movslq 0x90(%rbx), %rax
cmpq %rax, %r10
jge 0x7700f
movq 0x8(%rsp), %rax
movslq 0x3c(%rax,%r10,4), %rbx
movl %ebp, %eax
cltd
idivl %ebx
movl %eax, %esi
movq %rbx, %rdi
decq %rdi
movl %edi, %eax
cltd
pushq $0x2
popq %r11
idivl %r11d
movslq %eax, %r14
xorl %r12d, %r12d
testl %esi, %esi
movl $0x0, %r13d
cmovgl %esi, %r13d
movslq %ebp, %r8
testl %ebx, %ebx
movl $0x0, %r11d
cmovgl %ebx, %r11d
xorl %ebx, %ebx
cmpq %r11, %r12
je 0x77000
movslq %ebx, %r15
imulq $0xff, %r12, %rax
addq %r14, %rax
cqto
idivq %rdi
cmpq %r9, %r15
jge 0x76ff9
xorl %edx, %edx
cmpq %rdx, %r13
je 0x76ff4
movq (%rcx,%r10,8), %rbp
addq %r15, %rbp
movb %al, (%rdx,%rbp)
incq %rdx
jmp 0x76fe0
addq %r8, %r15
jmp 0x76fd9
incq %r12
addl %esi, %ebx
jmp 0x76fc2
incq %r10
movl %esi, %ebp
movq 0x10(%rsp), %rbx
jmp 0x76f6e
movq 0x8(%rsp), %rax
movq %rcx, 0x20(%rax)
movl 0x4(%rsp), %ecx
movl %ecx, 0x28(%rax)
movq %rbx, %rdi
callq 0x77238
cmpl $0x2, 0x70(%rbx)
jne 0x77043
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x77370
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq