// File: karel-brinda[P]ococo/ext/htslib/sam.c
// Function: sam_format1
int sam_format1(const bam_hdr_t *h, const bam1_t *b, kstring_t *str)
{
    int i;
    uint8_t *s;
    const bam1_core_t *c = &b->core;

    str->l = 0;
    kputsn(bam_get_qname(b), c->l_qname-1, str); kputc('\t', str); // query name
    kputw(c->flag, str); kputc('\t', str); // flag
    if (c->tid >= 0) { // chr
        kputs(h->target_name[c->tid] , str);
        kputc('\t', str);
    } else kputsn("*\t", 2, str);
    kputw(c->pos + 1, str); kputc('\t', str); // pos
    kputw(c->qual, str); kputc('\t', str); // qual
    if (c->n_cigar) { // cigar
        uint32_t *cigar = bam_get_cigar(b);
        for (i = 0; i < c->n_cigar; ++i) {
            kputw(bam_cigar_oplen(cigar[i]), str);
            kputc(bam_cigar_opchr(cigar[i]), str);
        }
    } else kputc('*', str);
    kputc('\t', str);
    if (c->mtid < 0) kputsn("*\t", 2, str); // mate chr
    else if (c->mtid == c->tid) kputsn("=\t", 2, str);
    else {
        kputs(h->target_name[c->mtid], str);
        kputc('\t', str);
    }
    kputw(c->mpos + 1, str); kputc('\t', str); // mate pos
    kputw(c->isize, str); kputc('\t', str); // template len
    if (c->l_qseq) { // seq and qual
        uint8_t *s = bam_get_seq(b);
        for (i = 0; i < c->l_qseq; ++i) kputc("=ACMGRSVTWYHKDBN"[bam_seqi(s, i)], str);
        kputc('\t', str);
        s = bam_get_qual(b);
        if (s[0] == 0xff) kputc('*', str);
        else for (i = 0; i < c->l_qseq; ++i) kputc(s[i] + 33, str);
    } else kputsn("*\t*", 3, str);

    // FIXME change "s+N <= b->data+b->l_data" to "b->data+b->l_data - s >= N"
    // (or equivalent) everywhere to avoid looking past the end of the array
    s = bam_get_aux(b); // aux
    while (s+4 <= b->data + b->l_data) {
        uint8_t type, key[2];
        key[0] = s[0]; key[1] = s[1];
        s += 2; type = *s++;
        kputc('\t', str); kputsn((char*)key, 2, str); kputc(':', str);
        if (type == 'A') {
            kputsn("A:", 2, str);
            kputc(*s, str);
            ++s;
        } else if (type == 'C') {
            kputsn("i:", 2, str);
            kputw(*s, str);
            ++s;
        } else if (type == 'c') {
            kputsn("i:", 2, str);
            kputw(*(int8_t*)s, str);
            ++s;
        } else if (type == 'S') {
            if (s+2 <= b->data + b->l_data) {
                kputsn("i:", 2, str);
                kputw(*(uint16_t*)s, str);
                s += 2;
            } else return -1;
        } else if (type == 's') {
            if (s+2 <= b->data + b->l_data) {
                kputsn("i:", 2, str);
                kputw(*(int16_t*)s, str);
                s += 2;
            } else return -1;
        } else if (type == 'I') {
            if (s+4 <= b->data + b->l_data) {
                kputsn("i:", 2, str);
                kputuw(*(uint32_t*)s, str);
                s += 4;
            } else return -1;
        } else if (type == 'i') {
            if (s+4 <= b->data + b->l_data) {
                kputsn("i:", 2, str);
                kputw(*(int32_t*)s, str);
                s += 4;
            } else return -1;
        } else if (type == 'f') {
            if (s+4 <= b->data + b->l_data) {
                ksprintf(str, "f:%g", *(float*)s);
                s += 4;
            } else return -1;

        } else if (type == 'd') {
            if (s+8 <= b->data + b->l_data) {
                ksprintf(str, "d:%g", *(double*)s);
                s += 8;
            } else return -1;
        } else if (type == 'Z' || type == 'H') {
            kputc(type, str); kputc(':', str);
            while (s < b->data + b->l_data && *s) kputc(*s++, str);
            if (s >= b->data + b->l_data)
                return -1;
            ++s;
        } else if (type == 'B') {
            uint8_t sub_type = *(s++);
            int sub_type_size = aux_type2size(sub_type);
            uint32_t n;
            if (sub_type_size == 0 || b->data + b->l_data - s < 4)
                return -1;
            memcpy(&n, s, 4);
            s += 4; // now points to the start of the array
            if ((b->data + b->l_data - s) / sub_type_size < n)
                return -1;
            kputsn("B:", 2, str); kputc(sub_type, str); // write the typing
            for (i = 0; i < n; ++i) { // FIXME: for better performance, put the loop after "if"
                kputc(',', str);
                if ('c' == sub_type)      { kputw(*(int8_t*)s, str); ++s; }
                else if ('C' == sub_type) { kputw(*(uint8_t*)s, str); ++s; }
                else if ('s' == sub_type) { kputw(*(int16_t*)s, str); s += 2; }
                else if ('S' == sub_type) { kputw(*(uint16_t*)s, str); s += 2; }
                else if ('i' == sub_type) { kputw(*(int32_t*)s, str); s += 4; }
                else if ('I' == sub_type) { kputuw(*(uint32_t*)s, str); s += 4; }
                else if ('f' == sub_type) { ksprintf(str, "%g", *(float*)s); s += 4; }
                else return -1;
            }
        }
    }
    return str->l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x18, %rax
andq $0xff, %rax
movl %eax, %esi
subl $0x1, %esi
movq -0x20(%rbp), %rdx
callq 0x1d230
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x1f2cd
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rsi
callq 0x1d650
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
jmp 0x1f2e2
movq -0x20(%rbp), %rdx
leaq 0x5c4a5(%rip), %rdi     # 0x7b77d
movl $0x2, %esi
callq 0x1d230
movq -0x38(%rbp), %rax
movl 0x4(%rax), %edi
addl $0x1, %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x10, %rax
andq $0xff, %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x30, %rax
cmpl $0x0, %eax
je 0x1f3cc
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
cmpl %ecx, %eax
jge 0x1f3ca
movq -0x40(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %edi
shrl $0x4, %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x40(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xf, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5c0c9(%rip), %rax     # 0x7b47b
movsbl (%rax,%rcx), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1f36f
jmp 0x1f3da
movq -0x20(%rbp), %rsi
movl $0x2a, %edi
callq 0x1d2c0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jge 0x1f409
movq -0x20(%rbp), %rdx
leaq 0x5c380(%rip), %rdi     # 0x7b77d
movl $0x2, %esi
callq 0x1d230
jmp 0x1f45c
movq -0x38(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x1f42f
movq -0x20(%rbp), %rdx
leaq 0x5c35d(%rip), %rdi     # 0x7b780
movl $0x2, %esi
callq 0x1d230
jmp 0x1f45a
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x38(%rbp), %rcx
movslq 0x14(%rcx), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rsi
callq 0x1d650
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
jmp 0x1f45c
movq -0x38(%rbp), %rax
movl 0x18(%rax), %edi
addl $0x1, %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x38(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1f5eb
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f539
movq -0x48(%rbp), %rax
movl -0x24(%rbp), %ecx
sarl %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl -0x24(%rbp), %ecx
xorl $-0x1, %ecx
andl $0x1, %ecx
shll $0x2, %ecx
sarl %cl, %eax
andl $0xf, %eax
movslq %eax, %rcx
leaq 0x5c262(%rip), %rax     # 0x7b783
movsbl (%rax,%rcx), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1f4ea
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movl 0x10(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
jne 0x1f5b1
movq -0x20(%rbp), %rsi
movl $0x2a, %edi
callq 0x1d2c0
jmp 0x1f5e9
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x1f5e7
movq -0x48(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %edi
addl $0x21, %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1f5b8
jmp 0x1f5e9
jmp 0x1f600
movq -0x20(%rbp), %rdx
leaq 0x5c19e(%rip), %rdi     # 0x7b794
movl $0x3, %esi
callq 0x1d230
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movl 0x10(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1fd47
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x4b(%rbp)
movq -0x30(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x4a(%rbp)
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x49(%rbp)
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x1d2c0
leaq -0x4b(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x2, %esi
callq 0x1d230
movq -0x20(%rbp), %rsi
movl $0x3a, %edi
callq 0x1d2c0
movzbl -0x49(%rbp), %eax
cmpl $0x41, %eax
jne 0x1f71b
movq -0x20(%rbp), %rdx
leaq 0x5c0a8(%rip), %rdi     # 0x7b798
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd42
movzbl -0x49(%rbp), %eax
cmpl $0x43, %eax
jne 0x1f75a
movq -0x20(%rbp), %rdx
leaq 0x5c06c(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd40
movzbl -0x49(%rbp), %eax
cmpl $0x63, %eax
jne 0x1f799
movq -0x20(%rbp), %rdx
leaq 0x5c02d(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd3e
movzbl -0x49(%rbp), %eax
cmpl $0x53, %eax
jne 0x1f806
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1f7f5
movq -0x20(%rbp), %rdx
leaq 0x5bfce(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movzwl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x1f801
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd3c
movzbl -0x49(%rbp), %eax
cmpl $0x73, %eax
jne 0x1f873
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1f862
movq -0x20(%rbp), %rdx
leaq 0x5bf61(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movswl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x1f86e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd3a
movzbl -0x49(%rbp), %eax
cmpl $0x49, %eax
jne 0x1f8df
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1f8ce
movq -0x20(%rbp), %rdx
leaq 0x5bef4(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1fd60
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1f8da
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd38
movzbl -0x49(%rbp), %eax
cmpl $0x69, %eax
jne 0x1f94b
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1f93a
movq -0x20(%rbp), %rdx
leaq 0x5be88(%rip), %rdi     # 0x7b79b
movl $0x2, %esi
callq 0x1d230
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1f946
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd36
movzbl -0x49(%rbp), %eax
cmpl $0x66, %eax
jne 0x1f9b1
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1f9a0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5be13(%rip), %rsi     # 0x7b79e
movb $0x1, %al
callq 0x620e0
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1f9ac
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd34
movzbl -0x49(%rbp), %eax
cmpl $0x64, %eax
jne 0x1fa13
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x1fa02
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movsd (%rax), %xmm0
leaq 0x5bdb6(%rip), %rsi     # 0x7b7a3
movb $0x1, %al
callq 0x620e0
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fa0e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd32
movzbl -0x49(%rbp), %eax
cmpl $0x5a, %eax
je 0x1fa29
movzbl -0x49(%rbp), %eax
cmpl $0x48, %eax
jne 0x1fad4
movzbl -0x49(%rbp), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movq -0x20(%rbp), %rsi
movl $0x3a, %edi
callq 0x1d2c0
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x18(%rbp), %rax
movslq 0x20(%rax), %rax
addq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x55(%rbp)
jae 0x1fa75
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x1fa7e
jmp 0x1fa9b
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
jmp 0x1fa44
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq -0x18(%rbp), %rdx
movslq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jb 0x1fac3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd30
movzbl -0x49(%rbp), %eax
cmpl $0x42, %eax
jne 0x1fd2e
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x4c(%rbp)
movzbl -0x4c(%rbp), %edi
callq 0x1fe60
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0x1fb27
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
cmpq $0x4, %rax
jge 0x1fb33
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movslq -0x50(%rbp), %rcx
cqto
idivq %rcx
movl -0x54(%rbp), %ecx
cmpq %rcx, %rax
jge 0x1fb7f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
movq -0x20(%rbp), %rdx
leaq 0x5bc1e(%rip), %rdi     # 0x7b7a8
movl $0x2, %esi
callq 0x1d230
movzbl -0x4c(%rbp), %edi
movq -0x20(%rbp), %rsi
callq 0x1d2c0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x54(%rbp), %eax
jae 0x1fd2c
movq -0x20(%rbp), %rsi
movl $0x2c, %edi
callq 0x1d2c0
movzbl -0x4c(%rbp), %ecx
movl $0x63, %eax
cmpl %ecx, %eax
jne 0x1fbf0
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd1c
movzbl -0x4c(%rbp), %ecx
movl $0x43, %eax
cmpl %ecx, %eax
jne 0x1fc1e
movq -0x30(%rbp), %rax
movzbl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd1a
movzbl -0x4c(%rbp), %ecx
movl $0x73, %eax
cmpl %ecx, %eax
jne 0x1fc4c
movq -0x30(%rbp), %rax
movswl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd18
movzbl -0x4c(%rbp), %ecx
movl $0x53, %eax
cmpl %ecx, %eax
jne 0x1fc7a
movq -0x30(%rbp), %rax
movzwl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd16
movzbl -0x4c(%rbp), %ecx
movl $0x69, %eax
cmpl %ecx, %eax
jne 0x1fca4
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1d690
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd14
movzbl -0x4c(%rbp), %ecx
movl $0x49, %eax
cmpl %ecx, %eax
jne 0x1fcce
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rsi
callq 0x1fd60
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd12
movzbl -0x4c(%rbp), %ecx
movl $0x66, %eax
cmpl %ecx, %eax
jne 0x1fd07
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5bab3(%rip), %rsi     # 0x7b7a5
movb $0x1, %al
callq 0x620e0
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x1fd10
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1fd51
jmp 0x1fd12
jmp 0x1fd14
jmp 0x1fd16
jmp 0x1fd18
jmp 0x1fd1a
jmp 0x1fd1c
jmp 0x1fd1e
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1fba8
jmp 0x1fd2e
jmp 0x1fd30
jmp 0x1fd32
jmp 0x1fd34
jmp 0x1fd36
jmp 0x1fd38
jmp 0x1fd3a
jmp 0x1fd3c
jmp 0x1fd3e
jmp 0x1fd40
jmp 0x1fd42
jmp 0x1f657
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)