// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
movq %rsi, %r13
xorl %eax, %eax
movl $0x1, %r8d
leaq 0x164743(%rip), %r9     # 0x36c970
movl %r8d, %ebp
xorl %r12d, %r12d
movl %ebp, %r10d
movq %r13, %rsi
leaq 0x2(%r13), %r14
movzbl 0x3(%r13), %ebx
movslq %eax, %r15
testl %ebx, %ebx
je 0x20828f
leal -0xd8(%rbx), %r11d
cmpl $0x4, %r11d
jb 0x2082f2
leal -0xdc(%rbx), %esi
movq %r14, %r13
movl %r10d, %ebp
cmpl $0x4, %esi
jb 0x208233
cmpl $0xff, %ebx
jne 0x2082bc
cmpb $-0x2, (%r14)
setb %sil
testl %r10d, %r10d
sete %r11b
movq %r14, %r13
movl %r10d, %ebp
testb %r11b, %sil
je 0x208233
jmp 0x2082cb
movzbl (%r14), %r11d
movzbl 0x88(%rdi,%r11), %r11d
addl $-0x3, %r11d
movq %r14, %r13
movl %r10d, %ebp
cmpl $0x1a, %r11d
ja 0x208233
movslq (%r9,%r11,4), %r11
addq %r9, %r11
movq %r14, %r13
movl %r10d, %ebp
jmpq *%r11
movq %r14, %r13
movl %r10d, %ebp
testl %r10d, %r10d
jne 0x208233
movq %r14, %r13
movl %r8d, %ebp
cmpl %edx, %eax
jge 0x208233
shlq $0x5, %r15
movq %r14, (%rcx,%r15)
movb $0x1, 0x18(%rcx,%r15)
movq %r14, %r13
movl %r8d, %ebp
jmp 0x208233
testl %r10d, %r10d
je 0x208306
addq $0x4, %rsi
movq %rsi, %r13
movl %r10d, %ebp
jmp 0x208233
movl %r8d, %r10d
cmpl %edx, %eax
jge 0x2082f7
shlq $0x5, %r15
movq %r14, (%rcx,%r15)
movb $0x1, 0x18(%rcx,%r15)
movl %r8d, %r10d
jmp 0x2082f7
xorl %ebp, %ebp
movq %r14, %r13
cmpl $0x1, %r10d
je 0x208233
movq %r14, %r13
movl %r10d, %ebp
cmpl $0x2, %r10d
jne 0x208233
movq %r14, %r13
movl $0x2, %ebp
cmpl %edx, %eax
jge 0x208233
shlq $0x5, %r15
movb $0x0, 0x18(%rcx,%r15)
movq %r14, %r13
jmp 0x208233
movq %r14, %r13
movl $0x2, %ebp
cmpl $0x2, %r10d
je 0x208233
jmp 0x20854c
addq $0x3, %rsi
movq %rsi, %r13
movl %r10d, %ebp
testl %r10d, %r10d
jne 0x208233
movq %rsi, %r13
movl %r8d, %ebp
cmpl %edx, %eax
jge 0x208233
shlq $0x5, %r15
movq %r14, (%rcx,%r15)
movb $0x1, 0x18(%rcx,%r15)
movq %rsi, %r13
movl %r8d, %ebp
jmp 0x208233
movq %r14, %r13
movl $0x2, %ebp
cmpl $0x2, %r10d
jne 0x2084d8
cmpl $0xc, %r12d
jne 0x208233
cmpl %edx, %eax
jge 0x2083db
shlq $0x5, %r15
movq %r14, 0x10(%rcx,%r15)
incl %eax
xorl %ebp, %ebp
movq %r14, %r13
movl $0xc, %r12d
jmp 0x208233
movq %r14, %r13
movl %r10d, %ebp
cmpl %edx, %eax
jge 0x208233
shlq $0x5, %r15
movb $0x0, 0x18(%rcx,%r15)
movq %r14, %r13
movl %r10d, %ebp
jmp 0x208233
movq %r14, %r13
movl $0x2, %ebp
cmpl $0x2, %r10d
jne 0x2084e0
cmpl $0xd, %r12d
jne 0x208233
cmpl %edx, %eax
jge 0x208439
shlq $0x5, %r15
movq %r14, 0x10(%rcx,%r15)
incl %eax
xorl %ebp, %ebp
movq %r14, %r13
movl $0xd, %r12d
jmp 0x208233
xorl %ebp, %ebp
movq %r14, %r13
cmpl $0x1, %r10d
je 0x208233
movq %r14, %r13
movl %r10d, %ebp
cmpl $0x2, %r10d
jne 0x208233
movq %r14, %r13
movl $0x2, %ebp
cmpl %edx, %eax
jge 0x208233
shlq $0x5, %r15
cmpb $0x0, 0x18(%rcx,%r15)
movq %r14, %r13
je 0x208233
addq %rcx, %r15
testl %ebx, %ebx
jne 0x20853f
cmpq 0x8(%r15), %r14
je 0x20853f
cmpb $0x20, (%r14)
jne 0x20853f
movzbl 0x5(%rsi), %ebx
leal -0xd8(%rbx), %r11d
movl $0x7, %r10d
cmpl $0x4, %r11d
jb 0x208533
leal -0xdc(%rbx), %r10d
cmpl $0x4, %r10d
jae 0x208503
movl $0x8, %r10d
jmp 0x208533
movl $0xc, %r12d
jmp 0x2084e6
movl $0xd, %r12d
cmpl %edx, %eax
jge 0x208233
addq $0x4, %rsi
shlq $0x5, %r15
movq %rsi, 0x8(%rcx,%r15)
movq %r14, %r13
jmp 0x208233
cmpl $0xff, %ebx
je 0x208524
testl %ebx, %ebx
jne 0x20852d
movzbl 0x4(%rsi), %esi
cmpq $0x20, %rsi
je 0x20853f
movzbl 0x88(%rdi,%rsi), %r10d
jmp 0x208533
xorl %r10d, %r10d
cmpb $-0x3, 0x4(%rsi)
ja 0x208533
movl $0x1d, %r10d
movq %r14, %r13
cmpl %r12d, %r10d
jne 0x208233
movb $0x0, 0x18(%r15)
movq %r14, %r13
jmp 0x208233
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq