// File: /workspace/github_c_makefile_star2_O1/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 0x1746c7(%rip), %r8     # 0x3d5af0
xorl %r9d, %r9d
movl %r11d, %ebp
movq %rsi, %rbx
leaq 0x2(%rsi), %r10
movzbl 0x3(%rsi), %r14d
testl %r14d, %r14d
je 0x261465
movb $0x7, %sil
leal -0xd8(%r14), %r11d
cmpl $0x4, %r11d
jb 0x261471
leal -0xdc(%r14), %esi
cmpl $0x4, %esi
jae 0x26151e
movb $0x8, %sil
jmp 0x261471
movzbl (%r10), %esi
movb 0x88(%rdi,%rsi), %sil
movzbl %sil, %r15d
addl $-0x3, %r15d
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x1a, %r15d
ja 0x26142c
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 0x26142c
movq %r10, %rsi
movl $0x1, %r11d
cmpl %edx, %eax
jge 0x26142c
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
movq %r10, %rsi
jmp 0x26142c
xorl %r11d, %r11d
movq %r10, %rsi
cmpl $0x1, %ebp
je 0x26142c
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x2, %ebp
jne 0x26142c
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x26142c
movslq %eax, %rsi
shlq $0x5, %rsi
movb $0x0, 0x18(%rcx,%rsi)
movq %r10, %rsi
jmp 0x26142c
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0x2, %ebp
je 0x26142c
jmp 0x261767
cmpl $0xff, %r14d
jne 0x261534
cmpb $-0x3, (%r10)
jbe 0x261534
xorl %esi, %esi
jmp 0x261471
movb $0x1d, %sil
jmp 0x261471
movq %r10, %rsi
movl %ebp, %r11d
cmpl %edx, %eax
jge 0x26142c
movslq %eax, %rsi
shlq $0x5, %rsi
movb $0x0, 0x18(%rcx,%rsi)
movq %r10, %rsi
movl %ebp, %r11d
jmp 0x26142c
testl %ebp, %ebp
je 0x2616c4
addq $0x4, %rbx
movq %rbx, %rsi
movl %ebp, %r11d
jmp 0x26142c
cmpl $0x2, %ebp
jne 0x2616e6
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0xc, %r9d
jne 0x26142c
cmpl %edx, %eax
jge 0x2615a4
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, 0x10(%rcx,%rsi)
incl %eax
movl $0xc, %r9d
jmp 0x26161d
addq $0x3, %rbx
movq %rbx, %rsi
movl %ebp, %r11d
testl %ebp, %ebp
jne 0x26142c
movq %rbx, %rsi
movl $0x1, %r11d
cmpl %edx, %eax
jge 0x26142c
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
movq %rbx, %rsi
jmp 0x26142c
cmpl $0x2, %ebp
jne 0x2616ee
movl $0x2, %r11d
movq %r10, %rsi
cmpl $0xd, %r9d
jne 0x26142c
cmpl %edx, %eax
jge 0x261615
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, 0x10(%rcx,%rsi)
incl %eax
movl $0xd, %r9d
xorl %r11d, %r11d
movq %r10, %rsi
jmp 0x26142c
xorl %r11d, %r11d
movq %r10, %rsi
cmpl $0x1, %ebp
je 0x26142c
movq %r10, %rsi
movl %ebp, %r11d
cmpl $0x2, %ebp
jne 0x26142c
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x26142c
movslq %eax, %r15
shlq $0x5, %r15
cmpb $0x0, 0x18(%rcx,%r15)
movq %r10, %rsi
je 0x26142c
addq %rcx, %r15
testl %r14d, %r14d
jne 0x26175a
cmpq 0x8(%r15), %r10
je 0x26175a
cmpb $0x20, (%r10)
jne 0x26175a
movzbl 0x5(%rbx), %esi
testl %esi, %esi
je 0x26171d
movl $0x7, %ebp
leal -0xd8(%rsi), %r14d
cmpl $0x4, %r14d
jb 0x26174e
leal -0xdc(%rsi), %ebp
cmpl $0x4, %ebp
jae 0x261739
movl $0x8, %ebp
jmp 0x26174e
movl $0x1, %ebp
cmpl %edx, %eax
jge 0x261569
movslq %eax, %rsi
shlq $0x5, %rsi
movq %r10, (%rcx,%rsi)
movb $0x1, 0x18(%rcx,%rsi)
jmp 0x261569
movl $0xc, %r9d
jmp 0x2616f4
movl $0xd, %r9d
movl $0x2, %r11d
movq %r10, %rsi
cmpl %edx, %eax
jge 0x26142c
addq $0x4, %rbx
movslq %eax, %rsi
shlq $0x5, %rsi
movq %rbx, 0x8(%rcx,%rsi)
movq %r10, %rsi
jmp 0x26142c
cmpb $0x20, 0x4(%rbx)
je 0x26175a
testl %esi, %esi
jne 0x261699
movzbl 0x4(%rbx), %esi
movzbl 0x88(%rdi,%rsi), %ebp
jmp 0x26174e
cmpl $0xff, %esi
jne 0x261749
xorl %ebp, %ebp
cmpb $-0x3, 0x4(%rbx)
ja 0x26174e
movl $0x1d, %ebp
movq %r10, %rsi
cmpl %r9d, %ebp
jne 0x26142c
movb $0x0, 0x18(%r15)
movq %r10, %rsi
jmp 0x26142c
popq %rbx
popq %r14
popq %r15
popq %rbp
retq