// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/expat-2.0.1/lib/xmltok_impl.c
// Function: little2_getAtts
static int PTRCALL
PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
                int attsMax, ATTRIBUTE *atts)
{
  enum { other, inName, inValue } state = inName;
  int nAtts = 0;
  int open = 0; /* defined when state == inValue;
                   initialization just to shut up compilers */

  for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) {
    switch (BYTE_TYPE(enc, ptr)) {
#define START_NAME \
      if (state == other) { \
        if (nAtts < attsMax) { \
          atts[nAtts].name = ptr; \
          atts[nAtts].normalized = 1; \
        } \
        state = inName; \
      }
#define LEAD_CASE(n) \
    case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break;
    LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
    case BT_NONASCII:
    case BT_NMSTRT:
    case BT_HEX:
      START_NAME
      break;
#undef START_NAME
    case BT_QUOT:
      if (state != inValue) {
        if (nAtts < attsMax)
          atts[nAtts].valuePtr = ptr + MINBPC(enc);
        state = inValue;
        open = BT_QUOT;
      }
      else if (open == BT_QUOT) {
        state = other;
        if (nAtts < attsMax)
          atts[nAtts].valueEnd = ptr;
        nAtts++;
      }
      break;
    case BT_APOS:
      if (state != inValue) {
        if (nAtts < attsMax)
          atts[nAtts].valuePtr = ptr + MINBPC(enc);
        state = inValue;
        open = BT_APOS;
      }
      else if (open == BT_APOS) {
        state = other;
        if (nAtts < attsMax)
          atts[nAtts].valueEnd = ptr;
        nAtts++;
      }
      break;
    case BT_AMP:
      if (nAtts < attsMax)
        atts[nAtts].normalized = 0;
      break;
    case BT_S:
      if (state == inName)
        state = other;
      else if (state == inValue
               && nAtts < attsMax
               && atts[nAtts].normalized
               && (ptr == atts[nAtts].valuePtr
                   || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE
                   || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE
                   || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open))
        atts[nAtts].normalized = 0;
      break;
    case BT_CR: case BT_LF:
      /* This case ensures that the first attribute name is counted
         Apart from that we could just change state on the quote. */
      if (state == inName)
        state = other;
      else if (state == inValue && nAtts < attsMax)
        atts[nAtts].normalized = 0;
      break;
    case BT_GT:
    case BT_SOL:
      if (state != inValue)
        return nAtts;
      break;
    default:
      break;
    }
  }
  /* not reached */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %eax, %eax
movl $0x1, %r11d
leaq 0x173ab8(%rip), %r8     # 0x3cc3ac
xorl %r9d, %r9d
movl %r11d, %ebp
movq %rsi, %rbx
leaq 0x2(%rsi), %r10
movzbl 0x3(%rsi), %r14d
testl %r14d, %r14d
je 0x258950
leal -0xd8(%r14), %esi
cmpl $0x4, %esi
jb 0x2589b4
leal -0xdc(%r14), %ebx
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x4, %ebx
jb 0x2588f7
cmpl $0xff, %r14d
jne 0x25897d
cmpb $-0x2, (%r10)
setb %bl
testl %ebp, %ebp
sete %r14b
movq %r10, %rsi
movl %ebp, %r11d
testb %r14b, %bl
je 0x2588f7
jmp 0x25898b
movzbl (%r10), %esi
movzbl 0x88(%rdi,%rsi), %r15d
addl $-0x3, %r15d
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x1a, %r15d
ja 0x2588f7
movslq (%r8,%r15,4), %r15
addq %r8, %r15
movq %r10, %rsi
movl %ebp, %r11d
jmpq *%r15
movq %r10, %rsi
movl %ebp, %r11d
testl %ebp, %ebp
jne 0x2588f7
movq %r10, %rsi
movl $0x1, %r11d
cmpl %edx, %eax
jge 0x2588f7
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
movq %r10, %rsi
jmp 0x2588f7
testl %ebp, %ebp
je 0x2589c7
addq $0x4, %rbx
movq %rbx, %rsi
movl %ebp, %r11d
jmp 0x2588f7
movl $0x1, %ebp
cmpl %edx, %eax
jge 0x2589b8
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
jmp 0x2589b8
xorl %r11d, %r11d
movq %r10, %rsi
cmpl $0x1, %ebp
je 0x2588f7
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x2, %ebp
jne 0x2588f7
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x2588f7
movslq %eax, %rsi
shlq $0x5, %rsi
movb $0x0, 0x18(%rcx,%rsi)
movq %r10, %rsi
jmp 0x2588f7
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0x2, %ebp
je 0x2588f7
jmp 0x258c23
addq $0x3, %rbx
movq %rbx, %rsi
movl %ebp, %r11d
testl %ebp, %ebp
jne 0x2588f7
movq %rbx, %rsi
movl $0x1, %r11d
cmpl %edx, %eax
jge 0x2588f7
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
movq %rbx, %rsi
jmp 0x2588f7
cmpl $0x2, %ebp
jne 0x258bac
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0xc, %r9d
jne 0x2588f7
cmpl %edx, %eax
jge 0x258aa3
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, 0x10(%rcx,%rsi)
incl %eax
movl $0xc, %r9d
jmp 0x258b06
movq %r10, %rsi
movl %ebp, %r11d
cmpl %edx, %eax
jge 0x2588f7
movslq %eax, %rsi
shlq $0x5, %rsi
movb $0x0, 0x18(%rcx,%rsi)
movq %r10, %rsi
movl %ebp, %r11d
jmp 0x2588f7
cmpl $0x2, %ebp
jne 0x258bb4
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0xd, %r9d
jne 0x2588f7
cmpl %edx, %eax
jge 0x258afe
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, 0x10(%rcx,%rsi)
incl %eax
movl $0xd, %r9d
xorl %r11d, %r11d
movq %r10, %rsi
jmp 0x2588f7
xorl %r11d, %r11d
movq %r10, %rsi
cmpl $0x1, %ebp
je 0x2588f7
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x2, %ebp
jne 0x2588f7
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x2588f7
movslq %eax, %r15
shlq $0x5, %r15
cmpb $0x0, 0x18(%rcx,%r15)
movq %r10, %rsi
je 0x2588f7
addq %rcx, %r15
testl %r14d, %r14d
jne 0x258c16
cmpq 0x8(%r15), %r10
je 0x258c16
cmpb $0x20, (%r10)
jne 0x258c16
movzbl 0x5(%rbx), %esi
cmpl $0xdb, %esi
jg 0x258be3
movl $0x7, %ebp
leal -0xd8(%rsi), %r14d
cmpl $0x4, %r14d
jb 0x258c0a
testl %esi, %esi
jne 0x258c05
movzbl 0x4(%rbx), %esi
cmpq $0x20, %rsi
je 0x258c16
movzbl 0x88(%rdi,%rsi), %ebp
jmp 0x258c0a
movl $0xc, %r9d
jmp 0x258bba
movl $0xd, %r9d
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x2588f7
addq $0x4, %rbx
movslq %eax, %rsi
shlq $0x5, %rsi
movq %rbx, 0x8(%rcx,%rsi)
movq %r10, %rsi
jmp 0x2588f7
leal -0xdc(%rsi), %ebp
cmpl $0x4, %ebp
jae 0x258bf5
movl $0x8, %ebp
jmp 0x258c0a
cmpl $0xff, %esi
jne 0x258c05
xorl %ebp, %ebp
cmpb $-0x3, 0x4(%rbx)
ja 0x258c0a
movl $0x1d, %ebp
movq %r10, %rsi
cmpl %r9d, %ebp
jne 0x2588f7
movb $0x0, 0x18(%r15)
movq %r10, %rsi
jmp 0x2588f7
popq %rbx
popq %r14
popq %r15
popq %rbp
retq