// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jcmaster.c
// Function: jinit_c_master_control
GLOBAL(void)
jinit_c_master_control (j_compress_ptr cinfo, jboolean transcode_only)
{
  my_master_ptr master;

  master = (my_master_ptr)
      (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				  SIZEOF(my_comp_master));
  cinfo->master = (struct jpeg_comp_master *) master;
  master->pub.prepare_for_pass = prepare_for_pass;
  master->pub.pass_startup = pass_startup;
  master->pub.finish_pass = finish_pass_master;
  master->pub.is_last_pass = FALSE;

  /* Validate parameters, determine derived values */
  initial_setup(cinfo);

  if (cinfo->scan_info != NULL) {
#ifdef C_MULTISCAN_FILES_SUPPORTED
    validate_script(cinfo);
#else
    ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
  } else {
    cinfo->progressive_mode = FALSE;
    cinfo->num_scans = 1;
  }

  if (cinfo->progressive_mode)	/*  TEMPORARY HACK ??? */
    cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */

  /* Initialize my private state */
  if (transcode_only) {
    /* no main pass in transcoding */
    if (cinfo->optimize_coding)
      master->pass_type = huff_opt_pass;
    else
      master->pass_type = output_pass;
  } else {
    /* for normal compression, first pass is always this type: */
    master->pass_type = main_pass;
  }
  master->scan_number = 0;
  master->pass_number = 0;
  if (cinfo->optimize_coding)
    master->total_passes = cinfo->num_scans * 2;
  else
    master->total_passes = cinfo->num_scans;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa88, %rsp            # imm = 0xA88
movl %esi, 0x24(%rsp)
movq %rdi, %r15
movq 0x8(%rdi), %rax
movl $0x30, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %rbx
movq %rax, 0x1b0(%r15)
leaq 0x681(%rip), %rax       # 0x74476
movq %rax, (%rbx)
leaq 0x83f(%rip), %rax       # 0x7463e
movq %rax, 0x8(%rbx)
leaq 0x85e(%rip), %rax       # 0x74668
movq %rax, 0x10(%rbx)
movl $0x0, 0x1c(%rbx)
cmpl $0x0, 0x34(%r15)
je 0x73e31
cmpl $0x0, 0x30(%r15)
je 0x73e31
cmpl $0x0, 0x4c(%r15)
jle 0x73e31
cmpl $0x0, 0x38(%r15)
jg 0x73e40
movq (%r15), %rax
movl $0x20, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
cmpl $0xffdc, 0x34(%r15)     # imm = 0xFFDC
ja 0x73e54
cmpl $0xffdd, 0x30(%r15)     # imm = 0xFFDD
jb 0x73e6d
movq (%r15), %rax
movabsq $0xffdc00000029, %rcx   # imm = 0xFFDC00000029
movq %rcx, 0x28(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movl 0x30(%r15), %eax
movslq 0x38(%r15), %rcx
imulq %rax, %rcx
shrq $0x20, %rcx
je 0x73e8e
movq (%r15), %rax
movl $0x46, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
movl 0x48(%r15), %eax
cmpl $0x8, %eax
je 0x73eac
movq (%r15), %rcx
movl $0xf, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movq %rbx, 0x28(%rsp)
movl 0x4c(%r15), %eax
cmpl $0xb, %eax
jl 0x73ed9
movq (%r15), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r15), %rax
movl $0xa, 0x30(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x138(%r15)
cmpl $0x0, 0x4c(%r15)
jle 0x73f55
movq 0x58(%r15), %rbx
addq $0x8, %rbx
xorl %ebp, %ebp
movl (%rbx), %eax
addl $-0x5, %eax
cmpl $-0x4, %eax
jb 0x73f10
movl 0x4(%rbx), %eax
addl $-0x5, %eax
cmpl $-0x5, %eax
ja 0x73f1f
movq (%r15), %rax
movl $0x12, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
movq 0x138(%r15), %xmm0
movq (%rbx), %xmm1
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
movq %xmm2, 0x138(%r15)
incl %ebp
addq $0x60, %rbx
cmpl 0x4c(%r15), %ebp
jl 0x73efb
cmpl $0x0, 0x4c(%r15)
jle 0x74005
movq 0x58(%r15), %r14
addq $0x30, %r14
xorl %ebp, %ebp
movl %ebp, -0x2c(%r14)
movl $0x8, -0xc(%r14)
movl 0x30(%r15), %eax
movslq -0x28(%r14), %rdi
imulq %rax, %rdi
movslq 0x138(%r15), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, -0x14(%r14)
movl 0x34(%r15), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r15), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, -0x10(%r14)
movl 0x30(%r15), %eax
movslq -0x28(%r14), %rdi
imulq %rax, %rdi
movslq 0x138(%r15), %rsi
callq 0x86a9c
movl %eax, -0x8(%r14)
movl 0x34(%r15), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r15), %rsi
callq 0x86a9c
movl %eax, -0x4(%r14)
movl $0x1, (%r14)
incl %ebp
addq $0x60, %r14
cmpl 0x4c(%r15), %ebp
jl 0x73f6a
movl 0x34(%r15), %edi
movslq 0x13c(%r15), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, 0x140(%r15)
cmpq $0x0, 0xf8(%r15)
movq 0x28(%rsp), %rdx
je 0x743c2
cmpl $0x0, 0xf0(%r15)
jg 0x74050
movq (%r15), %rax
movq $0x13, 0x28(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movq 0xf8(%r15), %r12
cmpl $0x0, 0x14(%r12)
jne 0x74088
cmpl $0x3f, 0x18(%r12)
jne 0x74088
movl $0x0, 0x134(%r15)
movslq 0x4c(%r15), %rdx
testq %rdx, %rdx
jle 0x740b2
shlq $0x2, %rdx
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
jmp 0x740ad
movl $0x1, 0x134(%r15)
movslq 0x4c(%r15), %rdx
testq %rdx, %rdx
jle 0x740b2
shlq $0x8, %rdx
leaq 0x80(%rsp), %rdi
movl $0xff, %esi
callq 0xe260
cmpl $0x0, 0xf0(%r15)
jle 0x7437c
movl $0x1, %eax
movq %rax, (%rsp)
movq %r15, 0x10(%rsp)
movl (%r12), %r13d
leal -0x5(%r13), %eax
cmpl $-0x5, %eax
ja 0x740fb
movq (%r15), %rax
movl $0x1a, 0x28(%rax)
movl %r13d, 0x2c(%rax)
movq (%r15), %rax
movl $0x4, 0x30(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
testl %r13d, %r13d
jle 0x74156
xorl %ebx, %ebx
movl 0x4(%r12,%rbx,4), %ebp
testl %ebp, %ebp
js 0x74111
cmpl 0x4c(%r15), %ebp
jl 0x7412a
movq (%r15), %rax
movl $0x13, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
testq %rbx, %rbx
je 0x7414e
cmpl (%r12,%rbx,4), %ebp
jg 0x7414e
movq (%r15), %rax
movl $0x13, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
incq %rbx
cmpq %rbx, %r13
jne 0x74102
movslq 0x14(%r12), %rcx
movl 0x18(%r12), %eax
movl %eax, 0xc(%rsp)
movl 0x1c(%r12), %r14d
movl 0x20(%r12), %ebp
cmpl $0x0, 0x134(%r15)
je 0x742d9
movq %rcx, 0x18(%rsp)
cmpl $0x3f, %ecx
ja 0x741af
movl 0xc(%rsp), %ecx
cmpl 0x18(%rsp), %ecx
setl %al
cmpl $0x40, %ecx
setge %cl
orb %al, %cl
cmpl $0xb, %r14d
setae %al
cmpl $0xb, %ebp
setae %dl
orb %al, %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x741c8
movq (%r15), %rax
movl $0x11, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
cmpl $0x0, 0x18(%rsp)
je 0x7436c
cmpl $0x1, %r13d
je 0x741f2
movq (%r15), %rax
movl $0x11, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
movq %r13, 0x40(%rsp)
testl %r13d, %r13d
jle 0x74349
leal -0x1(%r14), %r13d
movl 0xc(%rsp), %eax
movl %eax, %r15d
movq 0x18(%rsp), %rax
subl %eax, %r15d
incl %r15d
leaq (%rsp,%rax,4), %rax
addq $0x80, %rax
movq %rax, 0x30(%rsp)
xorl %ebp, %r13d
xorl %eax, %eax
movq %r12, 0x38(%rsp)
movq %rax, 0x48(%rsp)
movslq 0x4(%r12,%rax,4), %rbx
shlq $0x8, %rbx
movq 0x18(%rsp), %r12
testl %r12d, %r12d
je 0x74271
leaq (%rsp,%rbx), %rax
addq $0x80, %rax
cmpl $0x0, (%rax)
jns 0x74271
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
cmpl 0xc(%rsp), %r12d
jle 0x74291
movq 0x48(%rsp), %rax
incq %rax
cmpq 0x40(%rsp), %rax
movq 0x38(%rsp), %r12
jne 0x7422f
jmp 0x74349
addq 0x30(%rsp), %rbx
xorl %r12d, %r12d
movl (%rbx,%r12,4), %eax
testl %eax, %eax
js 0x742d2
xorl %r14d, %eax
orl %r13d, %eax
je 0x742c4
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movl %ebp, (%rbx,%r12,4)
incq %r12
cmpl %r12d, %r15d
jne 0x74299
jmp 0x74278
testl %r14d, %r14d
jne 0x742a9
jmp 0x742c4
testl %ecx, %ecx
jne 0x742ed
cmpl $0x3f, 0xc(%rsp)
jne 0x742ed
testl %r14d, %r14d
jne 0x742ed
testl %ebp, %ebp
je 0x74306
movq (%r15), %rax
movl $0x11, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
testl %r13d, %r13d
jle 0x74349
movq %r13, %r15
xorl %ebx, %ebx
movslq 0x4(%r12,%rbx,4), %r14
cmpl $0x0, 0x50(%rsp,%r14,4)
je 0x74338
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x13, 0x28(%rax)
movq (%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movl $0x1, 0x50(%rsp,%r14,4)
incq %rbx
cmpq %rbx, %r15
jne 0x74310
addq $0x24, %r12
movq (%rsp), %rcx
leal 0x1(%rcx), %eax
movq 0x10(%rsp), %r15
cmpl 0xf0(%r15), %ecx
movq %rax, (%rsp)
jl 0x740ce
jmp 0x7437c
cmpl $0x0, 0xc(%rsp)
jne 0x741d9
jmp 0x741f2
cmpl $0x0, 0x134(%r15)
movl 0x4c(%r15), %eax
je 0x743da
testl %eax, %eax
jle 0x74402
leaq 0x80(%rsp), %rbx
xorl %r14d, %r14d
cmpl $0x0, (%rbx)
jns 0x743ad
movq (%r15), %rax
movl $0x2d, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
incq %r14
movslq 0x4c(%r15), %rax
addq $0x100, %rbx            # imm = 0x100
cmpq %rax, %r14
jl 0x74399
jmp 0x74402
movl $0x0, 0x134(%r15)
movl $0x1, 0xf0(%r15)
jmp 0x74407
testl %eax, %eax
jle 0x74402
xorl %ebx, %ebx
cmpl $0x0, 0x50(%rsp,%rbx,4)
jne 0x743f6
movq (%r15), %rax
movl $0x2d, 0x28(%rax)
movq %r15, %rdi
callq *(%rax)
incq %rbx
movslq 0x4c(%r15), %rax
cmpq %rax, %rbx
jl 0x743e0
movq 0x28(%rsp), %rdx
cmpl $0x0, 0x134(%r15)
je 0x7441c
movl $0x1, 0x108(%r15)
cmpl $0x0, 0x24(%rsp)
je 0x74436
cmpl $0x0, 0x108(%r15)
je 0x7443f
movl $0x1, 0x20(%rdx)
jmp 0x74446
movl $0x0, 0x20(%rdx)
jmp 0x74446
movl $0x2, 0x20(%rdx)
xorl %eax, %eax
movl %eax, 0x2c(%rdx)
movl %eax, 0x24(%rdx)
cmpl %eax, 0x108(%r15)
setne %cl
movl 0xf0(%r15), %eax
shll %cl, %eax
movl %eax, 0x28(%rdx)
addq $0xa88, %rsp            # imm = 0xA88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq