// File: tomfunkhouser[P]gaps/pkgs/jpeg/jdmarker.c
// Function: get_interesting_appn
METHODDEF(jboolean)
get_interesting_appn (j_decompress_ptr cinfo)
/* Process an APP0 or APP14 marker without saving it */
{
  INT32 length;
  JOCTET b[APPN_DATA_LEN];
  unsigned int i, numtoread;
  INPUT_VARS(cinfo);

  INPUT_2BYTES(cinfo, length, return FALSE);
  length -= 2;

  /* get the interesting part of the marker data */
  if (length >= APPN_DATA_LEN)
    numtoread = APPN_DATA_LEN;
  else if (length > 0)
    numtoread = (unsigned int) length;
  else
    numtoread = 0;
  for (i = 0; i < numtoread; i++)
    INPUT_BYTE(cinfo, b[i], return FALSE);
  length -= numtoread;

  /* process it */
  switch (cinfo->unread_marker) {
  case M_APP0:
    examine_app0(cinfo, (JOCTET FAR *) b, numtoread, length);
    break;
  case M_APP14:
    examine_app14(cinfo, (JOCTET FAR *) b, numtoread, length);
    break;
  default:
    /* can't get here unless jpeg_save_markers chooses wrong processor */
    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
    break;
  }

  /* skip any remaining data -- could be lots */
  INPUT_SYNC(cinfo);
  if (length > 0)
    (*cinfo->src->skip_input_data) (cinfo, (long) length);

  return TRUE;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xe6057
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0xe603c
movl $0x0, 0x54(%rsp)
jmp 0xe62b0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
movzbl (%rax), %eax
shll $0x8, %eax
movl %eax, %eax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xe60c8
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0xe60ad
movl $0x0, 0x54(%rsp)
jmp 0xe62b0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
movzbl (%rax), %eax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
subq $0x2, %rax
movq %rax, 0x40(%rsp)
cmpq $0xe, 0x40(%rsp)
jl 0xe6114
movl $0xe, 0x28(%rsp)
jmp 0xe6131
cmpq $0x0, 0x40(%rsp)
jle 0xe6127
movq 0x40(%rsp), %rax
movl %eax, 0x28(%rsp)
jmp 0xe612f
movl $0x0, 0x28(%rsp)
jmp 0xe6131
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x28(%rsp), %eax
jae 0xe61c9
jmp 0xe6149
cmpq $0x0, 0x10(%rsp)
jne 0xe618e
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
callq *%rax
cmpl $0x0, %eax
jne 0xe6173
movl $0x0, 0x54(%rsp)
jmp 0xe62b0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rsp)
movb (%rax), %cl
movl 0x2c(%rsp), %eax
movb %cl, 0x32(%rsp,%rax)
jmp 0xe61b9
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0xe6139
movl 0x28(%rsp), %eax
movl %eax, %ecx
movq 0x40(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rax
movl 0x21c(%rax), %eax
movl %eax, 0xc(%rsp)
subl $0xe0, %eax
je 0xe6201
jmp 0xe61f4
movl 0xc(%rsp), %eax
subl $0xee, %eax
je 0xe621b
jmp 0xe6235
movq 0x48(%rsp), %rdi
leaq 0x32(%rsp), %rsi
movl 0x28(%rsp), %edx
movq 0x40(%rsp), %rcx
callq 0xe8b10
jmp 0xe626c
movq 0x48(%rsp), %rdi
leaq 0x32(%rsp), %rsi
movl 0x28(%rsp), %edx
movq 0x40(%rsp), %rcx
callq 0xe8ff0
jmp 0xe626c
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl $0x44, 0x28(%rax)
movq 0x48(%rsp), %rax
movl 0x21c(%rax), %ecx
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl %ecx, 0x2c(%rax)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x48(%rsp), %rdi
callq *%rax
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x40(%rsp)
jle 0xe62a8
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq *%rax
movl $0x1, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)