// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdmarker.c
// Function: get_sof
LOCAL(jboolean)
get_sof (j_decompress_ptr cinfo, jboolean is_prog, jboolean is_arith)
/* Process a SOFn marker */
{
  INT32 length;
  int c, ci;
  jpeg_component_info * compptr;
  INPUT_VARS(cinfo);

  cinfo->progressive_mode = is_prog;
  cinfo->arith_code = is_arith;

  INPUT_2BYTES(cinfo, length, return FALSE);

  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);

  length -= 8;

  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
	   (int) cinfo->image_width, (int) cinfo->image_height,
	   cinfo->num_components);

  if (cinfo->marker->saw_SOF)
    ERREXIT(cinfo, JERR_SOF_DUPLICATE);

  /* We don't support files in which the image height is initially specified */
  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  /* might as well have a general sanity check. */
  if (cinfo->image_height <= 0 || cinfo->image_width <= 0
      || cinfo->num_components <= 0)
    ERREXIT(cinfo, JERR_EMPTY_IMAGE);

  if (length != (cinfo->num_components * 3))
    ERREXIT(cinfo, JERR_BAD_LENGTH);

  if (cinfo->comp_info == NULL)	/* do only once, even if suspend */
    cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small)
			((j_common_ptr) cinfo, JPOOL_IMAGE,
			 cinfo->num_components * SIZEOF(jpeg_component_info));
  
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    compptr->component_index = ci;
    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
    INPUT_BYTE(cinfo, c, return FALSE);
    compptr->h_samp_factor = (c >> 4) & 15;
    compptr->v_samp_factor = (c     ) & 15;
    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);

    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
	     compptr->component_id, compptr->h_samp_factor,
	     compptr->v_samp_factor, compptr->quant_tbl_no);
  }

  cinfo->marker->saw_SOF = TRUE;

  INPUT_SYNC(cinfo);
  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %r14
movq (%r14), %r15
movq 0x8(%r14), %r12
movl %esi, 0x138(%rdi)
movl %edx, 0x13c(%rdi)
testq %r12, %r12
jne 0x7e3b0
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %ebp
decq %r12
je 0x7e3be
incq %r15
jmp 0x7e3d4
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %r13d
decq %r12
je 0x7e3e2
incq %r15
jmp 0x7e3f8
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
movl %eax, 0x128(%rbx)
decq %r12
je 0x7e40c
incq %r15
jmp 0x7e422
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
shll $0x8, %eax
movl %eax, 0x34(%rbx)
decq %r12
je 0x7e436
incq %r15
jmp 0x7e44c
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
addl %eax, 0x34(%rbx)
decq %r12
je 0x7e45d
incq %r15
jmp 0x7e473
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
shll $0x8, %eax
movl %eax, 0x30(%rbx)
decq %r12
je 0x7e487
incq %r15
jmp 0x7e49d
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
addl %eax, 0x30(%rbx)
decq %r12
je 0x7e4ae
incq %r15
jmp 0x7e4c4
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
shll $0x8, %ebp
orq %rbp, %r13
movzbl (%r15), %eax
movl %eax, 0x38(%rbx)
movq (%rbx), %rax
movl 0x21c(%rbx), %ecx
movl %ecx, 0x2c(%rax)
movl 0x30(%rbx), %ecx
movl %ecx, 0x30(%rax)
movl 0x34(%rbx), %ecx
movl %ecx, 0x34(%rax)
movl 0x38(%rbx), %ecx
movl %ecx, 0x38(%rax)
movl $0x64, 0x28(%rax)
movq %rbx, %rdi
movl $0x1, %esi
callq *0x8(%rax)
movq 0x248(%rbx), %rax
cmpl $0x0, 0x1c(%rax)
je 0x7e51d
movq (%rbx), %rax
movl $0x3a, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
addq $-0x8, %r13
cmpl $0x0, 0x34(%rbx)
je 0x7e533
cmpl $0x0, 0x30(%rbx)
je 0x7e533
cmpl $0x0, 0x38(%rbx)
jg 0x7e542
movq (%rbx), %rax
movl $0x20, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movslq 0x38(%rbx), %rax
leaq (%rax,%rax,2), %rax
cmpq %rax, %r13
je 0x7e55e
movq (%rbx), %rax
movl $0xb, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
cmpq $0x0, 0x130(%rbx)
jne 0x7e589
movq 0x8(%rbx), %rax
movslq 0x38(%rbx), %rcx
shlq $0x5, %rcx
leaq (%rcx,%rcx,2), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq *(%rax)
movq %rax, 0x130(%rbx)
incq %r15
decq %r12
cmpl $0x0, 0x38(%rbx)
jle 0x7e66b
movq 0x130(%rbx), %r13
addq $0x10, %r13
xorl %ebp, %ebp
movl %ebp, -0xc(%r13)
testq %r12, %r12
jne 0x7e5c5
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
movl %eax, -0x10(%r13)
decq %r12
je 0x7e5d7
incq %r15
jmp 0x7e5ed
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
movl %eax, %ecx
shrl $0x4, %ecx
andl $0xf, %eax
movl %ecx, -0x8(%r13)
movl %eax, -0x4(%r13)
decq %r12
je 0x7e60b
incq %r15
jmp 0x7e61d
movq %rbx, %rdi
callq *0x18(%r14)
testl %eax, %eax
je 0x7e687
movq (%r14), %r15
movq 0x8(%r14), %r12
movzbl (%r15), %eax
movl %eax, (%r13)
movq (%rbx), %rax
movl -0x10(%r13), %ecx
movl %ecx, 0x2c(%rax)
movl -0x8(%r13), %ecx
movl %ecx, 0x30(%rax)
movl -0x4(%r13), %ecx
movl %ecx, 0x34(%rax)
movl (%r13), %ecx
movl %ecx, 0x38(%rax)
movl $0x65, 0x28(%rax)
movq %rbx, %rdi
movl $0x1, %esi
callq *0x8(%rax)
incl %ebp
incq %r15
decq %r12
addq $0x60, %r13
cmpl 0x38(%rbx), %ebp
jl 0x7e5a6
movq 0x248(%rbx), %rax
movl $0x1, 0x1c(%rax)
movq %r15, (%r14)
movq %r12, 0x8(%r14)
movl $0x1, %eax
jmp 0x7e689
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq