// File: /workspace/github_c_makefile_star2_O3/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 0x258350
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 0x2584f8
movzbl 0x1(%rsi), %r9d
xorl %edx, %edx
cmpl $0xdb, %r9d
jg 0x258356
leal -0xd8(%r9), %r10d
cmpl $0x4, %r10d
jae 0x258381
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x4, %rdx
jl 0x2584f8
addq $0x4, %rsi
jmp 0x258402
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
retq
leal -0xdc(%r9), %eax
cmpl $0x4, %eax
jb 0x2584f3
cmpl $0xff, %r9d
jne 0x2583fe
cmpb $-0x3, (%rsi)
jbe 0x2583fe
jmp 0x2584f3
testl %r9d, %r9d
jne 0x2583fe
movzbl (%rsi), %r9d
movzbl 0x88(%rdi,%r9), %r9d
cmpq $0xa, %r9
ja 0x2583fe
leaq 0x173f70(%rip), %r10    # 0x3cc310
movslq (%r10,%r9,4), %r9
addq %r10, %r9
jmpq *%r9
leaq 0x2(%rsi), %r9
cmpq %r8, %r9
je 0x2584f8
cmpb $0x0, 0x3(%rsi)
jne 0x258405
cmpb $0x5d, (%r9)
jne 0x258405
leaq 0x4(%rsi), %rdx
cmpq %r8, %rdx
je 0x2584f8
cmpb $0x0, 0x5(%rsi)
jne 0x258405
cmpb $0x3e, (%rdx)
jne 0x258405
addq $0x6, %rsi
movl $0x28, %edx
jmp 0x2584f3
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x2, %rdx
jl 0x2584f8
addq $0x2, %rsi
movq %rsi, %r9
movl $0x6, %edx
cmpq %r8, %r9
je 0x2584f0
leaq 0x173f22(%rip), %rax    # 0x3cc33c
movzbl 0x1(%r9), %r10d
movl $0x2, %esi
cmpl $0xdb, %r10d
jg 0x25845c
leal -0xd8(%r10), %r11d
cmpl $0x4, %r11d
jae 0x258470
movq %r8, %r10
subq %r9, %r10
movl $0x4, %esi
cmpq $0x4, %r10
jl 0x2584f0
addq %rsi, %r9
cmpq %r8, %r9
jne 0x25841a
jmp 0x2584f0
cmpl $0xff, %r10d
jne 0x2584a0
cmpb $-0x3, (%r9)
jbe 0x25844f
jmp 0x2584f0
testl %r10d, %r10d
jne 0x25844f
movzbl (%r9), %r10d
movzbl 0x88(%rdi,%r10), %r10d
cmpq $0xa, %r10
ja 0x25844f
movslq (%rax,%r10,4), %r10
addq %rax, %r10
jmpq *%r10
movq %r8, %r10
subq %r9, %r10
cmpq $0x2, %r10
jge 0x25844f
jmp 0x2584f0
addl $0xffffff24, %r10d      # imm = 0xFFFFFF24
cmpl $0x4, %r10d
jae 0x25844f
jmp 0x2584f0
movq %r8, %r10
subq %r9, %r10
movl $0x3, %esi
cmpq $0x3, %r10
jge 0x25844f
jmp 0x2584f0
movq %r8, %rdx
subq %rsi, %rdx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq $0x3, %rdx
jl 0x2584f8
addq $0x3, %rsi
jmp 0x258402
leaq 0x2(%rsi), %r9
cmpq %r8, %r9
je 0x2584f8
movl $0x7, %edx
cmpb $0x0, 0x3(%rsi)
je 0x258504
movq %r9, %rsi
movq %rsi, (%rcx)
movl %edx, %eax
retq
addq $0x2, %rsi
movl $0x7, %edx
jmp 0x2584f3
movzbl 0x2(%rsi), %eax
addq $0x4, %rsi
cmpb $0xa, 0x88(%rdi,%rax)
cmovneq %r9, %rsi
jmp 0x2584f3