// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r14
pushq %rbx
cmpq %rdx, %rsi
je 0x207c3e
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 0x207c43
movzbl 0x1(%rsi), %r9d
leal -0xd8(%r9), %edx
cmpl $0x4, %edx
jb 0x207cb7
xorl %edx, %edx
leal -0xdc(%r9), %r10d
cmpl $0x4, %r10d
jae 0x207c47
movq %rsi, (%rcx)
movl %edx, %eax
jmp 0x207c43
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
popq %rbx
popq %r14
retq
testl %r9d, %r9d
je 0x207c60
cmpl $0xff, %r9d
jne 0x207c5a
cmpb $-0x3, (%rsi)
ja 0x207c37
addq $0x2, %rsi
jmp 0x207cd1
movzbl (%rsi), %r9d
movzbl 0x88(%rdi,%r9), %r9d
cmpq $0xa, %r9
ja 0x207c5a
leaq 0x164c5a(%rip), %r10    # 0x36c8d4
movslq (%r10,%r9,4), %r9
addq %r10, %r9
jmpq *%r9
leaq 0x2(%rsi), %rbx
cmpq %r8, %rbx
je 0x207c43
cmpb $0x0, 0x3(%rsi)
jne 0x207cd4
cmpb $0x5d, (%rbx)
jne 0x207cd4
leaq 0x4(%rsi), %rdx
cmpq %r8, %rdx
je 0x207c43
cmpb $0x0, 0x5(%rsi)
jne 0x207cd4
cmpb $0x3e, (%rdx)
jne 0x207cd4
addq $0x6, %rsi
movl $0x28, %edx
jmp 0x207c37
movq %r8, %rax
subq %rsi, %rax
cmpq $0x4, %rax
jge 0x207ccd
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x207c43
addq $0x4, %rsi
movq %rsi, %rbx
movl $0x6, %edx
movabsq $0x2, %rax
movabsq $0x4, %r9
leaq 0x164c0c(%rip), %r10    # 0x36c900
movabsq $0x3, %r11
movq %rbx, %rsi
cmpq %r8, %rsi
je 0x207c37
movzbl 0x1(%rsi), %r14d
leal -0xd8(%r14), %ebx
cmpl $0x4, %ebx
jae 0x207d33
movq %r8, %r14
subq %rsi, %r14
movq %r9, %rbx
cmpq $0x4, %r14
jl 0x207c37
addq %rbx, %rsi
jmp 0x207d01
testl %r14d, %r14d
je 0x207d63
cmpl $0xff, %r14d
je 0x207d56
addl $0xffffff24, %r14d      # imm = 0xFFFFFF24
movq %rax, %rbx
cmpl $0x4, %r14d
jae 0x207d2e
jmp 0x207c37
cmpb $-0x3, (%rsi)
movq %rax, %rbx
jbe 0x207d2e
jmp 0x207c37
movzbl (%rsi), %ebx
movzbl 0x88(%rdi,%rbx), %r14d
movq %rax, %rbx
cmpq $0xa, %r14
ja 0x207d2e
movslq (%r10,%r14,4), %r14
addq %r10, %r14
movq %rax, %rbx
jmpq *%r14
movq %r8, %r14
subq %rsi, %r14
movq %rax, %rbx
cmpq $0x2, %r14
jge 0x207d2e
jmp 0x207c37
movq %r8, %r14
subq %rsi, %r14
movq %r11, %rbx
cmpq $0x3, %r14
jge 0x207d2e
jmp 0x207c37
movq %r8, %rax
subq %rsi, %rax
cmpq $0x2, %rax
jge 0x207c5a
jmp 0x207cc3
movq %r8, %rax
subq %rsi, %rax
cmpq $0x3, %rax
jl 0x207cc3
addq $0x3, %rsi
jmp 0x207cd1
leaq 0x2(%rsi), %r9
cmpq %r8, %r9
je 0x207c43
movl $0x7, %edx
cmpb $0x0, 0x3(%rsi)
je 0x207e09
movq %r9, %rsi
jmp 0x207c37
addq $0x2, %rsi
movl $0x7, %edx
jmp 0x207c37
movzbl 0x2(%rsi), %eax
addq $0x4, %rsi
cmpb $0xa, 0x88(%rdi,%rax)
cmovneq %r9, %rsi
jmp 0x207c37