// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_read1
int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b)
{
	int ret, doff, doff0, dret, z = 0;
	bam1_core_t *c = &b->core;
	kstring_t *str = fp->str;
	kstream_t *ks = fp->ks;

	if (fp->is_first) {
		fp->is_first = 0;
		ret = str->l;
	} else {
		do { // special consideration for empty lines
			ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret);
			if (ret >= 0) z += str->l + 1;
		} while (ret == 0);
	}
	if (ret < 0) return -1;
	++fp->n_lines;
	doff = 0;

	{ // name
		c->l_qname = strlen(str->s) + 1;
		memcpy(alloc_data(b, doff + c->l_qname) + doff, str->s, c->l_qname);
		doff += c->l_qname;
	}
	{ // flag
		long flag;
		char *s;
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1;
		flag = strtol((char*)str->s, &s, 0);
		if (*s) { // not the end of the string
			flag = 0;
			for (s = str->s; *s; ++s)
				flag |= bam_char2flag_table[(int)*s];
		}
		c->flag = flag;
	}
	{ // tid, pos, qual
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->tid = bam_get_tid(header, str->s);
		if (c->tid < 0 && strcmp(str->s, "*")) {
			if (header->n_targets == 0) {
				fprintf(stderr, "[sam_read1] missing header? Abort!\n");
				exit(1);
			} else fprintf(stderr, "[sam_read1] reference '%s' is recognized as '*'.\n", str->s);
		}
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->pos = isdigit(str->s[0])? atoi(str->s) - 1 : -1;
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1; c->qual = isdigit(str->s[0])? atoi(str->s) : 0;
		if (ret < 0) return -2;
	}
	{ // cigar
		char *s, *t;
		int i, op;
		long x;
		c->n_cigar = 0;
		if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -3;
		z += str->l + 1;
		if (str->s[0] != '*') {
			uint32_t *cigar;
			for (s = str->s; *s; ++s) {
				if ((isalpha(*s)) || (*s=='=')) ++c->n_cigar;
				else if (!isdigit(*s)) parse_error(fp->n_lines, "invalid CIGAR character");
			}
			b->data = alloc_data(b, doff + c->n_cigar * 4);
			cigar = bam1_cigar(b);
			for (i = 0, s = str->s; i != c->n_cigar; ++i) {
				x = strtol(s, &t, 10);
				op = toupper(*t);
				if (op == 'M') op = BAM_CMATCH;
				else if (op == 'I') op = BAM_CINS;
				else if (op == 'D') op = BAM_CDEL;
				else if (op == 'N') op = BAM_CREF_SKIP;
				else if (op == 'S') op = BAM_CSOFT_CLIP;
				else if (op == 'H') op = BAM_CHARD_CLIP;
				else if (op == 'P') op = BAM_CPAD;
				else if (op == '=') op = BAM_CEQUAL;
				else if (op == 'X') op = BAM_CDIFF;
				else if (op == 'B') op = BAM_CBACK;
				else parse_error(fp->n_lines, "invalid CIGAR operation");
				s = t + 1;
				cigar[i] = bam_cigar_gen(x, op);
			}
			if (*s) parse_error(fp->n_lines, "unmatched CIGAR operation");
			c->bin = bam_reg2bin(c->pos, bam_calend(c, cigar));
			doff += c->n_cigar * 4;
		} else {
			if (!(c->flag&BAM_FUNMAP)) {
				fprintf(stderr, "Parse warning at line %lld: mapped sequence without CIGAR\n", (long long)fp->n_lines);
				c->flag |= BAM_FUNMAP;
			}
			c->bin = bam_reg2bin(c->pos, c->pos + 1);
		}
	}
	{ // mtid, mpos, isize
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1;
		c->mtid = strcmp(str->s, "=")? bam_get_tid(header, str->s) : c->tid;
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1;
		c->mpos = isdigit(str->s[0])? atoi(str->s) - 1 : -1;
		ret = ks_getuntil(ks, KS_SEP_TAB, str, &dret); z += str->l + 1;
		c->isize = (str->s[0] == '-' || isdigit(str->s[0]))? atoi(str->s) : 0;
		if (ret < 0) return -4;
	}
	{ // seq and qual
		int i;
		uint8_t *p = 0;
		if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -5; // seq
		z += str->l + 1;
		if (strcmp(str->s, "*")) {
			c->l_qseq = strlen(str->s);
			if (c->n_cigar && c->l_qseq != (int32_t)bam_cigar2qlen(c, bam1_cigar(b))) {
				fprintf(stderr, "Line %ld, sequence length %i vs %i from CIGAR\n",
						(long)fp->n_lines, c->l_qseq, (int32_t)bam_cigar2qlen(c, bam1_cigar(b)));
				parse_error(fp->n_lines, "CIGAR and sequence length are inconsistent");
			}
			p = (uint8_t*)alloc_data(b, doff + c->l_qseq + (c->l_qseq+1)/2) + doff;
			memset(p, 0, (c->l_qseq+1)/2);
			for (i = 0; i < c->l_qseq; ++i)
				p[i/2] |= bam_nt16_table[(int)str->s[i]] << 4*(1-i%2);
		} else c->l_qseq = 0;
		if (ks_getuntil(ks, KS_SEP_TAB, str, &dret) < 0) return -6; // qual
		z += str->l + 1;
		if (strcmp(str->s, "*") && c->l_qseq != strlen(str->s))
			parse_error(fp->n_lines, "sequence and quality are inconsistent");
		p += (c->l_qseq+1)/2;
		if (strcmp(str->s, "*") == 0) for (i = 0; i < c->l_qseq; ++i) p[i] = 0xff;
		else for (i = 0; i < c->l_qseq; ++i) p[i] = str->s[i] - 33;
		doff += c->l_qseq + (c->l_qseq+1)/2;
	}
	doff0 = doff;
	if (dret != '\n' && dret != '\r') { // aux
		while (ks_getuntil(ks, KS_SEP_TAB, str, &dret) >= 0) {
			uint8_t *s, type, key[2];
			z += str->l + 1;
			if (str->l < 6 || str->s[2] != ':' || str->s[4] != ':')
				parse_error(fp->n_lines, "missing colon in auxiliary data");
			key[0] = str->s[0]; key[1] = str->s[1];
			type = str->s[3];
			s = alloc_data(b, doff + 3) + doff;
			s[0] = key[0]; s[1] = key[1]; s += 2; doff += 2;
			if (type == 'A' || type == 'a' || type == 'c' || type == 'C') { // c and C for backward compatibility
				s = alloc_data(b, doff + 2) + doff;
				*s++ = 'A'; *s = str->s[5];
				doff += 2;
			} else if (type == 'I' || type == 'i') {
				long long x;
				s = alloc_data(b, doff + 5) + doff;
				x = (long long)atoll(str->s + 5);
				if (x < 0) {
					if (x >= -127) {
						*s++ = 'c'; *(int8_t*)s = (int8_t)x;
						s += 1; doff += 2;
					} else if (x >= -32767) {
						*s++ = 's'; *(int16_t*)s = (int16_t)x;
						s += 2; doff += 3;
					} else {
						*s++ = 'i'; *(int32_t*)s = (int32_t)x;
						s += 4; doff += 5;
						if (x < -2147483648ll)
							fprintf(stderr, "Parse warning at line %lld: integer %lld is out of range.",
									(long long)fp->n_lines, x);
					}
				} else {
					if (x <= 255) {
						*s++ = 'C'; *s++ = (uint8_t)x;
						doff += 2;
					} else if (x <= 65535) {
						*s++ = 'S'; *(uint16_t*)s = (uint16_t)x;
						s += 2; doff += 3;
					} else {
						*s++ = 'I'; *(uint32_t*)s = (uint32_t)x;
						s += 4; doff += 5;
						if (x > 4294967295ll)
							fprintf(stderr, "Parse warning at line %lld: integer %lld is out of range.",
									(long long)fp->n_lines, x);
					}
				}
			} else if (type == 'f') {
				s = alloc_data(b, doff + 5) + doff;
				*s++ = 'f';
				*(float*)s = (float)atof(str->s + 5);
				s += 4; doff += 5;
			} else if (type == 'd') {
				s = alloc_data(b, doff + 9) + doff;
				*s++ = 'd';
				*(float*)s = (float)atof(str->s + 9);
				s += 8; doff += 9;
			} else if (type == 'Z' || type == 'H') {
				int size = 1 + (str->l - 5) + 1;
				if (type == 'H') { // check whether the hex string is valid
					int i;
					if ((str->l - 5) % 2 == 1) parse_error(fp->n_lines, "length of the hex string not even");
					for (i = 0; i < str->l - 5; ++i) {
						int c = toupper(str->s[5 + i]);
						if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')))
							parse_error(fp->n_lines, "invalid hex character");
					}
				}
				s = alloc_data(b, doff + size) + doff;
				*s++ = type;
				memcpy(s, str->s + 5, str->l - 5);
				s[str->l - 5] = 0;
				doff += size;
			} else if (type == 'B') {
				int32_t n = 0, Bsize, k = 0, size;
				char *p;
				if (str->l < 8) parse_error(fp->n_lines, "too few values in aux type B");
				Bsize = bam_aux_type2size(str->s[5]); // the size of each element
				for (p = (char*)str->s + 6; *p; ++p) // count the number of elements in the array
					if (*p == ',') ++n;
				p = str->s + 7; // now p points to the first number in the array
				size = 6 + Bsize * n; // total number of bytes allocated to this tag
				s = alloc_data(b, doff + 6 * Bsize * n) + doff; // allocate memory
				*s++ = 'B'; *s++ = str->s[5];
				memcpy(s, &n, 4); s += 4; // write the number of elements
				if (str->s[5] == 'c')      while (p < str->s + str->l) ((int8_t*)s)[k++]   = (int8_t)strtol(p, &p, 0),   ++p;
				else if (str->s[5] == 'C') while (p < str->s + str->l) ((uint8_t*)s)[k++]  = (uint8_t)strtol(p, &p, 0),  ++p;
				else if (str->s[5] == 's') while (p < str->s + str->l) ((int16_t*)s)[k++]  = (int16_t)strtol(p, &p, 0),  ++p; // FIXME: avoid unaligned memory
				else if (str->s[5] == 'S') while (p < str->s + str->l) ((uint16_t*)s)[k++] = (uint16_t)strtol(p, &p, 0), ++p;
				else if (str->s[5] == 'i') while (p < str->s + str->l) ((int32_t*)s)[k++]  = (int32_t)strtol(p, &p, 0),  ++p;
				else if (str->s[5] == 'I') while (p < str->s + str->l) ((uint32_t*)s)[k++] = (uint32_t)strtol(p, &p, 0), ++p;
				else if (str->s[5] == 'f') while (p < str->s + str->l) ((float*)s)[k++]    = (float)strtod(p, &p),       ++p;
				else parse_error(fp->n_lines, "unrecognized array type");
				s += Bsize * n; doff += size;
			} else parse_error(fp->n_lines, "unrecognized type");
			if (dret == '\n' || dret == '\r') break;
		}
	}
	b->l_aux = doff - doff0;
	b->data_len = doff;
	if (bam_no_B) bam_remove_B(b);
	return z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, -0x68(%rbp)
movq 0x8(%rdi), %r13
movq 0x10(%rdi), %r15
cmpl $0x0, 0x20(%rdi)
pushq $-0x1
popq %rax
je 0x49e7
andl $0x0, 0x20(%rdi)
testb $-0x80, 0x3(%r15)
jne 0x503d
pushq $0xa
popq %r12
jmp 0x4a26
movq %r13, -0x58(%rbp)
xorl %r12d, %r12d
pushq $0x1
popq %rbx
leaq -0x44(%rbp), %r14
movq %rdi, %r13
movq 0x8(%rdi), %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x6e6a
testl %eax, %eax
js 0x4ac6
movl (%r15), %eax
leal 0x1(%r12,%rax), %r12d
movq %r13, %rdi
je 0x49f5
addl $0xa, %r12d
movq -0x58(%rbp), %r13
movq %rdi, -0x60(%rbp)
incq 0x18(%rdi)
movq 0x10(%r15), %rdi
callq 0x3120
shll $0x18, %eax
leal 0x1000000(%rax), %esi
shrl $0x18, %esi
movq -0x38(%rbp), %rbx
movb %sil, 0xb(%rbx)
movq %rbx, %rdi
callq 0x7769
movq 0x10(%r15), %rsi
movzbl 0xb(%rbx), %edx
movq %rax, %rdi
callq 0x3260
movzbl 0xb(%rbx), %eax
movq %rax, -0x70(%rbp)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %r15, %rdx
callq 0x6e6a
movl (%r15), %eax
movl %eax, -0x88(%rbp)
movq 0x10(%r15), %rdi
leaq -0x50(%rbp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x34b0
movq (%rbx), %rcx
cmpb $0x0, (%rcx)
je 0x4acd
movq 0x10(%r15), %rcx
xorl %eax, %eax
leaq 0xa9b3(%rip), %rdx      # 0xf460
movq -0x38(%rbp), %r8
movsbq (%rcx), %rsi
testq %rsi, %rsi
je 0x4ad1
movzwl (%rdx,%rsi,2), %esi
orq %rsi, %rax
incq %rcx
jmp 0x4ab1
pushq $-0x1
jmp 0x503c
movq -0x38(%rbp), %r8
movw %ax, 0xc(%r8)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %r15, %rdx
movq %r15, %r14
movq %r8, %r15
callq 0x6e6a
movl (%r14), %eax
movl %eax, -0x84(%rbp)
movq %r14, -0x40(%rbp)
movq 0x10(%r14), %rbx
movq -0x68(%rbp), %rdi
movq %rbx, %rsi
callq 0x6865
movl %eax, (%r15)
testl %eax, %eax
jns 0x4b25
cmpb $0x2a, (%rbx)
jne 0x4f6a
cmpb $0x0, 0x1(%rbx)
jne 0x4f6a
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq -0x40(%rbp), %rbx
movq %rbx, %rdx
callq 0x6e6a
movl (%rbx), %r15d
callq 0x3380
movq %rax, -0x30(%rbp)
movq (%rax), %rax
movq 0x10(%rbx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x4b5e
pushq $-0x1
popq %rax
jmp 0x4b69
callq 0x3540
movq -0x40(%rbp), %rbx
decl %eax
movq -0x38(%rbp), %rcx
movl %eax, 0x4(%rcx)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %rbx, %rdx
callq 0x6e6a
movq -0x40(%rbp), %rdx
movl %eax, %ebx
movl (%rdx), %r14d
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rdx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x4ba5
xorl %eax, %eax
jmp 0x4bb4
callq 0x3540
movq -0x40(%rbp), %rdx
movzbl %al, %eax
shll $0x10, %eax
movq $-0xff0001, %rcx        # imm = 0xFF00FFFF
movq -0x38(%rbp), %r8
andq 0x8(%r8), %rcx
orq %rax, %rcx
movq %rcx, 0x8(%r8)
testl %ebx, %ebx
js 0x4c37
movl %r14d, -0x80(%rbp)
andl $0x0, 0x10(%r8)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %rdx, %rbx
movq %r8, %r14
callq 0x6e6a
testl %eax, %eax
js 0x4c3e
movl (%rbx), %esi
movq 0x10(%rbx), %rax
movb (%rax), %cl
cmpb $0x2a, %cl
movq %r14, %r8
movl %esi, -0x7c(%rbp)
jne 0x4c45
movq 0x8(%r8), %rbx
btq $0x22, %rbx
jae 0x567c
movl 0x4(%r8), %edi
leal 0x1(%rdi), %esi
movq %r8, %r14
callq 0x77e4
movzwl %ax, %eax
andq $-0x10000, %rbx         # imm = 0xFFFF0000
orq %rax, %rbx
movq %rbx, 0x8(%r14)
jmp 0x4d8b
pushq $-0x2
jmp 0x503c
pushq $-0x3
jmp 0x503c
incq %rax
movq -0x30(%rbp), %rdi
testb %cl, %cl
je 0x4c80
cmpb $0x3d, %cl
je 0x4c75
movq (%rdi), %rdx
movsbq %cl, %rcx
movzwl (%rdx,%rcx,2), %ecx
movl %ecx, %edx
andl $0x400, %edx            # imm = 0x400
jne 0x4c75
btl $0xb, %ecx
jb 0x4c79
jmp 0x56b3
incl 0x10(%r8)
movb (%rax), %cl
incq %rax
jmp 0x4c4c
movl %r15d, -0x74(%rbp)
movq %r13, -0x58(%rbp)
movl 0x10(%r8), %eax
movq -0x70(%rbp), %rcx
leal (%rcx,%rax,4), %esi
movq %r8, %rdi
callq 0x7769
movq -0x38(%rbp), %r15
movq %rax, 0x30(%r15)
movzbl 0xb(%r15), %r13d
addq %rax, %r13
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %r14d, %r14d
leaq 0x6363(%rip), %rbx      # 0xb020
movl 0x10(%r15), %r15d
cmpq %r15, %r14
je 0x4d4d
leaq -0x50(%rbp), %rsi
pushq $0xa
popq %rdx
callq 0x34b0
movq %rax, %r15
callq 0x3080
movq (%rax), %rax
movq -0x50(%rbp), %rdi
movsbq (%rdi), %rcx
movl (%rax,%rcx,4), %eax
leal -0x42(%rax), %ecx
cmpl $0x11, %ecx
ja 0x4d01
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
pushq $0x9
jmp 0x4d31
cmpl $0x3d, %eax
je 0x4d2f
cmpl $0x58, %eax
jne 0x56db
pushq $0x8
jmp 0x4d31
pushq $0x6
jmp 0x4d31
pushq $0x3
jmp 0x4d31
xorl %eax, %eax
jmp 0x4d32
pushq $0x1
jmp 0x4d31
pushq $0x5
jmp 0x4d31
pushq $0x2
jmp 0x4d31
pushq $0x4
jmp 0x4d31
pushq $0x7
popq %rax
incq %rdi
shll $0x4, %r15d
orl %r15d, %eax
movl %eax, (%r13,%r14,4)
incq %r14
movq -0x38(%rbp), %r15
jmp 0x4cbd
cmpb $0x0, (%rdi)
jne 0x571d
movq -0x38(%rbp), %r14
movl 0x4(%r14), %ebx
movq %r14, %rdi
movq %r13, %rsi
callq 0x57ca
movl %ebx, %edi
movl %eax, %esi
callq 0x77e4
movw %ax, 0x8(%r14)
movq -0x70(%rbp), %rax
leal (%rax,%r15,4), %eax
movq %rax, -0x70(%rbp)
movq -0x58(%rbp), %r13
movl -0x74(%rbp), %r15d
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq -0x40(%rbp), %rbx
movq %rbx, %rdx
callq 0x6e6a
movl (%rbx), %r14d
movq 0x10(%rbx), %rsi
cmpb $0x3d, (%rsi)
jne 0x4db7
cmpb $0x0, 0x1(%rsi)
je 0x4f5c
movq -0x68(%rbp), %rdi
callq 0x6865
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rbx
movl %eax, 0x18(%rcx)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
callq 0x6e6a
movq -0x40(%rbp), %rdx
movl (%rdx), %esi
movq (%rbx), %rax
movq 0x10(%rdx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
movq %rsi, -0x68(%rbp)
jne 0x4dff
pushq $-0x1
popq %rax
jmp 0x4e0a
callq 0x3540
movq -0x40(%rbp), %rdx
decl %eax
movq -0x38(%rbp), %rcx
movl %eax, 0x1c(%rcx)
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
callq 0x6e6a
movq -0x40(%rbp), %rdx
movl %eax, %ebx
movl (%rdx), %eax
movl %eax, -0x58(%rbp)
movq 0x10(%rdx), %rdi
movsbq (%rdi), %rcx
cmpq $0x2d, %rcx
je 0x4e49
movq -0x30(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
testb $0x8, 0x1(%rsi,%rcx,2)
je 0x4e52
callq 0x3540
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movl %eax, 0x20(%rcx)
testl %ebx, %ebx
js 0x4f4e
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %rdx, %rbx
callq 0x6e6a
testl %eax, %eax
js 0x4f55
movl (%rbx), %eax
movl %eax, -0x30(%rbp)
movq 0x10(%rbx), %rdi
cmpb $0x2a, (%rdi)
movl %r15d, -0x74(%rbp)
jne 0x4e97
cmpb $0x0, 0x1(%rdi)
je 0x4f9a
movl %r14d, -0x78(%rbp)
callq 0x3120
movq %rax, %rbx
movq -0x38(%rbp), %rdi
movl %ebx, 0x14(%rdi)
cmpl $0x0, 0x10(%rdi)
je 0x4ec9
movzbl 0xb(%rdi), %esi
addq 0x30(%rdi), %rsi
callq 0x589f
movq -0x38(%rbp), %rdi
cmpl %ebx, %eax
jne 0x5731
movq -0x70(%rbp), %r15
leal (%r15,%rbx), %esi
incl %ebx
movl %ebx, %eax
cltd
pushq $0x2
popq %r14
idivl %r14d
addl %eax, %esi
movq %rdi, %rbx
callq 0x7769
movslq %r15d, %r15
addq %rax, %r15
movl 0x14(%rbx), %eax
incl %eax
cltd
idivl %r14d
movslq %eax, %rdx
xorl %ebx, %ebx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3170
leaq 0xa454(%rip), %rax      # 0xf360
xorl %edi, %edi
movq -0x40(%rbp), %rdx
movl -0x78(%rbp), %r14d
movq -0x38(%rbp), %rcx
movslq 0x14(%rcx), %rcx
cmpq %rcx, %rdi
jge 0x4fa8
movq 0x10(%rdx), %rcx
movsbq (%rcx,%rdi), %rcx
movb (%rcx,%rax), %sil
movl %ebx, %ecx
notb %cl
andb $0x4, %cl
shlb %cl, %sil
movl %edi, %ecx
shrl %ecx
orb %sil, (%r15,%rcx)
incq %rdi
addb $0x4, %bl
jmp 0x4f16
pushq $-0x4
jmp 0x503c
pushq $-0x5
jmp 0x503c
movq %rbx, %rdx
movq -0x38(%rbp), %rcx
movl (%rcx), %eax
jmp 0x4dc8
movq -0x68(%rbp), %rax
cmpl $0x0, (%rax)
movq 0xa058(%rip), %rax      # 0xefd0
movq (%rax), %rcx
je 0x56ef
leaq 0x63d2(%rip), %rsi      # 0xb35a
movq %rcx, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x34c0
jmp 0x4b25
movq %rbx, %rdx
movq -0x38(%rbp), %rax
andl $0x0, 0x14(%rax)
xorl %r15d, %r15d
pushq $0x1
popq %rsi
leaq -0x44(%rbp), %rcx
movq %r13, %rdi
movq %rdx, %rbx
callq 0x6e6a
testl %eax, %eax
js 0x503a
addl -0x88(%rbp), %r12d
addl -0x84(%rbp), %r12d
addl -0x74(%rbp), %r12d
addl -0x80(%rbp), %r12d
addl -0x7c(%rbp), %r12d
addl %r14d, %r12d
movq -0x68(%rbp), %rax
addl -0x58(%rbp), %eax
addl -0x30(%rbp), %eax
addl %r12d, %eax
addl (%rbx), %eax
movq %rax, -0x68(%rbp)
movq 0x10(%rbx), %rdi
movb (%rdi), %r12b
cmpb $0x2a, %r12b
movq %rdi, -0x30(%rbp)
jne 0x5005
cmpb $0x0, 0x1(%rdi)
je 0x504c
movq -0x38(%rbp), %rbx
movslq 0x14(%rbx), %r14
callq 0x3120
cmpq %r14, %rax
jne 0x5766
leaq 0x14(%rbx), %rcx
leal 0x1(%r14), %eax
cltd
pushq $0x2
popq %rsi
idivl %esi
cltq
addq %rax, %r15
cmpb $0x2a, %r12b
movq -0x40(%rbp), %r8
je 0x506a
jmp 0x5074
pushq $-0x6
popq %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %r8
movq -0x38(%rbp), %rax
leaq 0x14(%rax), %rcx
movl 0x14(%rax), %r14d
leal 0x1(%r14), %eax
cltd
pushq $0x2
popq %rsi
idivl %esi
cltq
addq %rax, %r15
movq -0x30(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x5094
xorl %eax, %eax
movslq %r14d, %rdx
cmpq %rdx, %rax
jge 0x50ab
movq 0x10(%r8), %rdx
movb (%rdx,%rax), %dl
addb $-0x21, %dl
movb %dl, (%r15,%rax)
incq %rax
movl (%rcx), %r14d
jmp 0x5076
xorl %eax, %eax
movslq %r14d, %rdx
cmpq %rdx, %rax
jge 0x50ab
movb $-0x1, (%r15,%rax)
incq %rax
movl (%rcx), %r14d
jmp 0x5096
leal 0x1(%r14), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movq -0x70(%rbp), %rcx
addl %r14d, %ecx
addl %eax, %ecx
movl -0x44(%rbp), %eax
cmpl $0xa, %eax
movq %rcx, -0x70(%rbp)
je 0x50dd
cmpl $0xd, %eax
movq -0x38(%rbp), %r15
jne 0x5110
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x50e5
movq %rcx, -0x30(%rbp)
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %rcx
movl %ecx, %eax
subl -0x70(%rbp), %eax
movl %eax, 0x24(%r15)
movl %ecx, 0x28(%r15)
cmpl $0x0, 0xa7a3(%rip)      # 0xf8a0
je 0x5107
movq %r15, %rdi
callq 0x5b0c
movq -0x68(%rbp), %rax
jmp 0x503d
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movq %r13, %rdi
pushq $0x1
popq %rsi
movq %r8, %rdx
leaq -0x44(%rbp), %rcx
movq %r8, %rbx
callq 0x6e6a
testl %eax, %eax
js 0x50e5
movq (%rbx), %rax
movq %rax, -0x58(%rbp)
cmpq $0x6, %rax
jb 0x56c7
movq 0x10(%rbx), %rax
cmpb $0x3a, 0x2(%rax)
jne 0x56c7
cmpb $0x3a, 0x4(%rax)
jne 0x56c7
movzwl (%rax), %r12d
movb 0x3(%rax), %r14b
movzbl %r14b, %r15d
movq -0x30(%rbp), %rbx
leal 0x3(%rbx), %esi
movq -0x38(%rbp), %rdi
callq 0x7769
movslq %ebx, %rbx
movw %r12w, (%rax,%rbx)
addq $0x2, %rbx
leal -0x41(%r15), %eax
cmpl $0x22, %eax
ja 0x51ef
movabsq $0x500000005, %rcx      # imm = 0x500000005
btq %rax, %rcx
jae 0x51ef
movq -0x30(%rbp), %rsi
addl $0x4, %esi
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %rsi, -0x30(%rbp)
callq 0x7769
movb $0x41, (%rax,%rbx)
movq -0x40(%rbp), %r8
movq 0x10(%r8), %rcx
movb 0x5(%rcx), %cl
movb %cl, 0x1(%rax,%rbx)
movq -0x58(%rbp), %rcx
movq -0x68(%rbp), %rax
addl %ecx, %eax
incl %eax
movq %rax, -0x68(%rbp)
movl -0x44(%rbp), %eax
cmpl $0xd, %eax
je 0x50e5
cmpl $0xa, %eax
jne 0x5118
jmp 0x50e5
movl %r14d, %eax
andb $-0x21, %al
cmpb $0x49, %al
jne 0x523f
movq -0x30(%rbp), %rax
leal 0x7(%rax), %r15d
movq -0x38(%rbp), %rdi
movl %r15d, %esi
callq 0x7769
movq %rax, %r14
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
addq $0x5, %rdi
callq 0x3240
testq %rax, %rax
js 0x5345
cmpq $0xff, %rax
ja 0x5371
movb $0x43, (%r14,%rbx)
jmp 0x5354
cmpl $0x42, %r15d
je 0x538b
cmpl $0x48, %r15d
je 0x5299
cmpl $0x5a, %r15d
je 0x5299
cmpl $0x64, %r15d
je 0x53bf
cmpl $0x66, %r15d
jne 0x57a2
movq -0x30(%rbp), %rsi
addl $0x7, %esi
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %rsi, -0x30(%rbp)
callq 0x7769
movq %rax, %r14
movb $0x66, (%rax,%rbx)
movq -0x40(%rbp), %r12
movq 0x10(%r12), %rdi
addq $0x5, %rdi
jmp 0x53ea
movq -0x40(%rbp), %rax
movq (%rax), %r15
cmpb $0x48, %r14b
jne 0x52f1
testb $0x1, %r15b
je 0x577a
pushq $0x5
popq %r12
cmpq %r12, %r15
je 0x52f1
callq 0x3080
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x10(%rcx), %rcx
movsbq (%rcx,%r12), %rcx
movl (%rax,%rcx,4), %eax
leal -0x30(%rax), %ecx
cmpl $0xa, %ecx
setb %cl
addl $-0x41, %eax
cmpl $0x6, %eax
setb %al
orb %cl, %al
incq %r12
testb %al, %al
jne 0x52b4
jmp 0x5709
movq -0x30(%rbp), %rsi
addl %r15d, %esi
decl %esi
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %rsi, -0x30(%rbp)
callq 0x7769
leaq (%rax,%rbx), %r15
leaq (%rax,%rbx), %rdi
incq %rdi
movb %r14b, -0x1(%rdi)
movq -0x40(%rbp), %rbx
movq (%rbx), %rdx
movq 0x10(%rbx), %rsi
addq $0x5, %rsi
addq $-0x5, %rdx
callq 0x3260
movq %rbx, %r8
movq (%rbx), %rax
movb $0x0, -0x4(%rax,%r15)
movq %r12, %r15
jmp 0x51c5
cmpq $-0x7f, %rax
jb 0x55f7
movb $0x63, (%r14,%rbx)
movb %al, 0x1(%r14,%rbx)
movq -0x30(%rbp), %rax
addl $0x4, %eax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %r8
jmp 0x51c5
cmpq $0xffff, %rax           # imm = 0xFFFF
movq -0x40(%rbp), %r8
ja 0x5617
movb $0x53, (%r14,%rbx)
jmp 0x5608
movq -0x40(%rbp), %rax
cmpq $0x7, (%rax)
jbe 0x578e
movq 0x10(%rax), %r15
movsbl 0x5(%r15), %edi
leaq 0x6(%r15), %rax
xorl %r14d, %r14d
movzbl (%rax), %ecx
cmpl $0x2c, %ecx
je 0x53b7
testl %ecx, %ecx
jne 0x53ba
jmp 0x5402
incl %r14d
incq %rax
jmp 0x53a9
movq -0x30(%rbp), %rsi
addl $0xb, %esi
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %rsi, -0x30(%rbp)
callq 0x7769
movq %rax, %r14
movb $0x64, (%rax,%rbx)
movq -0x40(%rbp), %r12
movq 0x10(%r12), %rdi
addq $0x9, %rdi
callq 0x3420
movq %r12, %r8
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1(%r14,%rbx)
jmp 0x51c5
callq 0x61de
movl %eax, %r12d
addq $0x7, %r15
movq %r15, -0x50(%rbp)
imull %r14d, %r12d
imull $0x6, %r12d, %esi
addl %ebx, %esi
movq -0x38(%rbp), %rdi
callq 0x7769
movq -0x40(%rbp), %r8
addq %rax, %rbx
addq $0x6, %rbx
movb $0x42, -0x6(%rbx)
movq 0x10(%r8), %rax
movb 0x5(%rax), %al
movb %al, -0x5(%rbx)
movl %r14d, -0x4(%rbx)
movq 0x10(%r8), %rax
movzbl 0x5(%rax), %ecx
cmpl $0x43, %ecx
je 0x55e3
cmpl $0x49, %ecx
je 0x55b3
cmpl $0x53, %ecx
je 0x54ae
cmpl $0x63, %ecx
je 0x54e1
cmpl $0x73, %ecx
je 0x5516
cmpl $0x69, %ecx
je 0x5582
cmpl $0x66, %ecx
je 0x554e
jmp 0x57b6
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movw %ax, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
addq $0x2, %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x5486
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movb %al, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
incq %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x54bb
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movw %ax, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
addq $0x2, %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x54ee
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x3220
movq -0x40(%rbp), %r8
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
addq $0x4, %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x5523
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movl %eax, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
addq $0x4, %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x555b
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movl %eax, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
addq $0x4, %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x558c
jmp 0x55eb
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x34b0
movq -0x40(%rbp), %r8
movb %al, (%rbx)
movq -0x50(%rbp), %r15
incq %r15
movq %r15, -0x50(%rbp)
movq 0x10(%r8), %rax
incq %rbx
addq (%r8), %rax
cmpq %rax, %r15
jb 0x55bd
movq -0x30(%rbp), %rax
addl %r12d, %eax
addl $0x8, %eax
jmp 0x562d
cmpq $-0x7fff, %rax          # imm = 0x8001
movq -0x40(%rbp), %r8
jb 0x563a
movb $0x73, (%r14,%rbx)
movw %ax, 0x1(%r14,%rbx)
movq -0x30(%rbp), %rax
addl $0x5, %eax
jmp 0x562d
movb $0x49, (%r14,%rbx)
movl %eax, 0x1(%r14,%rbx)
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x5653
movl %r15d, %eax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %r15
jmp 0x51c5
movb $0x69, (%r14,%rbx)
movl %eax, 0x1(%r14,%rbx)
movabsq $-0x80000001, %rcx      # imm = 0xFFFFFFFF7FFFFFFF
cmpq %rcx, %rax
ja 0x562a
movq 0x9976(%rip), %rcx      # 0xefd0
movq (%rcx), %rdi
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rdx
leaq 0x5e45(%rip), %rsi      # 0xb4b1
movq %rax, %rcx
xorl %eax, %eax
callq 0x34c0
movq -0x40(%rbp), %r8
jmp 0x562a
movabsq $0x400000000, %rbx      # imm = 0x400000000
movq 0x9943(%rip), %rax      # 0xefd0
movq (%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x5d37(%rip), %rsi      # 0xb3d6
xorl %eax, %eax
callq 0x34c0
movq -0x38(%rbp), %r8
orq 0x8(%r8), %rbx
jmp 0x4c12
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5cca(%rip), %rsi      # 0xb38c
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5dbb(%rip), %rsi      # 0xb491
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5cba(%rip), %rsi      # 0xb3a4
callq 0x77bd
leaq 0x5c40(%rip), %rdi      # 0xb336
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x3660
pushq $0x1
popq %rdi
callq 0x33f0
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5df5(%rip), %rsi      # 0xb50d
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5c90(%rip), %rsi      # 0xb3bc
callq 0x77bd
movq 0x9898(%rip), %rcx      # 0xefd0
movq (%rcx), %rdi
movq -0x60(%rbp), %r14
movq 0x18(%r14), %rdx
leaq 0x5cc7(%rip), %rsi      # 0xb411
movl %ebx, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x34c0
movq 0x18(%r14), %rdi
leaq 0x5cdf(%rip), %rsi      # 0xb440
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5cf6(%rip), %rsi      # 0xb46b
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5d62(%rip), %rsi      # 0xb4eb
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5d86(%rip), %rsi      # 0xb523
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5da7(%rip), %rsi      # 0xb558
callq 0x77bd
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x5d7b(%rip), %rsi      # 0xb540
callq 0x77bd