// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa98, %rsp            # imm = 0xA98
movl %esi, 0x34(%rsp)
movq %rdi, %r12
movq 0x8(%rdi), %rax
movl $0x30, %edx
movl $0x1, %esi
callq *(%rax)
movq %rax, %rbx
movq %rax, 0x1b0(%r12)
leaq 0x73d(%rip), %rax       # 0x734f3
movq %rax, (%rbx)
leaq 0x8fb(%rip), %rax       # 0x736bb
movq %rax, 0x8(%rbx)
leaq 0x91a(%rip), %rax       # 0x736e5
movq %rax, 0x10(%rbx)
movl $0x0, 0x1c(%rbx)
movl 0x34(%r12), %eax
testl %eax, %eax
je 0x72df7
cmpl $0x0, 0x30(%r12)
je 0x72df7
cmpl $0x0, 0x4c(%r12)
jle 0x72df7
cmpl $0x0, 0x38(%r12)
jg 0x72e0c
movq (%r12), %rax
movl $0x20, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x34(%r12), %eax
cmpl $0xffdc, %eax           # imm = 0xFFDC
ja 0x72e1f
movl 0x30(%r12), %eax
cmpl $0xffdd, %eax           # imm = 0xFFDD
jb 0x72e3f
movq (%r12), %rax
movabsq $0xffdc00000029, %rcx   # imm = 0xFFDC00000029
movq %rcx, 0x28(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movl 0x30(%r12), %eax
movl %eax, %eax
movslq 0x38(%r12), %rcx
imulq %rax, %rcx
shrq $0x20, %rcx
je 0x72e60
movq (%r12), %rax
movl $0x46, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x48(%r12), %eax
cmpl $0x8, %eax
je 0x72e81
movq (%r12), %rcx
movl $0xf, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movl 0x4c(%r12), %eax
cmpl $0xb, %eax
jl 0x72eb2
movq (%r12), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r12), %rax
movl $0xa, 0x30(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movl 0x4c(%r12), %eax
movq %rbx, 0x38(%rsp)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x138(%r12)
testl %eax, %eax
jle 0x73018
movq 0x58(%r12), %r14
addq $0xc, %r14
xorl %ebx, %ebx
movl $0x1, %ecx
movl $0x1, %esi
movl -0x4(%r14), %edx
leal -0x5(%rdx), %edi
cmpl $-0x4, %edi
jb 0x72eff
movl (%r14), %edi
leal -0x5(%rdi), %r8d
cmpl $-0x5, %r8d
ja 0x72f2b
movq (%r12), %rax
movl $0x12, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x4c(%r12), %eax
movl 0x138(%r12), %esi
movl -0x4(%r14), %edx
movl (%r14), %edi
movl 0x13c(%r12), %ecx
movl %ecx, %r8d
cmpl %edx, %esi
cmovgl %esi, %edx
movl %edx, 0x138(%r12)
cmpl %edi, %ecx
movl %edi, %ecx
cmovgl %r8d, %ecx
movl %ecx, 0x13c(%r12)
incl %ebx
addq $0x60, %r14
movl %edx, %esi
cmpl %eax, %ebx
jl 0x72ee6
testl %eax, %eax
jle 0x7301d
movq 0x58(%r12), %r14
addq $0x30, %r14
xorl %ebp, %ebp
movl %ebp, -0x2c(%r14)
movl $0x8, -0xc(%r14)
movl 0x30(%r12), %eax
movslq -0x28(%r14), %rdi
imulq %rax, %rdi
movslq 0x138(%r12), %rsi
shlq $0x3, %rsi
callq 0x85c94
movl %eax, -0x14(%r14)
movl 0x34(%r12), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r12), %rsi
shlq $0x3, %rsi
callq 0x85c94
movl %eax, -0x10(%r14)
movl 0x30(%r12), %eax
movslq -0x28(%r14), %rdi
imulq %rax, %rdi
movslq 0x138(%r12), %rsi
callq 0x85c94
movl %eax, -0x8(%r14)
movl 0x34(%r12), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r12), %rsi
callq 0x85c94
movl %eax, -0x4(%r14)
movl $0x1, (%r14)
incl %ebp
addq $0x60, %r14
cmpl 0x4c(%r12), %ebp
jl 0x72f6a
movl 0x13c(%r12), %ecx
jmp 0x7301d
movl $0x1, %ecx
movl 0x34(%r12), %edi
shll $0x3, %ecx
movslq %ecx, %rsi
callq 0x85c94
movl %eax, 0x140(%r12)
movq 0xf8(%r12), %r13
leaq 0xf0(%r12), %r15
testq %r13, %r13
je 0x7341c
cmpl $0x0, (%r15)
jg 0x73071
movq (%r12), %rax
movq $0x13, 0x28(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movq 0xf8(%r12), %r13
cmpl $0x0, 0x14(%r13)
jne 0x730ab
cmpl $0x3f, 0x18(%r13)
jne 0x730ab
movl $0x0, 0x134(%r12)
movslq 0x4c(%r12), %r14
testq %r14, %r14
jle 0x734ec
movq %r14, %rdx
shlq $0x2, %rdx
leaq 0x60(%rsp), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
jmp 0x730da
movl $0x1, 0x134(%r12)
movslq 0x4c(%r12), %r14
movl $0x1, %ebx
testq %r14, %r14
jle 0x730df
movq %r14, %rdx
shlq $0x8, %rdx
leaq 0x90(%rsp), %rdi
movl $0xff, %esi
callq 0xe260
cmpl $0x0, (%r15)
jle 0x733da
movl $0x1, %eax
movq %rax, 0x8(%rsp)
movq %r12, 0x18(%rsp)
movq %r15, 0x40(%rsp)
movl (%r13), %r14d
leal -0x5(%r14), %eax
cmpl $-0x5, %eax
movq %r14, 0x28(%rsp)
ja 0x7313b
movq (%r12), %rax
movl $0x1a, 0x28(%rax)
movl %r14d, 0x2c(%rax)
movq (%r12), %rax
movl $0x4, 0x30(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testl %r14d, %r14d
jle 0x733c6
xorl %ebx, %ebx
movl 0x4(%r13,%rbx,4), %ebp
testl %ebp, %ebp
js 0x7314d
cmpl 0x4c(%r12), %ebp
jl 0x73169
movq (%r12), %rax
movl $0x13, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testq %rbx, %rbx
je 0x73191
cmpl (%r13,%rbx,4), %ebp
jg 0x73191
movq (%r12), %rax
movl $0x13, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
incq %rbx
cmpq %rbx, %r14
jne 0x7313d
movb $0x1, %bl
movslq 0x14(%r13), %rcx
movl 0x18(%r13), %eax
movl %eax, 0x14(%rsp)
movl 0x1c(%r13), %r15d
movl 0x20(%r13), %r14d
cmpl $0x0, 0x134(%r12)
je 0x7331e
movq %rcx, 0x20(%rsp)
cmpl $0x3f, %ecx
ja 0x731f2
movl 0x14(%rsp), %ecx
cmpl 0x20(%rsp), %ecx
setl %al
cmpl $0x40, %ecx
setge %cl
orb %al, %cl
cmpl $0xb, %r15d
setae %al
cmpl $0xb, %r14d
setae %dl
orb %al, %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x7320e
movq (%r12), %rax
movl $0x11, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
cmpl $0x0, 0x20(%rsp)
je 0x733b6
cmpl $0x1, 0x28(%rsp)
je 0x7323c
movq (%r12), %rax
movl $0x11, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testb %bl, %bl
je 0x73391
leal -0x1(%r15), %ebp
movl 0x14(%rsp), %eax
movl %eax, %r12d
movq 0x20(%rsp), %rax
subl %eax, %r12d
incl %r12d
leaq (%rsp,%rax,4), %rax
addq $0x90, %rax
movq %rax, 0x48(%rsp)
xorl %r14d, %ebp
xorl %eax, %eax
movq %r13, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movslq 0x4(%r13,%rax,4), %rbx
shlq $0x8, %rbx
movq 0x20(%rsp), %r13
testl %r13d, %r13d
je 0x732b6
leaq (%rsp,%rbx), %rax
addq $0x90, %rax
cmpl $0x0, (%rax)
jns 0x732b6
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
cmpl 0x14(%rsp), %r13d
jle 0x732d6
movq 0x58(%rsp), %rax
incq %rax
cmpq 0x28(%rsp), %rax
movq 0x50(%rsp), %r13
jne 0x73273
jmp 0x73391
addq 0x48(%rsp), %rbx
xorl %r13d, %r13d
movl (%rbx,%r13,4), %eax
testl %eax, %eax
js 0x73317
xorl %r15d, %eax
orl %ebp, %eax
je 0x73309
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movl %r14d, (%rbx,%r13,4)
incq %r13
cmpl %r13d, %r12d
jne 0x732de
jmp 0x732bd
testl %r15d, %r15d
jne 0x732ed
jmp 0x73309
testl %ecx, %ecx
jne 0x73333
cmpl $0x3f, 0x14(%rsp)
jne 0x73333
testl %r15d, %r15d
jne 0x73333
testl %r14d, %r14d
je 0x7334f
movq (%r12), %rax
movl $0x11, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testb %bl, %bl
je 0x73391
xorl %ebx, %ebx
movslq 0x4(%r13,%rbx,4), %r14
cmpl $0x0, 0x60(%rsp,%r14,4)
je 0x7337e
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
movl $0x13, 0x28(%rax)
movq 0x8(%rsp), %rcx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movl $0x1, 0x60(%rsp,%r14,4)
incq %rbx
cmpq %rbx, 0x28(%rsp)
jne 0x73355
addq $0x24, %r13
movq 0x8(%rsp), %rdx
leal 0x1(%rdx), %eax
movq 0x40(%rsp), %rcx
cmpl (%rcx), %edx
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %r12
jl 0x730fd
jmp 0x733cd
cmpl $0x0, 0x14(%rsp)
jne 0x73220
jmp 0x7323c
xorl %ebx, %ebx
jmp 0x7319b
movl 0x4c(%r12), %r14d
movl 0x134(%r12), %ebx
testl %ebx, %ebx
je 0x7342f
testl %r14d, %r14d
jle 0x7345d
leaq 0x90(%rsp), %rbx
xorl %r15d, %r15d
cmpl $0x0, (%rbx)
jns 0x73408
movq (%r12), %rax
movl $0x2d, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x4c(%r12), %r14d
incq %r15
movslq %r14d, %rax
addq $0x100, %rbx            # imm = 0x100
cmpq %rax, %r15
jl 0x733ee
jmp 0x7345d
movl $0x0, 0x134(%r12)
movq 0x38(%rsp), %rcx
jmp 0x73475
testl %r14d, %r14d
jle 0x7345d
xorl %ebx, %ebx
cmpl $0x0, 0x60(%rsp,%rbx,4)
jne 0x73452
movq (%r12), %rax
movl $0x2d, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x4c(%r12), %r14d
incq %rbx
movslq %r14d, %rax
cmpq %rax, %rbx
jl 0x73436
cmpl $0x0, 0x134(%r12)
movq 0x38(%rsp), %rcx
je 0x7347c
leaq 0x108(%r12), %r15
movl $0x1, (%r15)
cmpl $0x0, 0x34(%rsp)
je 0x7349f
cmpl $0x0, 0x108(%r12)
je 0x734c0
movq $0x1, 0x20(%rcx)
movl $0x0, 0x2c(%rcx)
jmp 0x734b4
xorl %eax, %eax
movl %eax, 0x20(%rcx)
cmpl %eax, 0x108(%r12)
movl %eax, 0x2c(%rcx)
movl %eax, 0x24(%rcx)
je 0x734cf
movl 0xf0(%r12), %eax
addl %eax, %eax
jmp 0x734d7
movq $0x2, 0x20(%rcx)
movl $0x0, 0x2c(%rcx)
movl 0xf0(%r12), %eax
movl %eax, 0x28(%rcx)
addq $0xa98, %rsp            # imm = 0xA98
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x730df