// File: /workspace/github_cpp_makefile_star2_O2/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, 0x1c(%rsp)
movq %rdi, %r12
movq 0x8(%rdi), %rax
pushq $0x1
popq %r15
pushq $0x30
popq %rdx
movl %r15d, %esi
callq *(%rax)
movq %rax, 0x1b0(%r12)
leaq 0x6af(%rip), %rcx       # 0x699a6
movq %rcx, (%rax)
leaq 0x864(%rip), %rcx       # 0x69b65
movq %rcx, 0x8(%rax)
leaq 0x880(%rip), %rcx       # 0x69b8c
movq %rcx, 0x10(%rax)
movq %rax, 0x20(%rsp)
andl $0x0, 0x1c(%rax)
movl 0x34(%r12), %eax
testl %eax, %eax
je 0x6933a
cmpl $0x0, 0x30(%r12)
je 0x6933a
cmpl $0x0, 0x4c(%r12)
jle 0x6933a
cmpl $0x0, 0x38(%r12)
jg 0x6934f
movq (%r12), %rax
movl $0x20, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x34(%r12), %eax
cmpl $0xffdc, %eax           # imm = 0xFFDC
ja 0x69362
movl 0x30(%r12), %eax
cmpl $0xffdd, %eax           # imm = 0xFFDD
jb 0x69382
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 0x693a3
movq (%r12), %rax
movl $0x46, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x48(%r12), %eax
cmpl $0x8, %eax
je 0x693c4
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 0x693f0
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)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x138(%r12)
movq 0x58(%r12), %r14
addq $0xc, %r14
xorl %ebp, %ebp
movl %r15d, %eax
movl 0x4c(%r12), %ecx
cmpl %ecx, %ebp
jge 0x69480
movl -0x4(%r14), %ecx
leal -0x5(%rcx), %edx
cmpl $-0x4, %edx
jb 0x69430
movl (%r14), %edx
leal -0x5(%rdx), %esi
cmpl $-0x5, %esi
ja 0x69457
movq (%r12), %rax
movl $0x12, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
movl 0x138(%r12), %eax
movl 0x13c(%r12), %r15d
movl -0x4(%r14), %ecx
movl (%r14), %edx
cmpl %ecx, %eax
cmovgl %eax, %ecx
movl %ecx, 0x138(%r12)
cmpl %edx, %r15d
cmovgl %r15d, %edx
movl %edx, 0x13c(%r12)
incl %ebp
addq $0x60, %r14
movl %edx, %r15d
movl %ecx, %eax
jmp 0x69410
movq 0x58(%r12), %r14
addq $0x30, %r14
xorl %ebp, %ebp
cmpl %ecx, %ebp
jge 0x69536
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 0x79150
movl %eax, -0x14(%r14)
movl 0x34(%r12), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r12), %rsi
shlq $0x3, %rsi
callq 0x79150
movl %eax, -0x10(%r14)
movl 0x30(%r12), %eax
movslq -0x28(%r14), %rdi
imulq %rax, %rdi
movslq 0x138(%r12), %rsi
callq 0x79150
movl %eax, -0x8(%r14)
movl 0x34(%r12), %eax
movslq -0x24(%r14), %rdi
imulq %rax, %rdi
movslq 0x13c(%r12), %rsi
callq 0x79150
movl %eax, -0x4(%r14)
movl $0x1, (%r14)
incl %ebp
movl 0x4c(%r12), %ecx
addq $0x60, %r14
jmp 0x6948b
movl 0x34(%r12), %edi
movslq 0x13c(%r12), %rsi
shlq $0x3, %rsi
callq 0x79150
movl %eax, 0x140(%r12)
movq 0xf8(%r12), %r13
leaq 0xf0(%r12), %rbx
testq %r13, %r13
je 0x698d4
cmpl $0x0, (%rbx)
jg 0x6958f
movq (%r12), %rax
movq $0x13, 0x28(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movq 0xf8(%r12), %r13
cmpl $0x0, 0x14(%r13)
jne 0x695c1
cmpl $0x3f, 0x18(%r13)
jne 0x695c1
andl $0x0, 0x134(%r12)
movl 0x4c(%r12), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x695f9
andl $0x0, 0x50(%rsp,%rcx,4)
incq %rcx
jmp 0x695b2
movl $0x1, 0x134(%r12)
leaq 0x80(%rsp), %rax
xorl %ecx, %ecx
cmpl 0x4c(%r12), %ecx
jge 0x695f9
xorl %edx, %edx
cmpl $0x100, %edx            # imm = 0x100
je 0x695f2
orl $-0x1, (%rax,%rdx)
addq $0x4, %rdx
jmp 0x695e0
incl %ecx
addq %rdx, %rax
jmp 0x695d7
pushq $0x1
popq %rbp
movq %rbx, 0x30(%rsp)
movq %r12, 0x10(%rsp)
cmpl (%rbx), %ebp
jg 0x69893
movl (%r13), %ebx
leal -0x5(%rbx), %eax
cmpl $-0x5, %eax
ja 0x6963c
movq (%r12), %rax
movl $0x1a, 0x28(%rax)
movl %ebx, 0x2c(%rax)
movq (%r12), %rax
movl $0x4, 0x30(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testl %ebx, %ebx
movl $0x0, %r15d
movq %rbx, 0x38(%rsp)
cmovgl %ebx, %r15d
xorl %r14d, %r14d
cmpq %r14, %r15
je 0x696a4
movl 0x4(%r13,%r14,4), %ebx
testl %ebx, %ebx
js 0x69665
cmpl 0x4c(%r12), %ebx
jl 0x6967c
movq (%r12), %rax
movl $0x13, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testq %r14, %r14
je 0x6969f
cmpl (%r13,%r14,4), %ebx
jg 0x6969f
movq (%r12), %rax
movl $0x13, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
incq %r14
jmp 0x69650
movq %r15, 0x28(%rsp)
movslq 0x14(%r13), %rbx
movq %r12, %rax
movslq 0x18(%r13), %r12
movl 0x1c(%r13), %r15d
movl 0x20(%r13), %ecx
movl %ecx, 0xc(%rsp)
cmpl $0x0, 0x134(%rax)
movl %ebp, 0x8(%rsp)
je 0x696f2
cmpl $0x3f, %ebx
jbe 0x69765
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
jmp 0x6978d
testl %ebx, %ebx
jne 0x69708
cmpl $0x3f, %r12d
jne 0x69708
testl %r15d, %r15d
jne 0x69708
cmpl $0x0, 0xc(%rsp)
je 0x6971f
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
xorl %ebx, %ebx
movq 0x28(%rsp), %rax
cmpq %rbx, %rax
je 0x6986c
movslq 0x4(%r13,%rbx,4), %r14
cmpl $0x0, 0x50(%rsp,%r14,4)
movl 0x8(%rsp), %ecx
je 0x69757
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x13, 0x28(%rax)
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movl $0x1, 0x50(%rsp,%r14,4)
incq %rbx
jmp 0x69721
cmpl %ebx, %r12d
jl 0x696d6
cmpl $0x3f, %r12d
jg 0x696d6
cmpl $0xa, %r15d
ja 0x696d6
cmpl $0xb, 0xc(%rsp)
jae 0x696d6
testl %ebx, %ebx
je 0x69885
cmpl $0x1, 0x38(%rsp)
je 0x697b3
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
leal -0x1(%r15), %ebp
xorl 0xc(%rsp), %ebp
xorl %ecx, %ecx
movq %r13, 0x48(%rsp)
movq %rbx, 0x40(%rsp)
cmpq 0x28(%rsp), %rcx
je 0x6986c
movslq 0x4(%r13,%rcx,4), %rax
shlq $0x8, %rax
leaq (%rsp,%rax), %r13
addq $0x80, %r13
testl %ebx, %ebx
movq %rcx, %r14
je 0x69812
cmpl $0x0, (%r13)
jns 0x69812
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movl 0x8(%rsp), %ecx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movq %r14, %rcx
cmpq %r12, %rbx
jg 0x6985a
movl (%r13,%rbx,4), %eax
testl %eax, %eax
js 0x69853
xorl %r15d, %eax
orl %ebp, %eax
je 0x69845
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
movl $0x11, 0x28(%rax)
movl 0x8(%rsp), %ecx
movl %ecx, 0x2c(%rax)
movq (%rdi), %rax
callq *(%rax)
movq %r14, %rcx
movl 0xc(%rsp), %eax
movl %eax, (%r13,%rbx,4)
incq %rbx
jmp 0x69812
testl %r15d, %r15d
jne 0x69827
jmp 0x69845
incq %rcx
movq 0x48(%rsp), %r13
movq 0x40(%rsp), %rbx
jmp 0x697c7
addq $0x24, %r13
movl 0x8(%rsp), %ebp
incl %ebp
movq 0x10(%rsp), %r12
movq 0x30(%rsp), %rbx
jmp 0x69606
testl %r12d, %r12d
jne 0x6979c
jmp 0x697b3
cmpl $0x0, 0x134(%r12)
je 0x698e3
leaq 0x80(%rsp), %rbx
xorl %r14d, %r14d
movslq 0x4c(%r12), %rax
cmpq %rax, %r14
jge 0x6990b
cmpl $0x0, (%rbx)
jns 0x698c8
movq (%r12), %rax
movl $0x2d, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
incq %r14
addq $0x100, %rbx            # imm = 0x100
jmp 0x698a9
andl $0x0, 0x134(%r12)
movl 0x1c(%rsp), %eax
jmp 0x69922
xorl %ebx, %ebx
movslq 0x4c(%r12), %rax
cmpq %rax, %rbx
jge 0x6990b
cmpl $0x0, 0x50(%rsp,%rbx,4)
jne 0x69906
movq (%r12), %rax
movl $0x2d, 0x28(%rax)
movq %r12, %rdi
callq *(%rax)
incq %rbx
jmp 0x698e5
cmpl $0x0, 0x134(%r12)
movl 0x1c(%rsp), %eax
je 0x69928
leaq 0x108(%r12), %rbx
movl $0x1, (%rbx)
testl %eax, %eax
je 0x6994a
cmpl $0x0, 0x108(%r12)
je 0x69973
movq 0x20(%rsp), %rax
movq $0x1, 0x20(%rax)
andl $0x0, 0x2c(%rax)
jmp 0x69967
movq 0x20(%rsp), %rcx
andl $0x0, 0x20(%rcx)
movl 0x108(%r12), %eax
andl $0x0, 0x2c(%rcx)
andl $0x0, 0x24(%rcx)
testl %eax, %eax
je 0x69984
movl 0xf0(%r12), %eax
addl %eax, %eax
jmp 0x6998c
movq 0x20(%rsp), %rax
movq $0x2, 0x20(%rax)
andl $0x0, 0x2c(%rax)
movl 0xf0(%r12), %eax
movq 0x20(%rsp), %rcx
movl %eax, 0x28(%rcx)
addq $0xa88, %rsp            # imm = 0xA88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq