// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/expat-2.0.1/lib/xmltok_impl.c
// Function: little2_cdataSectionTok
static int PTRCALL
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
                        const char *end, const char **nextTokPtr)
{
  if (ptr == end)
    return XML_TOK_NONE;
  if (MINBPC(enc) > 1) {
    size_t n = end - ptr;
    if (n & (MINBPC(enc) - 1)) {
      n &= ~(MINBPC(enc) - 1);
      if (n == 0)
        return XML_TOK_PARTIAL;
      end = ptr + n;
    }
  }
  switch (BYTE_TYPE(enc, ptr)) {
  case BT_RSQB:
    ptr += MINBPC(enc);
    if (ptr == end)
      return XML_TOK_PARTIAL;
    if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
      break;
    ptr += MINBPC(enc);
    if (ptr == end)
      return XML_TOK_PARTIAL;
    if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
      ptr -= MINBPC(enc);
      break;
    }
    *nextTokPtr = ptr + MINBPC(enc);
    return XML_TOK_CDATA_SECT_CLOSE;
  case BT_CR:
    ptr += MINBPC(enc);
    if (ptr == end)
      return XML_TOK_PARTIAL;
    if (BYTE_TYPE(enc, ptr) == BT_LF)
      ptr += MINBPC(enc);
    *nextTokPtr = ptr;
    return XML_TOK_DATA_NEWLINE;
  case BT_LF:
    *nextTokPtr = ptr + MINBPC(enc);
    return XML_TOK_DATA_NEWLINE;
  INVALID_CASES(ptr, nextTokPtr)
  default:
    ptr += MINBPC(enc);
    break;
  }
  while (ptr != end) {
    switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
    case BT_LEAD ## n: \
      if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \
        *nextTokPtr = ptr; \
        return XML_TOK_DATA_CHARS; \
      } \
      ptr += n; \
      break;
    LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
    case BT_NONXML:
    case BT_MALFORM:
    case BT_TRAIL:
    case BT_CR:
    case BT_LF:
    case BT_RSQB:
      *nextTokPtr = ptr;
      return XML_TOK_DATA_CHARS;
    default:
      ptr += MINBPC(enc);
      break;
    }
  }
  *nextTokPtr = ptr;
  return XML_TOK_DATA_CHARS;
}

// Assembly:
cmpq %rdx, %rsi
je 0x260d59
movq %rdx, %rax
subq %rsi, %rax
movq %rax, %r9
andq $-0x2, %r9
leaq (%rsi,%r9), %r8
testq %r9, %r9
cmoveq %rdx, %r8
setne %r9b
testb $0x1, %al
cmoveq %rdx, %r8
sete %dl
orb %r9b, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpb $0x1, %dl
jne 0x260f4b
movzbl 0x1(%rsi), %r9d
cmpl $0xdb, %r9d
jg 0x260d5f
movb $0x7, %dl
leal -0xd8(%r9), %r10d
cmpl $0x4, %r10d
jb 0x260d83
testl %r9d, %r9d
jne 0x260d81
movzbl (%rsi), %edx
movb 0x88(%rdi,%rdx), %dl
jmp 0x260d83
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
retq
leal -0xdc(%r9), %edx
cmpl $0x4, %edx
jae 0x260d6f
movb $0x8, %dl
jmp 0x260d83
cmpl $0xff, %r9d
jne 0x260d81
cmpb $-0x3, (%rsi)
jbe 0x260d81
xorl %edx, %edx
jmp 0x260d83
movb $0x1d, %dl
cmpb $0xa, %dl
ja 0x260e51
movzbl %dl, %edx
leaq 0x174cbe(%rip), %r9     # 0x3d5a54
movslq (%r9,%rdx,4), %rdx
addq %r9, %rdx
jmpq *%rdx
xorl %eax, %eax
jmp 0x260f48
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x3, %rdx
jl 0x260f4b
addq $0x3, %rsi
jmp 0x260e55
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x4, %rdx
jl 0x260f4b
addq $0x4, %rsi
jmp 0x260e55
leaq 0x2(%rsi), %rdx
cmpq %r8, %rdx
je 0x260f4b
cmpb $0x0, 0x3(%rsi)
je 0x260f2b
xorl %eax, %eax
jmp 0x260f39
leaq 0x2(%rsi), %rdx
cmpq %r8, %rdx
je 0x260f4b
cmpb $0x0, 0x3(%rsi)
jne 0x260e58
cmpb $0x5d, (%rdx)
jne 0x260e58
leaq 0x4(%rsi), %r9
cmpq %r8, %r9
je 0x260f4b
cmpb $0x0, 0x5(%rsi)
jne 0x260e58
cmpb $0x3e, (%r9)
jne 0x260e58
addq $0x6, %rsi
movl $0x28, %eax
jmp 0x260f48
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x2, %rdx
jl 0x260f4b
addq $0x2, %rsi
movq %rsi, %rdx
movl $0x6, %eax
cmpq %r8, %rdx
je 0x260f20
leaq 0x174c13(%rip), %rsi    # 0x3d5a80
movzbl 0x1(%rdx), %r9d
cmpl $0xdb, %r9d
jg 0x260e9e
movb $0x7, %r10b
leal -0xd8(%r9), %r11d
cmpl $0x4, %r11d
jb 0x260ec6
testl %r9d, %r9d
jne 0x260ec3
movzbl (%rdx), %r9d
movb 0x88(%rdi,%r9), %r10b
jmp 0x260ec6
leal -0xdc(%r9), %r10d
cmpl $0x4, %r10d
jae 0x260eb0
movb $0x8, %r10b
jmp 0x260ec6
cmpl $0xff, %r9d
jne 0x260ec3
cmpb $-0x3, (%rdx)
jbe 0x260ec3
xorl %r10d, %r10d
jmp 0x260ec6
movb $0x1d, %r10b
movl $0x2, %r9d
cmpb $0xa, %r10b
ja 0x260f14
movzbl %r10b, %r10d
movslq (%rsi,%r10,4), %r10
addq %rsi, %r10
jmpq *%r10
movq %r8, %r10
subq %rdx, %r10
cmpq $0x2, %r10
jge 0x260f14
jmp 0x260f20
movq %r8, %r10
subq %rdx, %r10
movl $0x3, %r9d
cmpq $0x3, %r10
jge 0x260f14
jmp 0x260f20
movq %r8, %r10
subq %rdx, %r10
movl $0x4, %r9d
cmpq $0x4, %r10
jl 0x260f20
addq %r9, %rdx
cmpq %r8, %rdx
jne 0x260e6d
movq %rdx, %rsi
jmp 0x260f48
addq $0x2, %rsi
jmp 0x260f43
movzbl (%rdx), %eax
cmpb $0xa, 0x88(%rdi,%rax)
sete %al
addq $0x4, %rsi
testb %al, %al
cmoveq %rdx, %rsi
movl $0x7, %eax
movq %rsi, (%rcx)
retq