// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_parse1
int sam_parse1(kstring_t *s, bam_hdr_t *h, bam1_t *b)
{
#define _read_token(_p) (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); if (*(_p) != '\t') goto err_ret; *(_p)++ = 0
#define _read_token_aux(_p) (_p); for (; *(_p) && *(_p) != '\t'; ++(_p)); *(_p)++ = 0 // this is different in that it does not test *(_p)=='\t'
#define _get_mem(type_t, _x, _s, _l) ks_resize((_s), (_s)->l + (_l)); *(_x) = (type_t*)((_s)->s + (_s)->l); (_s)->l += (_l)
#define _parse_err(cond, msg) do { if ((cond) && hts_verbose >= 1) { fprintf(stderr, "[E::%s] " msg "\n", __func__); goto err_ret; } } while (0)
#define _parse_warn(cond, msg) if ((cond) && hts_verbose >= 2) fprintf(stderr, "[W::%s] " msg "\n", __func__)

    uint8_t *t;
    char *p = s->s, *q;
    int i;
    kstring_t str;
    bam1_core_t *c = &b->core;

    str.l = b->l_data = 0;
    str.s = (char*)b->data; str.m = b->m_data;
    memset(c, 0, 32);
    if (h->cigar_tab == 0) {
        h->cigar_tab = (int8_t*) malloc(128);
        for (i = 0; i < 128; ++i)
            h->cigar_tab[i] = -1;
        for (i = 0; BAM_CIGAR_STR[i]; ++i)
            h->cigar_tab[(int)BAM_CIGAR_STR[i]] = i;
    }
    // qname
    q = _read_token(p);
    _parse_warn(p - q <= 1, "empty query name");
    _parse_err(p - q > 255, "query name too long");
    kputsn_(q, p - q, &str);
    c->l_qname = p - q;
    // flag
    c->flag = strtol(p, &p, 0);
    if (*p++ != '\t') goto err_ret; // malformated flag
    // chr
    q = _read_token(p);
    if (strcmp(q, "*")) {
        _parse_err(h->n_targets == 0, "missing SAM header");
        c->tid = bam_name2id(h, q);
        _parse_warn(c->tid < 0, "urecognized reference name; treated as unmapped");
    } else c->tid = -1;
    // pos
    c->pos = strtol(p, &p, 10) - 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 = strtol(p, &p, 10);
    if (*p++ != '\t') goto err_ret;
    // cigar
    if (*p != '*') {
        uint32_t *cigar;
        size_t n_cigar = 0;
        for (q = p; *p && *p != '\t'; ++p)
            if (!isdigit_c(*p)) ++n_cigar;
        if (*p++ != '\t') goto err_ret;
        _parse_err(n_cigar == 0, "no CIGAR operations");
        _parse_err(n_cigar >= 65536, "too many CIGAR operations");
        c->n_cigar = n_cigar;
        _get_mem(uint32_t, &cigar, &str, c->n_cigar * sizeof(uint32_t));
        for (i = 0; i < c->n_cigar; ++i, ++q) {
            int op;
            cigar[i] = strtol(q, &q, 10)<<BAM_CIGAR_SHIFT;
            op = (uint8_t)*q >= 128? -1 : h->cigar_tab[(int)*q];
            _parse_err(op < 0, "unrecognized CIGAR operator");
            cigar[i] |= op;
        }
        // can't use bam_endpos() directly as some fields not yet set up
        i = (!(c->flag&BAM_FUNMAP))? bam_cigar2rlen(c->n_cigar, cigar) : 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);
        i = 1;
    }
    c->bin = hts_reg2bin(c->pos, c->pos + i, 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_warn(c->mtid < 0, "urecognized mate reference name; treated as unmapped");
    }
    // mpos
    c->mpos = strtol(p, &p, 10) - 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 = strtol(p, &p, 10);
    if (*p++ != '\t') goto err_ret;
    // seq
    q = _read_token(p);
    if (strcmp(q, "*")) {
        c->l_qseq = p - q - 1;
        i = bam_cigar2qlen(c->n_cigar, (uint32_t*)(str.s + c->l_qname));
        _parse_err(c->n_cigar && i != c->l_qseq, "CIGAR and query sequence are of different length");
        i = (c->l_qseq + 1) >> 1;
        _get_mem(uint8_t, &t, &str, i);
        memset(t, 0, i);
        for (i = 0; i < c->l_qseq; ++i)
            t[i>>1] |= seq_nt16_table[(int)q[i]] << ((~i&1)<<2);
    } else c->l_qseq = 0;
    // qual
    q = _read_token_aux(p);
    _get_mem(uint8_t, &t, &str, c->l_qseq);
    if (strcmp(q, "*")) {
        _parse_err(p - q - 1 != c->l_qseq, "SEQ and QUAL are of different length");
        for (i = 0; i < c->l_qseq; ++i) t[i] = q[i] - 33;
    } else memset(t, 0xff, c->l_qseq);
    // aux
    // Note that (like the bam1_core_t fields) this aux data in b->data is
    // stored in host endianness; so there is no byte swapping needed here.
    while (p < s->s + s->l) {
        uint8_t type;
        q = _read_token_aux(p); // FIXME: can be accelerated for long 'B' arrays
        _parse_err(p - q - 1 < 6, "incomplete aux field");
        kputsn_(q, 2, &str);
        q += 3; type = *q++; ++q; // q points to value
        if (type == 'A' || type == 'a' || type == 'c' || type == 'C') {
            kputc_('A', &str);
            kputc_(*q, &str);
        } else if (type == 'i' || type == 'I') {
            if (*q == '-') {
                long x = strtol(q, &q, 10);
                if (x >= INT8_MIN) {
                    kputc_('c', &str); kputc_(x, &str);
                } else if (x >= INT16_MIN) {
                    int16_t y = x;
                    kputc_('s', &str); kputsn_((char*)&y, 2, &str);
                } else {
                    int32_t y = x;
                    kputc_('i', &str); kputsn_(&y, 4, &str);
                }
            } else {
                unsigned long x = strtoul(q, &q, 10);
                if (x <= UINT8_MAX) {
                    kputc_('C', &str); kputc_(x, &str);
                } else if (x <= UINT16_MAX) {
                    uint16_t y = x;
                    kputc_('S', &str); kputsn_(&y, 2, &str);
                } else {
                    uint32_t y = x;
                    kputc_('I', &str); kputsn_(&y, 4, &str);
                }
            }
        } else if (type == 'f') {
            float x;
            x = strtod(q, &q);
            kputc_('f', &str); kputsn_(&x, 4, &str);
        } else if (type == 'd') {
            double x;
            x = strtod(q, &q);
            kputc_('d', &str); kputsn_(&x, 8, &str);
        } else if (type == 'Z' || type == 'H') {
            kputc_(type, &str);kputsn_(q, p - q, &str); // note that this include the trailing NULL
        } else if (type == 'B') {
            int32_t n;
            char *r;
            _parse_err(p - q - 1 < 3, "incomplete B-typed aux field");
            type = *q++; // q points to the first ',' following the typing byte
            for (r = q, n = 0; *r; ++r)
                if (*r == ',') ++n;
            kputc_('B', &str); kputc_(type, &str); kputsn_(&n, 4, &str);
            // FIXME: to evaluate which is faster: a) aligned array and then memmove(); b) unaligned array; c) kputsn_()
            if (type == 'c')      while (q + 1 < p) { int8_t   x = strtol(q + 1, &q, 0); kputc_(x, &str); }
            else if (type == 'C') while (q + 1 < p) { uint8_t  x = strtoul(q + 1, &q, 0); kputc_(x, &str); }
            else if (type == 's') while (q + 1 < p) { int16_t  x = strtol(q + 1, &q, 0); kputsn_(&x, 2, &str); }
            else if (type == 'S') while (q + 1 < p) { uint16_t x = strtoul(q + 1, &q, 0); kputsn_(&x, 2, &str); }
            else if (type == 'i') while (q + 1 < p) { int32_t  x = strtol(q + 1, &q, 0); kputsn_(&x, 4, &str); }
            else if (type == 'I') while (q + 1 < p) { uint32_t x = strtoul(q + 1, &q, 0); kputsn_(&x, 4, &str); }
            else if (type == 'f') while (q + 1 < p) { float    x = strtod(q + 1, &q);    kputsn_(&x, 4, &str); }
            else _parse_err(1, "unrecognized type");
        } else _parse_err(1, "unrecognized type");
    }
    b->data = (uint8_t*)str.s; b->l_data = str.l; b->m_data = str.m;
    return 0;

#undef _parse_warn
#undef _parse_err
#undef _get_mem
#undef _read_token_aux
#undef _read_token
err_ret:
    b->data = (uint8_t*)str.s; b->l_data = str.l; b->m_data = str.m;
    return -2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x50(%rsp)
movq 0x10(%rdi), %r12
movq %r12, 0x8(%rsp)
movl $0x0, 0x20(%rdx)
movq $0x0, 0x30(%rsp)
movq 0x28(%rdx), %rdi
movq %rdi, 0x40(%rsp)
movslq 0x24(%rdx), %rbx
movq %rbx, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdx)
movups %xmm0, (%rdx)
cmpq $0x0, 0x18(%rsi)
jne 0x15eab
movq %rdi, %r13
movl $0x80, %edi
callq 0x4700
movq %rax, 0x18(%r15)
xorl %eax, %eax
movq 0x18(%r15), %rcx
movb $-0x1, (%rcx,%rax)
incq %rax
cmpq $0x80, %rax
jne 0x15e77
xorl %eax, %eax
leaq 0x3d521(%rip), %rcx     # 0x533b4
movq %r13, %rdi
movsbq (%rax,%rcx), %rdx
movq 0x18(%r15), %rsi
movb %al, (%rsi,%rdx)
incq %rax
cmpq $0xa, %rax
jne 0x15e96
movq %r14, 0x10(%rsp)
movq %r12, (%rsp)
movq 0x8(%rsp), %rax
movq %rax, %r13
subq %r12, %r13
incq %r13
movq %r13, %rbp
shlq $0x20, %rbp
movq %r13, %r14
shlq $0x18, %r14
movabsq $0x100000000, %rcx      # imm = 0x100000000
movzbl (%rax), %edx
testl %edx, %edx
je 0x15fff
cmpl $0x9, %edx
je 0x15efc
incq %rax
addq %rcx, %rbp
addq $0x1000000, %r14        # imm = 0x1000000
incq %r13
jmp 0x15eda
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%rsp)
movq %rcx, 0x8(%rsp)
movb $0x0, (%rax)
leaq 0x4e63c(%rip), %rax     # 0x64550
cmpq $0x1, %r13
jg 0x15f23
cmpl $0x2, (%rax)
jge 0x16187
cmpq $0x100, %r13            # imm = 0x100
jl 0x15f35
cmpl $0x0, (%rax)
jg 0x161a2
sarq $0x20, %rbp
cmpq %rbx, %rbp
movq 0x10(%rsp), %r13
jbe 0x15f9c
leaq -0x1(%rbp), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rbx
shrq $0x20, %rbx
orq %rcx, %rbx
incq %rbx
movq %rbx, %rsi
callq 0x48d0
testq %rax, %rax
je 0x15fb1
movq %rax, 0x40(%rsp)
movq %rbx, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0x4420
movq %rbp, 0x30(%rsp)
shrl $0x18, %r14d
movb %r14b, 0xb(%r13)
leaq 0x8(%rsp), %rbx
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4760
movw %ax, 0xc(%r13)
movq (%rbx), %rax
leaq 0x1(%rax), %r14
movq %r14, (%rbx)
cmpb $0x9, (%rax)
jne 0x16009
movq %r14, (%rsp)
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x1644d
cmpl $0x9, %ecx
je 0x16036
incq %rax
jmp 0x15fea
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %r13
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movq 0x40(%rsp), %rcx
movq %rcx, 0x28(%r13)
movl 0x30(%rsp), %ecx
movl %ecx, 0x20(%r13)
movl 0x38(%rsp), %ecx
movl %ecx, 0x24(%r13)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1(%rax), %r12
movq %r12, 0x8(%rsp)
movb $0x0, (%rax)
leaq 0x3d680(%rip), %rsi     # 0x536c9
movq %r14, %rdi
callq 0x4750
testl %eax, %eax
je 0x16091
cmpl $0x0, (%r15)
jne 0x1606b
leaq 0x4e4ee(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
jg 0x162cc
movq %r15, %rdi
movq %r14, %rsi
callq 0x146e2
movl %eax, (%r13)
testl %eax, %eax
jns 0x16099
leaq 0x4e4cb(%rip), %rax     # 0x64550
cmpl $0x2, (%rax)
jl 0x16099
callq 0x4ec5
jmp 0x16099
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4760
decl %eax
movl %eax, 0x4(%r13)
movq (%rbx), %rcx
leaq 0x1(%rcx), %r14
movq %r14, (%rbx)
cmpb $0x9, (%rcx)
jne 0x16009
testl %eax, %eax
jns 0x160ea
cmpl $0x0, (%r13)
js 0x160ea
leaq 0x4e477(%rip), %rax     # 0x64550
cmpl $0x2, (%rax)
jge 0x163a5
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
cmpl $0x0, (%r13)
jns 0x160f6
orb $0x4, 0xc(%r13)
leaq 0x8(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4760
movq 0x8(%r13), %rcx
movzbl %al, %eax
shll $0x10, %eax
movq %rcx, %r14
andq $-0xff0001, %r14        # imm = 0xFF00FFFF
orq %rax, %r14
movq %r14, 0x8(%r13)
movq (%rbx), %rax
leaq 0x1(%rax), %r12
movq %r12, (%rbx)
cmpb $0x9, (%rax)
jne 0x16009
cmpb $0x2a, (%r12)
jne 0x161ac
movabsq $0x400000000, %rbx      # imm = 0x400000000
btq $0x22, %rcx
jb 0x16161
leaq 0x4e3f8(%rip), %rax     # 0x64550
cmpl $0x2, (%rax)
jge 0x1639b
orq %rbx, 0x8(%r13)
movq %r12, (%rsp)
movq 0x8(%rsp), %rax
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x1644d
cmpl $0x9, %ecx
je 0x162b6
incq %rax
jmp 0x1616e
movq %rdi, 0x48(%rsp)
callq 0x4ea6
movq 0x48(%rsp), %rdi
leaq 0x4e3b3(%rip), %rax     # 0x64550
jmp 0x15f23
callq 0x5073
jmp 0x16004
movq %r12, (%rsp)
movq 0x8(%rsp), %rbx
incq %rbx
xorl %r12d, %r12d
movzbl -0x1(%rbx), %r13d
testl %r13d, %r13d
je 0x161e5
cmpl $0x9, %r13d
je 0x161e5
callq 0x4580
movq (%rax), %rax
movb 0x1(%rax,%r13,2), %al
andb $0x8, %al
cmpb $0x1, %al
adcq $0x0, %r12
incq %rbx
jmp 0x161bb
movq %rbx, 0x8(%rsp)
movl $0xa, %ebx
movl $0xb, %ebp
cmpl $0x9, %r13d
jne 0x16362
testq %r12, %r12
sete %cl
leaq 0x4e345(%rip), %rax     # 0x64550
movl (%rax), %eax
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
movq 0x10(%rsp), %r13
je 0x163af
testl %eax, %eax
setg %al
cmpq $0x10000, %r12          # imm = 0x10000
setae %cl
andb %al, %cl
cmpb $0x1, %cl
je 0x163b6
movabsq $0x1000000000000, %rcx  # imm = 0x1000000000000
movq %r12, %rax
shlq $0x30, %rax
decq %rcx
andq %rcx, %r14
orq %rax, %r14
movq %r14, 0x8(%r13)
movzwl %r12w, %esi
shll $0x2, %esi
leaq 0x30(%rsp), %rbx
addq (%rbx), %rsi
movq %rbx, %rdi
callq 0x16e05
movq (%rbx), %rdx
movq 0x10(%rbx), %r12
addq %rdx, %r12
movq 0x8(%r13), %rcx
movq %rcx, %rax
shrq $0x30, %rax
leaq (%rdx,%rax,4), %rdx
movq %rdx, (%rbx)
jne 0x162d6
btq $0x22, %rcx
jb 0x16369
movabsq $0x1000000000000, %rdx  # imm = 0x1000000000000
xorl %ebp, %ebp
cmpq %rdx, %rcx
jae 0x16372
xorl %ebx, %ebx
jmp 0x163bb
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rsp)
movb $0x0, (%rax)
movl $0x1, %ebx
jmp 0x163cd
callq 0x4ee4
jmp 0x16009
xorl %ebx, %ebx
movq (%rsp), %rdi
movq %rsp, %rsi
movl $0xa, %edx
callq 0x4760
shll $0x4, %eax
movl %eax, (%r12,%rbx,4)
movq (%rsp), %r13
movsbq (%r13), %rcx
testq %rcx, %rcx
js 0x16308
movq 0x18(%r15), %rdx
movsbl (%rdx,%rcx), %ecx
jmp 0x1630d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %ecx, %ecx
setns %dl
leaq 0x4e237(%rip), %rsi     # 0x64550
cmpl $0x0, (%rsi)
setle %r14b
orb %dl, %r14b
je 0x16356
orl %eax, %ecx
movl %ecx, (%r12,%rbx,4)
xorl %ebp, %ebp
testb %r14b, %r14b
je 0x16362
incq %rbx
incq %r13
movq %r13, (%rsp)
movq 0x10(%rsp), %r13
movq 0x8(%r13), %rcx
movq %rcx, %rax
shrq $0x30, %rax
cmpq %rax, %rbx
jb 0x162d8
jmp 0x1628f
callq 0x4f22
movl $0xb, %ebp
jmp 0x1632d
movq 0x10(%rsp), %r13
jmp 0x163bb
movl $0x1, %ebx
xorl %ebp, %ebp
jmp 0x163bb
xorl %edx, %edx
xorl %ebx, %ebx
movl (%r12,%rdx,4), %esi
leal (%rsi,%rsi), %ecx
movl $0x3c1a7, %edi          # imm = 0x3C1A7
shrl %cl, %edi
shll $0x1e, %edi
sarl $0x1f, %edi
shrl $0x4, %esi
andl %edi, %esi
addl %esi, %ebx
incq %rdx
cmpq %rdx, %rax
jne 0x16376
jmp 0x163bb
callq 0x4f7f
jmp 0x16161
callq 0x4f03
jmp 0x160e2
callq 0x4f60
jmp 0x163bb
callq 0x4f41
testl %ebp, %ebp
je 0x163cd
cmpl $0xb, %ebp
je 0x16009
jmp 0x16027
movslq 0x4(%r13), %r8
movslq %ebx, %rax
leaq (%r8,%rax), %r9
decq %r9
movl $0x1249, %esi           # imm = 0x1249
movl $0xe, %eax
movl $0x6, %r10d
movl $0xc, %edx
xorl %edi, %edi
movq %r8, %r11
movl %eax, %ecx
sarq %cl, %r11
movq %r9, %rbx
sarq %cl, %rbx
cmpq %rbx, %r11
je 0x16425
addq $0x3, %rax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movl %edx, %ecx
shll %cl, %r11d
addl %r11d, %esi
decl %r10d
addl $-0x3, %edx
cmpl $0x1, %r10d
ja 0x163f2
jmp 0x1642b
addl %r11d, %esi
movzwl %si, %edi
movw %di, 0x8(%r13)
movq 0x8(%rsp), %r12
movq %r12, (%rsp)
movq %r12, %rax
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x1644d
cmpl $0x9, %ecx
je 0x16457
incq %rax
jmp 0x1643c
movq %rax, 0x8(%rsp)
jmp 0x16009
leaq 0x1(%rax), %r14
movq %r14, 0x8(%rsp)
movb $0x0, (%rax)
leaq 0x3f201(%rip), %rsi     # 0x5566b
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0x164af
leaq 0x3d24c(%rip), %rsi     # 0x536c9
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0x164b9
movq %r15, %rdi
movq %r12, %rsi
callq 0x146e2
movl %eax, 0x14(%r13)
testl %eax, %eax
jns 0x164c1
leaq 0x4e0ad(%rip), %rax     # 0x64550
cmpl $0x2, (%rax)
jl 0x164c1
callq 0x4f9e
jmp 0x164c1
movl (%r13), %eax
movl %eax, 0x14(%r13)
jmp 0x164c1
movl $0xffffffff, 0x14(%r13) # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4760
decl %eax
movl %eax, 0x18(%r13)
movq (%rbx), %rcx
leaq 0x1(%rcx), %r14
movq %r14, (%rbx)
cmpb $0x9, (%rcx)
jne 0x16009
testl %eax, %eax
jns 0x16512
cmpl $0x0, 0x14(%r13)
js 0x16512
leaq 0x4e04f(%rip), %rax     # 0x64550
cmpl $0x2, (%rax)
jge 0x16d4f
movl $0xffffffff, 0x14(%r13) # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x4760
movl %eax, 0x1c(%r13)
movq (%rbx), %r14
leaq 0x1(%r14), %r12
movq %r12, (%rbx)
cmpb $0x9, (%r14)
jne 0x16009
movq %r12, (%rsp)
movq 0x8(%rsp), %rbp
movq %rbp, %r13
notq %r13
xorl %r15d, %r15d
movzbl (%rbp,%r15), %eax
testl %eax, %eax
je 0x166a7
cmpl $0x9, %eax
je 0x16569
incq %r15
jmp 0x16551
leaq (%r15,%rbp), %rax
incq %rax
movq %rax, 0x8(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, -0x1(%rax)
leaq 0x3d144(%rip), %rsi     # 0x536c9
movq %r12, %rdi
callq 0x4750
testl %eax, %eax
je 0x166b4
movabsq $0x1000000000000, %rax  # imm = 0x1000000000000
movl %r14d, %ecx
notl %ecx
addl %r15d, %ecx
addl %ebp, %ecx
movq 0x10(%rsp), %rdx
movl %ecx, 0x10(%rdx)
movq 0x8(%rdx), %rdx
xorl %ecx, %ecx
movq %rdx, %rsi
shrq $0x30, %rsi
je 0x165fc
movl %edx, %edi
shrl $0x18, %edi
addq 0x40(%rsp), %rdi
xorl %r8d, %r8d
movl $0x3c1a7, %r9d          # imm = 0x3C1A7
xorl %ecx, %ecx
movl (%rdi,%r8,4), %r10d
leal (%r10,%r10), %r11d
btl %r11d, %r9d
movl $0x0, %r11d
sbbl %r11d, %r11d
shrl $0x4, %r10d
andl %r11d, %r10d
addl %r10d, %ecx
incq %r8
cmpq %r8, %rsi
jne 0x165d5
cmpq %rax, %rdx
jb 0x16625
negl %ecx
movl %ebp, %eax
subl %r14d, %eax
addq %rcx, %rax
addq %r15, %rax
decq %rax
testl %eax, %eax
je 0x16625
leaq 0x4df34(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
jg 0x16d63
movl %ebp, %eax
subl %r14d, %eax
addl %r15d, %eax
sarl %eax
movslq %eax, %rbx
leaq 0x30(%rsp), %r14
movq (%r14), %rsi
addq %rbx, %rsi
movq %r14, %rdi
callq 0x16e05
movq (%r14), %rax
movq %r14, %rcx
movq 0x10(%r14), %r14
addq %rax, %r14
addq %rbx, %rax
movq %rax, (%rcx)
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x42d0
movq 0x10(%rsp), %r8
cmpl $0x0, 0x10(%r8)
jle 0x166c0
xorl %eax, %eax
leaq 0x3c326(%rip), %rdx     # 0x529a0
xorl %esi, %esi
movsbq (%r12,%rsi), %rcx
movb (%rdx,%rcx), %dil
movl %eax, %ecx
notb %cl
andb $0x4, %cl
shlb %cl, %dil
movl %esi, %ecx
shrl %ecx
orb %dil, (%r14,%rcx)
incq %rsi
movslq 0x10(%r8), %rcx
addb $0x4, %al
cmpq %rcx, %rsi
jl 0x1667c
jmp 0x166c0
addq %r15, %rbp
movq %rbp, 0x8(%rsp)
jmp 0x16004
movq 0x10(%rsp), %rax
movl $0x0, 0x10(%rax)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rcx
leaq 0x1(%rcx), %rax
addq %rcx, %r13
subq %r15, %r13
movzbl -0x1(%rax), %ecx
testl %ecx, %ecx
je 0x166ed
cmpl $0x9, %ecx
je 0x166ed
incq %rax
incq %r13
jmp 0x166d8
movq %rax, 0x8(%rsp)
movb $0x0, -0x1(%rax)
movq 0x10(%rsp), %r12
movslq 0x10(%r12), %rsi
leaq 0x30(%rsp), %rbx
addq (%rbx), %rsi
movq %rbx, %rdi
callq 0x16e05
movq (%rbx), %rax
movq 0x10(%rbx), %r14
addq %rax, %r14
movslq 0x10(%r12), %r12
addq %r12, %rax
movq %rax, (%rbx)
leaq 0x3cf9d(%rip), %rsi     # 0x536c9
movq 0x18(%rsp), %rdi
callq 0x4750
testl %eax, %eax
je 0x1677b
cmpq %r13, %r12
je 0x1674f
leaq 0x4de0a(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
jg 0x16d59
movq 0x10(%rsp), %r13
cmpl $0x0, 0x10(%r13)
jle 0x16790
xorl %eax, %eax
leaq (%rax,%rbp), %rcx
movb 0x1(%r15,%rcx), %cl
addb $-0x21, %cl
movb %cl, (%r14,%rax)
incq %rax
movslq 0x10(%r13), %rcx
cmpq %rcx, %rax
jl 0x1675d
jmp 0x16790
movq %r14, %rdi
movl $0xff, %esi
movq %r12, %rdx
callq 0x42d0
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %r12
leaq 0x30(%rsp), %rbx
leaq 0x2c(%rsp), %r15
movq 0x50(%rsp), %rcx
movq 0x10(%rcx), %rax
addq (%rcx), %rax
cmpq %rax, %r12
jae 0x16d48
movq %r12, (%rsp)
movl $0x4, %ebp
movq %r12, %r13
movzbl (%r13), %eax
testl %eax, %eax
je 0x167d6
cmpl $0x9, %eax
je 0x167d6
incq %r13
decq %rbp
jmp 0x167c0
leaq 0x1(%r13), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, (%r13)
leaq -0x5(%rbp), %rax
cmpq $-0x6, %rax
jl 0x16803
leaq 0x4dd56(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
jg 0x16914
movq %r12, %rdi
movl $0x2, %esi
movq %rbx, %rdx
callq 0x16d6d
leaq 0x4(%r12), %rax
movq %rax, (%rsp)
movzbl 0x3(%r12), %edi
leaq 0x5(%r12), %r14
movq %r14, (%rsp)
leal -0x41(%rdi), %eax
cmpl $0x22, %eax
ja 0x16877
movabsq $0x500000005, %rcx      # imm = 0x500000005
btq %rax, %rcx
jae 0x16877
movl $0x41, %edi
movq %rbx, %rsi
callq 0x16e74
movsbl (%r14), %edi
movq %rbx, %rsi
callq 0x16e74
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x1679f
jmp 0x16d39
movl %edi, %eax
andb $-0x21, %al
cmpb $0x49, %al
jne 0x168ba
cmpb $0x2d, (%r14)
movq %rsp, %rsi
movq %r14, %rdi
movl $0xa, %edx
jne 0x1692e
callq 0x4760
movq %rax, %r14
cmpq $-0x80, %rax
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
jl 0x1698d
movl $0x63, %edi
jmp 0x1694d
cmpl $0x59, %edi
jle 0x16965
cmpl $0x5a, %edi
movq 0x10(%rsp), %r13
je 0x1697c
cmpl $0x64, %edi
je 0x169d6
cmpl $0x66, %edi
jne 0x16a56
movq %r14, %rdi
movq %rsp, %rsi
callq 0x4400
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20(%rsp)
movl $0x66, %edi
movq %rbx, %rsi
callq 0x16e74
leaq 0x20(%rsp), %rdi
movl $0x4, %esi
jmp 0x169fe
callq 0x5054
movl $0xb, %r14d
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
jmp 0x16869
callq 0x4180
movq %rax, %r14
cmpq $0xff, %rax
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
ja 0x169a7
movl $0x43, %edi
movq %rbx, %rsi
callq 0x16e74
movl %r14d, %edi
movq %rbx, %rsi
callq 0x16e74
jmp 0x16866
cmpl $0x42, %edi
je 0x16a0b
cmpl $0x48, %edi
movq 0x10(%rsp), %r13
jne 0x16a56
movq %rbx, %rsi
callq 0x16e74
negl %ebp
movq %r14, %rdi
movl %ebp, %esi
jmp 0x169fe
cmpq $-0x8000, %r14          # imm = 0x8000
jl 0x16b15
movw %r14w, 0x20(%rsp)
movl $0x73, %edi
jmp 0x169bf
cmpq $0xffff, %r14           # imm = 0xFFFF
ja 0x16b21
movw %r14w, 0x20(%rsp)
movl $0x53, %edi
movq %rbx, %rsi
callq 0x16e74
leaq 0x20(%rsp), %rdi
movl $0x2, %esi
jmp 0x16b3d
movq %r14, %rdi
movq %rsp, %rsi
callq 0x4400
movsd %xmm0, 0x20(%rsp)
movl $0x64, %edi
movq %rbx, %rsi
callq 0x16e74
leaq 0x20(%rsp), %rdi
movl $0x8, %esi
movq %rbx, %rdx
callq 0x16d6d
jmp 0x16861
cmpq $-0x3, %rbp
jl 0x16a28
leaq 0x4db38(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
leaq 0x3cc27(%rip), %rdi     # 0x53649
jg 0x16c56
leaq 0x6(%r12), %rax
movq %rax, (%rsp)
movzbl 0x5(%r12), %ebp
movl $0x0, 0x20(%rsp)
xorl %ecx, %ecx
movzbl (%rax), %edx
cmpl $0x2c, %edx
je 0x16a4f
testl %edx, %edx
jne 0x16a51
jmp 0x16a7b
incl %ecx
incq %rax
jmp 0x16a41
leaq 0x4daf3(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
movq 0x18(%rsp), %r12
jle 0x16866
callq 0x5035
movl $0xb, %r14d
jmp 0x16869
movl %ecx, 0x20(%rsp)
movl $0x42, %edi
movq %rbx, %rsi
callq 0x16e74
movl %ebp, %edi
movq %rbx, %rsi
callq 0x16e74
leaq 0x20(%rsp), %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x16d6d
cmpl $0x62, %ebp
jle 0x16b4a
cmpl $0x68, %ebp
jg 0x16bab
cmpl $0x63, %ebp
je 0x16c68
cmpl $0x66, %ebp
jne 0x16c3f
movq (%rsp), %rdi
xorl %r14d, %r14d
cmpq %r13, %rdi
movq %r15, %rbp
movq %rbx, %r12
jae 0x16d20
incq %rdi
movq %rsp, %rsi
callq 0x4400
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x2c(%rsp)
movq %rbp, %rdi
movl $0x4, %esi
movq %r12, %rdx
callq 0x16d6d
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16ae2
jmp 0x16d20
movl %r14d, 0x20(%rsp)
movl $0x69, %edi
jmp 0x16b2b
movl %r14d, 0x20(%rsp)
movl $0x49, %edi
movq %rbx, %rsi
callq 0x16e74
leaq 0x20(%rsp), %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x16d6d
jmp 0x16866
cmpl $0x43, %ebp
je 0x16c03
cmpl $0x49, %ebp
je 0x16cdf
cmpl $0x53, %ebp
jne 0x16c3f
movq (%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbp
movq %rbx, %r12
jae 0x16d1d
incq %rdi
xorl %r14d, %r14d
movq %rsp, %rsi
xorl %edx, %edx
callq 0x4180
movw %ax, 0x2c(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x16d6d
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16b78
jmp 0x16d20
cmpl $0x69, %ebp
je 0x16ca1
cmpl $0x73, %ebp
jne 0x16c3f
movq (%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbp
movq %rbx, %r12
jae 0x16d1d
incq %rdi
xorl %r14d, %r14d
movq %rsp, %rsi
xorl %edx, %edx
callq 0x4760
movw %ax, 0x2c(%rsp)
movq %rbp, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x16d6d
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16bd0
jmp 0x16d20
movq (%rsp), %rdi
cmpq %r13, %rdi
movq %rsp, %r12
movq %rbx, %rbp
jae 0x16d1d
incq %rdi
xorl %r14d, %r14d
movq %r12, %rsi
xorl %edx, %edx
callq 0x4180
movzbl %al, %edi
movq %rbp, %rsi
callq 0x16e74
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16c16
jmp 0x16d20
leaq 0x4d90a(%rip), %rax     # 0x64550
cmpl $0x0, (%rax)
leaq 0x3ca1f(%rip), %rdi     # 0x5366f
jle 0x16d1d
callq 0x501a
movl $0xb, %r14d
xorl %eax, %eax
jmp 0x16d22
movq (%rsp), %rdi
cmpq %r13, %rdi
jae 0x16d1d
movq %rsp, %r12
movq %rbx, %rbp
incq %rdi
xorl %r14d, %r14d
movq %r12, %rsi
xorl %edx, %edx
callq 0x4760
movsbl %al, %edi
movq %rbp, %rsi
callq 0x16e74
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16c7b
jmp 0x16d20
movq (%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbp
movq %rbx, %r12
jae 0x16d1d
incq %rdi
xorl %r14d, %r14d
movq %rsp, %rsi
xorl %edx, %edx
callq 0x4760
movl %eax, 0x2c(%rsp)
movq %rbp, %rdi
movl $0x4, %esi
movq %r12, %rdx
callq 0x16d6d
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16cb0
jmp 0x16d20
movq (%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbp
movq %rbx, %r12
jae 0x16d1d
incq %rdi
xorl %r14d, %r14d
movq %rsp, %rsi
xorl %edx, %edx
callq 0x4180
movl %eax, 0x2c(%rsp)
movq %rbp, %rdi
movl $0x4, %esi
movq %r12, %rdx
callq 0x16d6d
movq (%rsp), %rdi
cmpq %r13, %rdi
jb 0x16cee
jmp 0x16d20
xorl %r14d, %r14d
movb $0x1, %al
testb %al, %al
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
jne 0x16866
jmp 0x16869
cmpl $0xb, %r14d
je 0x16009
jmp 0x16027
xorl %eax, %eax
jmp 0x1600e
callq 0x4fbd
jmp 0x1650a
callq 0x4ffb
jmp 0x16004
callq 0x4fdc
jmp 0x16004