// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdinput.c
// Function: consume_markers
METHODDEF(int)
consume_markers (j_decompress_ptr cinfo)
{
  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
  int val;

  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
    return JPEG_REACHED_EOI;

  val = (*cinfo->marker->read_markers) (cinfo);

  switch (val) {
  case JPEG_REACHED_SOS:	/* Found SOS */
    if (inputctl->inheaders) {	/* 1st SOS */
      initial_setup(cinfo);
      inputctl->inheaders = FALSE;
      /* Note: start_input_pass must be called by jdmaster.c
       * before any more input can be consumed.  jdapimin.c is
       * responsible for enforcing this sequencing.
       */
    } else {			/* 2nd or later SOS marker */
      if (! inputctl->pub.has_multiple_scans)
	ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
      start_input_pass(cinfo);
    }
    break;
  case JPEG_REACHED_EOI:	/* Found EOI */
    inputctl->pub.eoi_reached = TRUE;
    if (inputctl->inheaders) {	/* Tables-only datastream, apparently */
      if (cinfo->marker->saw_SOF)
	ERREXIT(cinfo, JERR_SOF_NO_SOS);
    } else {
      /* Prevent infinite loop in coef ctlr's decompress_data routine
       * if user set output_scan_number larger than number of scans.
       */
      if (cinfo->output_scan_number > cinfo->input_scan_number)
	cinfo->output_scan_number = cinfo->input_scan_number;
    }
    break;
  case JPEG_SUSPENDED:
    break;
  }

  return val;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x240(%rdi), %r15
movl $0x2, %ebx
cmpl $0x0, 0x24(%r15)
je 0x7c8d2
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
movq 0x248(%rdi), %rax
callq *0x8(%rax)
movl %eax, %ebx
cmpl $0x2, %eax
je 0x7cb12
cmpl $0x1, %ebx
jne 0x7c8c7
cmpl $0x0, 0x28(%r15)
je 0x7cb46
cmpl $0xffdc, 0x34(%r14)     # imm = 0xFFDC
ja 0x7c90e
cmpl $0xffdd, 0x30(%r14)     # imm = 0xFFDD
jb 0x7c927
movq (%r14), %rax
movabsq $0xffdc00000029, %rcx   # imm = 0xFFDC00000029
movq %rcx, 0x28(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movl 0x128(%r14), %eax
cmpl $0x8, %eax
je 0x7c948
movq (%r14), %rcx
movl $0xf, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movl 0x38(%r14), %eax
cmpl $0xb, %eax
jl 0x7c970
movq (%r14), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%r14), %rax
movl $0xa, 0x30(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x198(%r14)
cmpl $0x0, 0x38(%r14)
jle 0x7c9f5
movq 0x130(%r14), %r12
addq $0x8, %r12
xorl %ebp, %ebp
movl (%r12), %eax
addl $-0x5, %eax
cmpl $-0x4, %eax
jb 0x7c9ae
movl 0x4(%r12), %eax
addl $-0x5, %eax
cmpl $-0x5, %eax
ja 0x7c9bd
movq (%r14), %rax
movl $0x12, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
movq 0x198(%r14), %xmm0
movq (%r12), %xmm1
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
movq %xmm2, 0x198(%r14)
incl %ebp
addq $0x60, %r12
cmpl 0x38(%r14), %ebp
jl 0x7c995
movl $0x8, 0x1a0(%r14)
cmpl $0x0, 0x38(%r14)
jle 0x7cac1
movq 0x130(%r14), %r12
addq $0x8, %r12
xorl %ebp, %ebp
movl $0x8, 0x1c(%r12)
movl 0x30(%r14), %eax
movslq (%r12), %rdi
imulq %rax, %rdi
movslq 0x198(%r14), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, 0x14(%r12)
movl 0x34(%r14), %eax
movslq 0x4(%r12), %rdi
imulq %rax, %rdi
movslq 0x19c(%r14), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, 0x18(%r12)
movl 0x30(%r14), %eax
movslq (%r12), %rdi
imulq %rax, %rdi
movslq 0x198(%r14), %rsi
callq 0x86a9c
movl %eax, 0x20(%r12)
movl 0x34(%r14), %eax
movslq 0x4(%r12), %rdi
imulq %rax, %rdi
movslq 0x19c(%r14), %rsi
callq 0x86a9c
movl %eax, 0x24(%r12)
movl $0x1, 0x28(%r12)
movq $0x0, 0x48(%r12)
incl %ebp
addq $0x60, %r12
cmpl 0x38(%r14), %ebp
jl 0x7ca18
movl 0x34(%r14), %edi
movslq 0x19c(%r14), %rsi
shlq $0x3, %rsi
callq 0x86a9c
movl %eax, 0x1a4(%r14)
movl 0x1b0(%r14), %ecx
movl $0x1, %eax
cmpl 0x38(%r14), %ecx
jl 0x7cafb
xorl %eax, %eax
cmpl $0x0, 0x138(%r14)
setne %al
movq 0x240(%r14), %rcx
movl %eax, 0x20(%rcx)
movl $0x0, 0x28(%r15)
jmp 0x7c8c7
movl $0x1, 0x24(%r15)
cmpl $0x0, 0x28(%r15)
je 0x7cb69
movq 0x248(%r14), %rax
cmpl $0x0, 0x1c(%rax)
je 0x7c8c7
movq (%r14), %rax
movl $0x3b, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
jmp 0x7c8c7
cmpl $0x0, 0x20(%r15)
jne 0x7cb5c
movq (%r14), %rax
movl $0x23, 0x28(%rax)
movq %r14, %rdi
callq *(%rax)
movq %r14, %rdi
callq 0x7cbd0
jmp 0x7c8c7
movl 0xac(%r14), %eax
cmpl %eax, 0xb4(%r14)
jle 0x7c8c7
movl %eax, 0xb4(%r14)
jmp 0x7c8c7