// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/jpeg/jcmaster.c
// Function: select_scan_parameters
LOCAL(void)
select_scan_parameters (j_compress_ptr cinfo)
/* Set up the scan parameters for the current scan */
{
  int ci;

#ifdef C_MULTISCAN_FILES_SUPPORTED
  if (cinfo->scan_info != NULL) {
    /* Prepare for current scan --- the script is already validated */
    my_master_ptr master = (my_master_ptr) cinfo->master;
    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;

    cinfo->comps_in_scan = scanptr->comps_in_scan;
    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
      cinfo->cur_comp_info[ci] =
	&cinfo->comp_info[scanptr->component_index[ci]];
    }
    cinfo->Ss = scanptr->Ss;
    cinfo->Se = scanptr->Se;
    cinfo->Ah = scanptr->Ah;
    cinfo->Al = scanptr->Al;
  }
  else
#endif
  {
    /* Prepare for single sequential-JPEG scan containing all components */
    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
	       MAX_COMPS_IN_SCAN);
    cinfo->comps_in_scan = cinfo->num_components;
    for (ci = 0; ci < cinfo->num_components; ci++) {
      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
    }
    cinfo->Ss = 0;
    cinfo->Se = DCTSIZE2-1;
    cinfo->Ah = 0;
    cinfo->Al = 0;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0xf8(%rdi), %rax
testq %rax, %rax
je 0x737c0
movq 0x1b0(%rbx), %rcx
movslq 0x2c(%rcx), %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,4), %rax
movslq (%rax), %rcx
movl %ecx, 0x144(%rbx)
testq %rcx, %rcx
jle 0x737a4
movq 0x58(%rbx), %rdx
xorl %esi, %esi
movslq 0x4(%rax,%rsi,4), %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x5, %rdi
addq %rdx, %rdi
movq %rdi, 0x148(%rbx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x73784
movq 0x14(%rax), %rcx
movq %rcx, 0x19c(%rbx)
movl 0x1c(%rax), %ecx
movl %ecx, 0x1a4(%rbx)
movl 0x20(%rax), %eax
jmp 0x738bb
movl 0x4c(%rbx), %eax
cmpl $0x5, %eax
jl 0x737ea
movq (%rbx), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movl $0x4, 0x30(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x4c(%rbx), %eax
movl %eax, 0x144(%rbx)
testl %eax, %eax
jle 0x7389e
movq 0x58(%rbx), %rcx
movl %eax, %edx
incl %eax
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
shrl %eax
shlq $0x4, %rax
movdqa 0x2ea65(%rip), %xmm1    # 0xa2280
xorl %edx, %edx
movdqa 0x2ea6b(%rip), %xmm2    # 0xa2290
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x2ea6b(%rip), %xmm4    # 0xa22a0
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x7386f
movq %rcx, 0x148(%rbx,%rdx)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x7388a
leaq 0x60(%rcx), %rsi
movq %rsi, 0x150(%rbx,%rdx)
paddq %xmm4, %xmm1
addq $0x10, %rdx
addq $0xc0, %rcx
cmpq %rdx, %rax
jne 0x73835
movabsq $0x3f00000000, %rax     # imm = 0x3F00000000
movq %rax, 0x19c(%rbx)
movl $0x0, 0x1a4(%rbx)
xorl %eax, %eax
movl %eax, 0x1a8(%rbx)
popq %rbx
retq