// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x24(%rdi), %eax
leal -0xc8(%rax), %ecx
cmpl $0xa, %ecx
ja 0x6ecaa
pushq $0x1
popq %rbp
leaq 0x2c982(%rip), %rdx     # 0x9b564
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x240(%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
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 0x6eda5
movl 0x38(%rbx), %r15d
cmpl $0x1, %r15d
je 0x6ed02
cmpl $0x4, %r15d
je 0x6ecc6
cmpl $0x3, %r15d
jne 0x6ed07
pushq $0x2
popq %r14
pushq $0x3
popq %r15
cmpl $0x0, 0x174(%rbx)
jne 0x6ed4e
cmpl $0x0, 0x180(%rbx)
je 0x6ed0f
movzbl 0x184(%rbx), %eax
testl %eax, %eax
je 0x6ed4b
cmpl $0x1, %eax
je 0x6ed4e
movq (%rbx), %rcx
movl $0x72, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq *0x8(%rax)
jmp 0x6ed4e
movq (%rbx), %rcx
movl $0x14, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
xorl %eax, %eax
jmp 0x6eda5
pushq $0x4
popq %r14
cmpl $0x0, 0x180(%rbx)
je 0x6ed4b
movzbl 0x184(%rbx), %eax
testl %eax, %eax
je 0x6ed4b
cmpl $0x2, %eax
je 0x6ecfc
movq (%rbx), %rcx
movl $0x72, 0x28(%rcx)
movl %eax, 0x2c(%rcx)
movq (%rbx), %rax
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq *0x8(%rax)
pushq $0x5
popq %r15
jmp 0x6ed4e
movl %r15d, %r14d
jmp 0x6ed4e
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x6ed4e
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 0x6ed4e
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 0x6edb0
movl %r14d, %r15d
movl %r15d, 0x3c(%rbx)
movl %r14d, 0x40(%rbx)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x44(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x50(%rbx)
movaps 0x2c7b7(%rip), %xmm0    # 0x9b530
movups %xmm0, 0x58(%rbx)
movaps 0x2c7bc(%rip), %xmm0    # 0x9b540
movups %xmm0, 0x68(%rbx)
andq $0x0, 0xa0(%rbx)
movss 0x2c7c8(%rip), %xmm0    # 0x9b560
movups %xmm0, 0x78(%rbx)
movl $0xca, 0x24(%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %r8
movl %eax, 0x2c(%r8)
movl %ecx, 0x30(%r8)
movl %edx, 0x34(%r8)
movl $0x6f, 0x28(%r8)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq *0x8(%r8)
jmp 0x6ed4e