// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
pushq %rax
movq 0x240(%rdi), %r14
movl $0x2, %ebp
cmpl $0x0, 0x24(%r14)
je 0x7bbdb
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0x248(%rdi), %rax
callq *0x8(%rax)
cmpl $0x2, %eax
je 0x7bdd1
movl %eax, %ebp
cmpl $0x1, %eax
jne 0x7bbce
cmpl $0x0, 0x28(%r14)
je 0x7be05
cmpl $0xffdc, 0x34(%rbx)     # imm = 0xFFDC
ja 0x7bc15
cmpl $0xffdd, 0x30(%rbx)     # imm = 0xFFDD
jb 0x7bc2e
movq (%rbx), %rax
movabsq $0xffdc00000029, %rcx   # imm = 0xFFDC00000029
movq %rcx, 0x28(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x128(%rbx), %eax
cmpl $0x8, %eax
je 0x7bc4e
movq (%rbx), %rcx
movl $0xf, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x38(%rbx), %eax
cmpl $0xb, %eax
jl 0x7bc78
movq (%rbx), %rcx
movl $0x1a, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movl $0xa, 0x30(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl 0x38(%rbx), %eax
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x198(%rbx)
testl %eax, %eax
jle 0x7be4a
movq 0x130(%rbx), %r15
addq $0xc, %r15
xorl %ebp, %ebp
movl $0x1, %ecx
movl $0x1, %esi
movl -0x4(%r15), %edx
leal -0x5(%rdx), %edi
cmpl $-0x4, %edi
jb 0x7bcc1
movl (%r15), %edi
leal -0x5(%rdi), %r8d
cmpl $-0x5, %r8d
ja 0x7bce6
movq (%rbx), %rax
movl $0x12, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movl 0x38(%rbx), %eax
movl 0x198(%rbx), %esi
movl -0x4(%r15), %edx
movl (%r15), %edi
movl 0x19c(%rbx), %ecx
movl %ecx, %r8d
cmpl %edx, %esi
cmovgl %esi, %edx
movl %edx, 0x198(%rbx)
cmpl %edi, %ecx
movl %edi, %ecx
cmovgl %r8d, %ecx
movl %ecx, 0x19c(%rbx)
incl %ebp
addq $0x60, %r15
movl %edx, %esi
cmpl %eax, %ebp
jl 0x7bca8
movl $0x8, 0x1a0(%rbx)
testl %eax, %eax
jle 0x7be59
movq 0x130(%rbx), %r15
addq $0x8, %r15
xorl %ebp, %ebp
movl $0x8, 0x1c(%r15)
movl 0x30(%rbx), %eax
movslq (%r15), %rdi
imulq %rax, %rdi
movslq 0x198(%rbx), %rsi
shlq $0x3, %rsi
callq 0x85c94
movl %eax, 0x14(%r15)
movl 0x34(%rbx), %eax
movslq 0x4(%r15), %rdi
imulq %rax, %rdi
movslq 0x19c(%rbx), %rsi
shlq $0x3, %rsi
callq 0x85c94
movl %eax, 0x18(%r15)
movl 0x30(%rbx), %eax
movslq (%r15), %rdi
imulq %rax, %rdi
movslq 0x198(%rbx), %rsi
callq 0x85c94
movl %eax, 0x20(%r15)
movl 0x34(%rbx), %eax
movslq 0x4(%r15), %rdi
imulq %rax, %rdi
movslq 0x19c(%rbx), %rsi
callq 0x85c94
movl %eax, 0x24(%r15)
movl $0x1, 0x28(%r15)
movq $0x0, 0x48(%r15)
incl %ebp
addq $0x60, %r15
cmpl 0x38(%rbx), %ebp
jl 0x7bd2d
movl 0x19c(%rbx), %ecx
jmp 0x7be59
movl $0x1, 0x24(%r14)
cmpl $0x0, 0x28(%r14)
je 0x7be2d
movq 0x248(%rbx), %rax
cmpl $0x0, 0x1c(%rax)
je 0x7bbce
movq (%rbx), %rax
movl $0x3b, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
jmp 0x7bbce
cmpl $0x0, 0x20(%r14)
jne 0x7be1b
movq (%rbx), %rax
movl $0x23, 0x28(%rax)
movq %rbx, %rdi
callq *(%rax)
movq %rbx, %rdi
callq 0x7beec
movl $0x1, %ebp
jmp 0x7bbce
movl 0xac(%rbx), %eax
cmpl %eax, 0xb4(%rbx)
jle 0x7bbce
movl %eax, 0xb4(%rbx)
jmp 0x7bbce
movl $0x8, 0x1a0(%rbx)
movl $0x1, %ecx
movl 0x34(%rbx), %edi
shll $0x3, %ecx
movslq %ecx, %rsi
callq 0x85c94
movl %eax, 0x1a4(%rbx)
movl 0x1b0(%rbx), %ecx
movl $0x1, %ebp
movl $0x1, %eax
cmpl 0x38(%rbx), %ecx
jl 0x7be8e
xorl %eax, %eax
cmpl $0x0, 0x138(%rbx)
setne %al
movq 0x240(%rbx), %rcx
movl %eax, 0x20(%rcx)
movl $0x0, 0x28(%r14)
jmp 0x7bbce