// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/sam.c
// Function: sam_parse1
int sam_parse1(kstring_t *s, sam_hdr_t *h, bam1_t *b)
{
#define _read_token(_p) (_p); do { char *tab = strchr((_p), '\t'); if (!tab) goto err_ret; *tab = '\0'; (_p) = tab + 1; } while (0)

#if HTS_ALLOW_UNALIGNED != 0 && ULONG_MAX == 0xffffffffffffffff

// Macro that operates on 64-bits at a time.
#define COPY_MINUS_N(to,from,n,l,failed)                        \
    do {                                                        \
        uint64_u *from8 = (uint64_u *)(from);                   \
        uint64_u *to8 = (uint64_u *)(to);                       \
        uint64_t uflow = 0;                                     \
        size_t l8 = (l)>>3, i;                                  \
        for (i = 0; i < l8; i++) {                              \
            to8[i] = from8[i] - (n)*0x0101010101010101UL;       \
            uflow |= to8[i];                                    \
        }                                                       \
        for (i<<=3; i < (l); ++i) {                             \
            to[i] = from[i] - (n);                              \
            uflow |= to[i];                                     \
        }                                                       \
        failed = (uflow & 0x8080808080808080UL) > 0;            \
    } while (0)

#else

// Basic version which operates a byte at a time
#define COPY_MINUS_N(to,from,n,l,failed) do {                \
        uint8_t uflow = 0;                                   \
        for (i = 0; i < (l); ++i) {                          \
            (to)[i] = (from)[i] - (n);                       \
            uflow |= (uint8_t) (to)[i];                      \
        }                                                    \
        failed = (uflow & 0x80) > 0;                         \
    } while (0)

#endif

#define _get_mem(type_t, x, b, l) if (possibly_expand_bam_data((b), (l)) < 0) goto err_ret; *(x) = (type_t*)((b)->data + (b)->l_data); (b)->l_data += (l)
#define _parse_err(cond, ...) do { if (cond) { hts_log_error(__VA_ARGS__); goto err_ret; } } while (0)
#define _parse_warn(cond, ...) do { if (cond) { hts_log_warning(__VA_ARGS__); } } while (0)

    uint8_t *t;

    char *p = s->s, *q;
    int i, overflow = 0;
    char logbuf[40];
    hts_pos_t cigreflen;
    bam1_core_t *c = &b->core;

    b->l_data = 0;
    memset(c, 0, 32);

    // qname
    q = _read_token(p);

    _parse_warn(p - q <= 1, "empty query name");
    _parse_err(p - q > 255, "query name too long");
    // resize large enough for name + extranul
    if (possibly_expand_bam_data(b, (p - q) + 4) < 0) goto err_ret;
    memcpy(b->data + b->l_data, q, p-q); b->l_data += p-q;

    c->l_extranul = (4 - (b->l_data & 3)) & 3;
    memcpy(b->data + b->l_data, "\0\0\0\0", c->l_extranul);
    b->l_data += c->l_extranul;

    c->l_qname = p - q + c->l_extranul;

    // flag
    c->flag = parse_sam_flag(p, &p, &overflow);
    if (*p++ != '\t') goto err_ret; // malformated flag

    // chr
    q = _read_token(p);
    if (strcmp(q, "*")) {
        _parse_err(h->n_targets == 0, "no SQ lines present in the header");
        c->tid = bam_name2id(h, q);
        _parse_err(c->tid < -1, "failed to parse header");
        _parse_warn(c->tid < 0, "unrecognized reference name %s; treated as unmapped", hts_strprint(logbuf, sizeof logbuf, '"', q, SIZE_MAX));
    } else c->tid = -1;

    // pos
    c->pos = hts_str2uint(p, &p, 62, &overflow) - 1;
    if (*p++ != '\t') goto err_ret;
    if (c->pos < 0 && c->tid >= 0) {
        _parse_warn(1, "mapped query cannot have zero coordinate; treated as unmapped");
        c->tid = -1;
    }
    if (c->tid < 0) c->flag |= BAM_FUNMAP;

    // mapq
    c->qual = hts_str2uint(p, &p, 8, &overflow);
    if (*p++ != '\t') goto err_ret;
    // cigar
    if (*p != '*') {
        uint32_t *cigar = NULL;
        int old_l_data = b->l_data;
        int n_cigar = bam_parse_cigar(p, &p, b);
        if (n_cigar < 1 || *p++ != '\t') goto err_ret;
        cigar = (uint32_t *)(b->data + old_l_data);

        // can't use bam_endpos() directly as some fields not yet set up
        cigreflen = (!(c->flag&BAM_FUNMAP))? bam_cigar2rlen(c->n_cigar, cigar) : 1;
        if (cigreflen == 0) cigreflen = 1;
    } else {
        _parse_warn(!(c->flag&BAM_FUNMAP), "mapped query must have a CIGAR; treated as unmapped");
        c->flag |= BAM_FUNMAP;
        q = _read_token(p);
        cigreflen = 1;
    }
    _parse_err(HTS_POS_MAX - cigreflen <= c->pos,
               "read ends beyond highest supported position");
    c->bin = hts_reg2bin(c->pos, c->pos + cigreflen, 14, 5);
    // mate chr
    q = _read_token(p);
    if (strcmp(q, "=") == 0) {
        c->mtid = c->tid;
    } else if (strcmp(q, "*") == 0) {
        c->mtid = -1;
    } else {
        c->mtid = bam_name2id(h, q);
        _parse_err(c->mtid < -1, "failed to parse header");
        _parse_warn(c->mtid < 0, "unrecognized mate reference name %s; treated as unmapped", hts_strprint(logbuf, sizeof logbuf, '"', q, SIZE_MAX));
    }
    // mpos
    c->mpos = hts_str2uint(p, &p, 62, &overflow) - 1;
    if (*p++ != '\t') goto err_ret;
    if (c->mpos < 0 && c->mtid >= 0) {
        _parse_warn(1, "mapped mate cannot have zero coordinate; treated as unmapped");
        c->mtid = -1;
    }
    // tlen
    c->isize = hts_str2int(p, &p, 63, &overflow);
    if (*p++ != '\t') goto err_ret;
    _parse_err(overflow, "number outside allowed range");
    // seq
    q = _read_token(p);
    if (strcmp(q, "*")) {
        _parse_err(p - q - 1 > INT32_MAX, "read sequence is too long");
        c->l_qseq = p - q - 1;
        hts_pos_t ql = bam_cigar2qlen(c->n_cigar, (uint32_t*)(b->data + c->l_qname));
        _parse_err(c->n_cigar && ql != c->l_qseq, "CIGAR and query sequence are of different length");
        i = (c->l_qseq + 1) >> 1;
        _get_mem(uint8_t, &t, b, i);

        unsigned int lqs2 = c->l_qseq&~1, i;
        for (i = 0; i < lqs2; i+=2)
            t[i>>1] = (seq_nt16_table[(unsigned char)q[i]] << 4) | seq_nt16_table[(unsigned char)q[i+1]];
        for (; i < c->l_qseq; ++i)
            t[i>>1] = seq_nt16_table[(unsigned char)q[i]] << ((~i&1)<<2);
    } else c->l_qseq = 0;
    // qual
    _get_mem(uint8_t, &t, b, c->l_qseq);
    if (p[0] == '*' && (p[1] == '\t' || p[1] == '\0')) {
        memset(t, 0xff, c->l_qseq);
        p += 2;
    } else {
        int failed = 0;
        _parse_err(s->l - (p - s->s) < c->l_qseq
                   || (p[c->l_qseq] != '\t' && p[c->l_qseq] != '\0'),
                   "SEQ and QUAL are of different length");
        COPY_MINUS_N(t, p, 33, c->l_qseq, failed);
        _parse_err(failed, "invalid QUAL character");
        p += c->l_qseq + 1;
    }

    // aux
    if (aux_parse(p, s->s + s->l, b, 0, NULL) < 0)
        goto err_ret;

    if (bam_tag2cigar(b, 1, 1) < 0)
        return -2;
    return 0;

#undef _parse_warn
#undef _parse_err
#undef _get_mem
#undef _read_token
err_ret:
    return -2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x10(%rdi), %rbx
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x40(%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movups %xmm0, 0x10(%rdx)
movq %rbx, %rdi
movl $0x9, %esi
callq 0x4190
movq %rax, %r13
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testq %r13, %r13
je 0x27ea1
movq %r15, 0x18(%rsp)
movq %r12, %r15
movb $0x0, (%r13)
leaq 0x1(%r13), %r12
movq %r12, 0x8(%rsp)
movq %r12, %rbp
subq %rbx, %rbp
cmpq $0x1, %rbp
jg 0x27634
leaq 0x70355(%rip), %rsi     # 0x97974
leaq 0x70359(%rip), %rdx     # 0x9797f
movl $0x3, %edi
xorl %eax, %eax
callq 0x13de5
jmp 0x2765c
cmpq $0x100, %rbp            # imm = 0x100
jb 0x2765c
leaq 0x70330(%rip), %rsi     # 0x97974
leaq 0x70345(%rip), %rdx     # 0x97990
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
jmp 0x27e9c
leaq 0x4(%rbp), %rsi
movslq 0x40(%r14), %rdi
addq %rdi, %rsi
setae %al
testq $-0x80000000, %rsi      # imm = 0x80000000
sete %cl
testb %al, %cl
jne 0x27688
callq 0x4050
movl $0xc, (%rax)
jmp 0x27e9c
movl 0x44(%r14), %eax
cmpq %rax, %rsi
jbe 0x276a5
movq %r14, %rdi
callq 0x22a64
testl %eax, %eax
js 0x27e9c
movslq 0x40(%r14), %rdi
addq 0x38(%r14), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x43c0
addl 0x40(%r14), %ebp
movl %ebp, 0x40(%r14)
movl %ebp, %eax
negb %al
andb $0x3, %al
movb %al, 0xf(%r14)
movslq %ebp, %rdi
addq 0x38(%r14), %rdi
movzbl %al, %edx
xorl %esi, %esi
callq 0x4260
movzbl 0xf(%r14), %eax
addl %eax, 0x40(%r14)
subl %ebx, %eax
addl %r12d, %eax
movw %ax, 0x12(%r14)
movb (%r12), %al
leal -0x31(%rax), %ecx
cmpb $0x8, %cl
ja 0x27782
addq $0x5, %r13
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%r12,%rcx), %edx
leal -0x30(%rdx), %esi
cmpb $0x9, %sil
ja 0x2779e
leaq (%rax,%rax,4), %rax
leaq (%rdx,%rax,2), %rax
addq $-0x30, %rax
incq %rcx
cmpl $0x4, %ecx
jne 0x27702
movzbl (%r13), %ecx
leal -0x3a(%rcx), %edx
cmpl $-0xa, %edx
jb 0x277a4
addl $-0x30, %ecx
cmpq $0x1999, %rax           # imm = 0x1999
jb 0x27747
jne 0x27763
cmpl $0x6, %ecx
jae 0x27763
movl %ecx, %ecx
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,2), %rax
movzbl 0x1(%r13), %ecx
incq %r13
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x27738
jmp 0x277a4
movzbl 0x1(%r13), %eax
incq %r13
addl $-0x30, %eax
cmpl $0xa, %eax
jb 0x27763
movl $0x1, 0x14(%rsp)
movl $0xffff, %eax           # imm = 0xFFFF
jmp 0x277a4
cmpb $0x30, %al
jne 0x2779a
cmpb $0x9, 0x2(%r13)
jne 0x27828
addq $0x2, %r13
movq %r13, 0x8(%rsp)
xorl %eax, %eax
jmp 0x277a9
addq %rcx, %r12
movq %r12, %r13
movq %r13, 0x8(%rsp)
movw %ax, 0x10(%r14)
movq 0x8(%rsp), %r13
leaq 0x1(%r13), %rbx
movq %rbx, 0x8(%rsp)
cmpb $0x9, (%r13)
jne 0x27e9c
movq %rbx, %rdi
movl $0x9, %esi
callq 0x4190
testq %rax, %rax
je 0x27e9c
movq %rax, %r12
movb $0x0, (%rax)
incq %r12
movq %r12, 0x8(%rsp)
cmpb $0x2a, (%rbx)
jne 0x277fb
cmpb $0x0, 0x2(%r13)
je 0x278ad
cmpl $0x0, (%r15)
je 0x27854
movq %r15, %rdi
movq %rbx, %rsi
callq 0x892f6
movl %eax, 0x8(%r14)
cmpl $-0x2, %eax
jg 0x27867
leaq 0x70158(%rip), %rsi     # 0x97974
leaq 0x701a3(%rip), %rdx     # 0x979c6
jmp 0x2764b
leaq 0x8(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x4130
cmpq $0x10000, %rax          # imm = 0x10000
jb 0x277a9
movl $0x1, 0x14(%rsp)
movw $0xffff, %ax            # imm = 0xFFFF
jmp 0x277a9
leaq 0x70119(%rip), %rsi     # 0x97974
leaq 0x70142(%rip), %rdx     # 0x979a4
jmp 0x2764b
testl %eax, %eax
jns 0x278b5
leaq 0x20(%rsp), %rdi
movl $0x28, %esi
movl $0x22, %edx
movq %rbx, %rcx
movq $-0x1, %r8
callq 0x35af3
leaq 0x700e4(%rip), %rsi     # 0x97974
leaq 0x70146(%rip), %rdx     # 0x979dd
movl $0x3, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
movq 0x8(%rsp), %r12
jmp 0x278b5
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
xorl %eax, %eax
cmpb $0x2b, (%r12)
sete %al
leaq (%r12,%rax), %rdx
addq %r12, %rax
addq $0x12, %rax
xorl %esi, %esi
xorl %ecx, %ecx
movzbl (%rdx,%rsi), %edi
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x27952
leaq (%rcx,%rcx,4), %rcx
leaq (%rdi,%rcx,2), %rcx
addq $-0x30, %rcx
incq %rsi
cmpl $0x12, %esi
jne 0x278ce
movzbl (%rax), %edx
leal -0x3a(%rdx), %esi
cmpl $-0xa, %esi
jb 0x27958
movabsq $0x666666666666666, %rsi # imm = 0x666666666666666
addl $-0x30, %edx
cmpq %rsi, %rcx
jb 0x27914
jne 0x2792f
cmpl $0x4, %edx
jae 0x2792f
movl %edx, %edx
leaq (%rcx,%rcx,4), %rcx
leaq (%rdx,%rcx,2), %rcx
movzbl 0x1(%rax), %edx
incq %rax
addl $-0x30, %edx
cmpl $0xa, %edx
jb 0x27908
jmp 0x27958
movzbl 0x1(%rax), %ecx
incq %rax
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x2792f
movl $0x1, 0x14(%rsp)
movabsq $0x3fffffffffffffff, %rcx # imm = 0x3FFFFFFFFFFFFFFF
jmp 0x27958
addq %rsi, %rdx
movq %rdx, %rax
decq %rcx
movq %rcx, (%r14)
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rsp)
cmpb $0x9, (%rax)
jne 0x27e9c
movl 0x8(%r14), %eax
testq %rcx, %rcx
js 0x2797f
testl %eax, %eax
jns 0x279aa
jmp 0x279a5
testl %eax, %eax
js 0x279a5
leaq 0x6ffea(%rip), %rsi     # 0x97974
leaq 0x70080(%rip), %rdx     # 0x97a11
movl $0x3, %edi
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, 0x8(%r14)  # imm = 0xFFFFFFFF
orb $0x4, 0x10(%r14)
leaq 0x8(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x14(%rsp), %rcx
movq %rbx, %rsi
movl $0x8, %edx
callq 0x27fbb
movb %al, 0xe(%r14)
movq (%rbx), %rax
leaq 0x1(%rax), %rdi
movq %rdi, (%rbx)
cmpb $0x9, (%rax)
jne 0x27e9c
cmpb $0x2a, (%rdi)
jne 0x27a40
movzwl 0x10(%r14), %eax
testb $0x4, %al
jne 0x27a0d
leaq 0x6ff84(%rip), %rsi     # 0x97974
leaq 0x70058(%rip), %rdx     # 0x97a4f
movl $0x3, %edi
xorl %eax, %eax
callq 0x13de5
movzwl 0x10(%r14), %eax
movq 0x8(%rsp), %rdi
orl $0x4, %eax
movw %ax, 0x10(%r14)
movl $0x9, %esi
callq 0x4190
testq %rax, %rax
je 0x27e9c
movq %rax, %r13
movb $0x0, (%rax)
incq %r13
movq %r13, 0x8(%rsp)
movl $0x1, %eax
jmp 0x27ac2
movslq 0x40(%r14), %rbx
leaq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x280a6
testq %rax, %rax
jle 0x27e9c
movq 0x8(%rsp), %rax
leaq 0x1(%rax), %r13
movq %r13, 0x8(%rsp)
cmpb $0x9, (%rax)
jne 0x27e9c
movl $0x1, %eax
testb $0x4, 0x10(%r14)
jne 0x27aba
movslq 0x14(%r14), %rdx
testq %rdx, %rdx
jle 0x27ab8
addq 0x38(%r14), %rbx
xorl %esi, %esi
xorl %eax, %eax
movl (%rbx,%rsi,4), %edi
leal (%rdi,%rdi), %ecx
movl $0x3c1a7, %r8d          # imm = 0x3C1A7
shrl %cl, %r8d
shll $0x1e, %r8d
sarl $0x1f, %r8d
shrl $0x4, %edi
andl %r8d, %edi
addq %rdi, %rax
incq %rsi
cmpq %rsi, %rdx
jne 0x27a8e
jmp 0x27aba
xorl %eax, %eax
cmpq $0x1, %rax
adcq $0x0, %rax
movabsq $0x7fffffff7fffffff, %rcx # imm = 0x7FFFFFFF7FFFFFFF
subq %rax, %rcx
movq (%r14), %rdi
cmpq %rdi, %rcx
jle 0x27b28
leaq (%rax,%rdi), %r8
decq %r8
movl $0x1249, %esi           # imm = 0x1249
movl $0xe, %eax
movl $0x6, %r9d
movl $0xc, %edx
movq %rdi, %r10
movl %eax, %ecx
sarq %cl, %r10
movq %r8, %r11
sarq %cl, %r11
cmpq %r11, %r10
je 0x27b3b
addq $0x3, %rax
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %edx, %ecx
shll %cl, %r10d
addl %r10d, %esi
decl %r9d
addl $-0x3, %edx
cmpl $0x1, %r9d
ja 0x27af3
xorl %esi, %esi
jmp 0x27b3e
leaq 0x6fe45(%rip), %rsi     # 0x97974
leaq 0x6ff4d(%rip), %rdx     # 0x97a83
jmp 0x2764b
addl %r10d, %esi
movw %si, 0xc(%r14)
movq %r13, %rdi
movl $0x9, %esi
callq 0x4190
testq %rax, %rax
je 0x27e9c
movb $0x0, (%rax)
incq %rax
movq %rax, 0x8(%rsp)
movzbl (%r13), %eax
cmpl $0x2a, %eax
je 0x27b84
cmpl $0x3d, %eax
jne 0x27b8b
cmpb $0x0, 0x1(%r13)
jne 0x27b8b
movl 0x8(%r14), %eax
movl %eax, 0x1c(%r14)
jmp 0x27bec
cmpb $0x0, 0x1(%r13)
je 0x27be4
movq %r15, %rdi
movq %r13, %rsi
callq 0x892f6
movl %eax, 0x1c(%r14)
cmpl $-0x2, %eax
jle 0x27815
testl %eax, %eax
jns 0x27bec
leaq 0x20(%rsp), %rdi
movl $0x28, %esi
movl $0x22, %edx
movq %r13, %rcx
movq $-0x1, %r8
callq 0x35af3
leaq 0x6fda8(%rip), %rsi     # 0x97974
leaq 0x6fedc(%rip), %rdx     # 0x97aaf
movl $0x3, %edi
movq %rax, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x27bec
movl $0xffffffff, 0x1c(%r14) # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x14(%rsp), %rcx
movq %rbx, %rsi
movl $0x3e, %edx
callq 0x27fbb
decq %rax
movq %rax, 0x20(%r14)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdi
movq %rdi, (%rbx)
cmpb $0x9, (%rcx)
jne 0x27e9c
testq %rax, %rax
jns 0x27c53
cmpl $0x0, 0x1c(%r14)
js 0x27c53
leaq 0x6fd41(%rip), %rsi     # 0x97974
leaq 0x6feae(%rip), %rdx     # 0x97ae8
movl $0x3, %edi
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, 0x1c(%r14) # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdi
leaq 0x8(%rsp), %rbx
leaq 0x14(%rsp), %rcx
movq %rbx, %rsi
movl $0x3f, %edx
callq 0x2823b
movq %rax, 0x28(%r14)
movq (%rbx), %r13
leaq 0x1(%r13), %r12
movq %r12, (%rbx)
cmpb $0x9, (%r13)
jne 0x27e9c
cmpl $0x0, 0x14(%rsp)
je 0x27c9d
leaq 0x6fce3(%rip), %rsi     # 0x97974
leaq 0x6fe8d(%rip), %rdx     # 0x97b25
jmp 0x2764b
movq %r12, %rdi
movl $0x9, %esi
callq 0x4190
testq %rax, %rax
je 0x27e9c
movb $0x0, (%rax)
incq %rax
movq %rax, 0x8(%rsp)
cmpb $0x2a, (%r12)
jne 0x27cd0
cmpb $0x0, 0x2(%r13)
je 0x27e05
movq %r12, %rcx
notq %rcx
addq %rcx, %rax
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
jl 0x27cf6
leaq 0x6fc8a(%rip), %rsi     # 0x97974
leaq 0x6fe51(%rip), %rdx     # 0x97b42
jmp 0x2764b
movl %eax, 0x18(%r14)
movslq 0x14(%r14), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
jle 0x27d3d
movzwl 0x12(%r14), %esi
addq 0x38(%r14), %rsi
movl $0x3c1a7, %edi          # imm = 0x3C1A7
xorl %r8d, %r8d
movl (%rsi,%r8,4), %r9d
leal (%r9,%r9), %r10d
btl %r10d, %edi
movl $0x0, %r10d
sbbl %r10d, %r10d
shrl $0x4, %r9d
andl %r10d, %r9d
addq %r9, %rcx
incq %r8
cmpq %r8, %rdx
jne 0x27d16
testl %edx, %edx
je 0x27d5c
movslq %eax, %rdx
cmpq %rdx, %rcx
je 0x27d5c
leaq 0x6fc24(%rip), %rsi     # 0x97974
leaq 0x6fa5d(%rip), %rdx     # 0x977b4
jmp 0x2764b
leal 0x1(%rax), %ebx
sarl %ebx
movslq %ebx, %rsi
movq %r14, %rdi
callq 0x27f7b
testl %eax, %eax
js 0x27e9c
movslq 0x40(%r14), %rax
addl %eax, %ebx
addq 0x38(%r14), %rax
movl %ebx, 0x40(%r14)
movl 0x18(%r14), %ecx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %edx, %edx
andq %rcx, %rsi
je 0x27dc7
leaq 0x6dbc7(%rip), %rcx     # 0x95960
movq %rax, %rdi
movzbl 0x1(%r13,%rdx), %r8d
movb (%rcx,%r8), %r8b
shlb $0x4, %r8b
movzbl 0x2(%r13,%rdx), %r9d
orb (%rcx,%r9), %r8b
movb %r8b, (%rdi)
addq $0x2, %rdx
incq %rdi
cmpq %rsi, %rdx
jb 0x27d9c
movl 0x18(%r14), %ecx
cmpl %ecx, %edx
jae 0x27e0f
movl %edx, %esi
shlb $0x2, %dl
leaq 0x6db89(%rip), %rdi     # 0x95960
movzbl (%r12,%rsi), %ecx
movb (%rdi,%rcx), %r8b
movl %edx, %ecx
notb %cl
andb $0x4, %cl
shlb %cl, %r8b
movq %rsi, %rcx
shrq %rcx
movb %r8b, (%rax,%rcx)
incq %rsi
movl 0x18(%r14), %ecx
addb $0x4, %dl
cmpq %rcx, %rsi
jb 0x27dd7
jmp 0x27e0f
movl $0x0, 0x18(%r14)
xorl %ecx, %ecx
movslq %ecx, %rsi
movq %r14, %rdi
callq 0x27f7b
testl %eax, %eax
js 0x27e9c
movslq 0x40(%r14), %rdi
movslq 0x18(%r14), %rdx
leal (%rdx,%rdi), %eax
addq 0x38(%r14), %rdi
movl %eax, 0x40(%r14)
movq 0x8(%rsp), %rcx
cmpb $0x2a, (%rcx)
jne 0x27eb0
movzbl 0x1(%rcx), %eax
cmpl $0x9, %eax
je 0x27e48
testl %eax, %eax
jne 0x27eb0
movl $0xff, %esi
callq 0x4260
movq 0x8(%rsp), %rdi
addq $0x2, %rdi
movq %rdi, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rsi
addq (%rax), %rsi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2839b
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
js 0x27ea1
movq %r14, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x235d8
sarl $0x1f, %eax
andl $-0x2, %eax
jmp 0x27ea1
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rsi
movq (%rsi), %rax
subq %rcx, %rax
addq 0x10(%rsi), %rax
cmpq %rdx, %rax
jb 0x27edc
movzbl (%rcx,%rdx), %eax
testl %eax, %eax
je 0x27ed1
cmpl $0x9, %eax
jne 0x27edc
cmpl $0x8, %edx
jae 0x27eef
xorl %eax, %eax
xorl %esi, %esi
jmp 0x27f43
leaq 0x6fa91(%rip), %rsi     # 0x97974
leaq 0x6fc72(%rip), %rdx     # 0x97b5c
jmp 0x2764b
movl %edx, %eax
sarl $0x3, %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movslq %eax, %rsi
xorl %r8d, %r8d
movabsq $-0x2121212121212121, %r9 # imm = 0xDEDEDEDEDEDEDEDF
xorl %eax, %eax
movq (%rcx,%r8,8), %r10
addq %r9, %r10
movq %r10, (%rdi,%r8,8)
orq %r10, %rax
incq %r8
cmpq %r8, %rsi
jne 0x27f0c
shlq $0x3, %rsi
jmp 0x27f43
movq 0x8(%rsp), %rcx
movb (%rcx,%rsi), %cl
addb $-0x21, %cl
movb %cl, (%rdi,%rsi)
movzbl %cl, %ecx
orq %rcx, %rax
incq %rsi
movslq 0x18(%r14), %rdx
cmpq %rdx, %rsi
jb 0x27f28
movabsq $-0x7f7f7f7f7f7f7f80, %rcx # imm = 0x8080808080808080
testq %rcx, %rax
je 0x27f6a
leaq 0x6fa16(%rip), %rsi     # 0x97974
leaq 0x6fc1c(%rip), %rdx     # 0x97b81
jmp 0x2764b
movq 0x8(%rsp), %rax
leaq (%rax,%rdx), %rdi
incq %rdi
jmp 0x27e5b