// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdapimin.c
// Function: jpeg_consume_input
GLOBAL(int)
jpeg_consume_input (j_decompress_ptr cinfo)
{
  int retcode = JPEG_SUSPENDED;

  /* NB: every possible DSTATE value should be listed in this switch */
  switch (cinfo->global_state) {
  case DSTATE_START:
    /* Start-of-datastream actions: reset appropriate modules */
    (*cinfo->inputctl->reset_input_controller) (cinfo);
    /* Initialize application's data source module */
    (*cinfo->src->init_source) (cinfo);
    cinfo->global_state = DSTATE_INHEADER;
    /*FALLTHROUGH*/
  case DSTATE_INHEADER:
    retcode = (*cinfo->inputctl->consume_input) (cinfo);
    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
      /* Set up default parameters based on header data */
      default_decompress_parms(cinfo);
      /* Set global state: ready for start_decompress */
      cinfo->global_state = DSTATE_READY;
    }
    break;
  case DSTATE_READY:
    /* Can't advance past first SOS until start_decompress is called */
    retcode = JPEG_REACHED_SOS;
    break;
  case DSTATE_PRELOAD:
  case DSTATE_PRESCAN:
  case DSTATE_SCANNING:
  case DSTATE_RAW_OK:
  case DSTATE_BUFIMAGE:
  case DSTATE_BUFPOST:
  case DSTATE_STOPPING:
    retcode = (*cinfo->inputctl->consume_input) (cinfo);
    break;
  default:
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  }
  return retcode;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x24(%rdi), %ecx
leal -0xc8(%rcx), %edx
cmpl $0xa, %edx
ja 0x7b8b5
movl $0x1, %eax
leaq 0x2eff7(%rip), %rsi     # 0xaa7e4
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movq 0x240(%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *(%rax)
movq 0x240(%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq 0x28(%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movl $0xc9, 0x24(%rbx)
movq 0x240(%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
cmpl $0x1, %eax
jne 0x7b980
movl 0x38(%rbx), %r14d
cmpl $0x1, %r14d
je 0x7b912
cmpl $0x4, %r14d
je 0x7b8d1
cmpl $0x3, %r14d
jne 0x7b917
movl $0x2, %ebp
movl $0x3, %r14d
cmpl $0x0, 0x174(%rbx)
jne 0x7b924
cmpl $0x0, 0x180(%rbx)
je 0x7b985
movzbl 0x184(%rbx), %eax
testl %eax, %eax
je 0x7b9c5
cmpl $0x1, %eax
je 0x7b924
movq (%rbx), %rcx
movl $0x72, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq *0x8(%rax)
jmp 0x7b924
movq (%rbx), %rax
movl $0x14, 0x28(%rax)
movl %ecx, 0x2c(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
xorl %eax, %eax
jmp 0x7b980
movl $0x4, %ebp
cmpl $0x0, 0x180(%rbx)
je 0x7b91e
movzbl 0x184(%rbx), %eax
testl %eax, %eax
je 0x7b91e
cmpl $0x2, %eax
je 0x7b90a
movq (%rbx), %rcx
movl $0x72, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq *0x8(%rax)
movl $0x5, %r14d
jmp 0x7b924
movl %r14d, %ebp
jmp 0x7b924
xorl %r14d, %r14d
xorl %ebp, %ebp
jmp 0x7b924
movl $0x4, %r14d
movl %r14d, 0x3c(%rbx)
movl %ebp, 0x40(%rbx)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x44(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x50(%rbx)
movaps 0x2e742(%rip), %xmm0    # 0xaa090
movups %xmm0, 0x58(%rbx)
movaps 0x2ee67(%rip), %xmm0    # 0xaa7c0
movups %xmm0, 0x68(%rbx)
movq $0x0, 0xa0(%rbx)
movss 0x2ee70(%rip), %xmm0    # 0xaa7e0
movups %xmm0, 0x78(%rbx)
movl $0xca, 0x24(%rbx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq 0x130(%rbx), %rdx
movl (%rdx), %eax
movl 0x60(%rdx), %ecx
movl 0xc0(%rdx), %edx
movl %eax, %esi
xorl $0x1, %esi
movl %ecx, %edi
xorl $0x2, %edi
orl %esi, %edi
movl %edx, %esi
xorl $0x3, %esi
orl %edi, %esi
je 0x7b924
movl %eax, %esi
xorl $0x52, %esi
movl %ecx, %edi
xorl $0x47, %edi
orl %esi, %edi
movl %edx, %esi
xorl $0x42, %esi
orl %edi, %esi
jne 0x7b9d0
movl $0x2, %r14d
jmp 0x7b924
movq (%rbx), %r8
movl %eax, 0x2c(%r8)
movl %ecx, 0x30(%r8)
movl %edx, 0x34(%r8)
movl $0x6f, 0x28(%r8)
movq %rbx, %rdi
movl $0x1, %esi
callq *0x8(%r8)
jmp 0x7b924