// File: /workspace/github_c_makefile_star2_O1/DReichLab[P]adna/trim.c
// Function: lt_process
void lt_process(const lt_global_t *g, bseq1_t s[2])
{
	int i, k, mlen, bc_id[2];
	char *rseq, *rqual, *xseq, *xqual;

	mlen = s[0].l_seq > s[1].l_seq? s[0].l_seq : s[1].l_seq;
	rseq = (char*)alloca(mlen + 1);
	rqual = (char*)alloca(mlen + 1);
	xseq = (char*)alloca(s[0].l_seq + s[1].l_seq + 1);
	xqual = (char*)alloca(s[0].l_seq + s[1].l_seq + 1);

	// trim trailing N
	for (k = 0; k < 2; ++k) {
		bseq1_t *sk = &s[k];
		for (i = sk->l_seq - 1; i >= 0; --i) // trim trailing "N"
			if (sk->seq[i] != 'N') break;
		sk->l_seq = i + 1;
		sk->seq[sk->l_seq] = sk->qual[sk->l_seq] = 0;
	}
	// test barcode
	if (g->bc && g->bc->n[0] + g->bc->n[1] > 0) {
		char *bc;
		bc = (char*)alloca(g->bc->len[0] + g->bc->len[1] + 1);
		for (k = 0; k < 2; ++k) {
			lt_sc_hit_t hits[3];
			strncpy(bc, s[k].seq, g->bc->len[k]);
			bc[g->bc->len[k]] = 0;
			for (i = 0; i < g->bc->n[k]; ++i)
				if (lt_sc_test(g->bc->bc[k][i], bc, 3, hits))
					break;
			if (i == g->bc->n[k]) break;
			bc_id[k] = i;
		}
		if (k < 2) {
			s[0].type = s[1].type = AD_NO_BARCODE;
			return;
		}
		// write barcode
		strncpy(bc, g->bc->seq[0][bc_id[0]], g->bc->len[0]);
		strncpy(bc + g->bc->len[0], g->bc->seq[1][bc_id[1]], g->bc->len[1]);
		bc[g->bc->len[0] + g->bc->len[1]] = 0;
		s->bc = strdup(bc);
		if (g->bc->len[0]) trim_bseq_5(&s[0], g->bc->len[0]);
		if (g->bc->len[1]) trim_bseq_5(&s[1], g->bc->len[1]);
	} else if (g->opt.bc_len[0] + g->opt.bc_len[1] > 0) {
		char *bc;
		bc = (char*)alloca(g->opt.bc_len[0] + g->opt.bc_len[1] + 1);
		strncpy(bc, s[0].seq, g->opt.bc_len[0]);
		strncpy(bc + g->opt.bc_len[0], s[1].seq, g->opt.bc_len[1]);
		bc[g->opt.bc_len[0] + g->opt.bc_len[1]] = 0;
		s->bc = strdup(bc);
		if (g->opt.bc_len[0]) trim_bseq_5(&s[0], g->opt.bc_len[0]);
		if (g->opt.bc_len[1]) trim_bseq_5(&s[1], g->opt.bc_len[1]);
	}
	// find end overlaps
	{
		int n_fh, n_rh, n_ch;
		uint64_t fh[2], rh[2], ch[2];
		// reverse the other read
		lt_seq_revcomp(s[1].l_seq, s[1].seq, rseq);
		lt_seq_rev(s[1].l_seq, s[1].qual, rqual);
		// find overlaps
		n_fh = lt_ue_for(s[0].l_seq, &s[0].seq[0], &s[0].qual[0], s[1].l_seq, rseq, rqual, g->opt.max_ovlp_pen, g->opt.min_ovlp_len, 2, fh);
		n_rh = lt_ue_rev(s[0].l_seq, &s[0].seq[0], &s[0].qual[0], s[1].l_seq, rseq, rqual, g->opt.max_ovlp_pen, g->opt.min_ovlp_len, 2, rh);
		n_ch = lt_ue_contained(s[0].l_seq, &s[0].seq[0], &s[0].qual[0], s[1].l_seq, rseq, rqual, g->opt.max_ovlp_pen, 2, ch);
		if (n_fh + n_rh + n_ch > 1) {
			s[0].type = s[1].type = AD_AMBI_MERGE;
		} else if (n_fh + n_rh + n_ch == 0) {
			s[0].type = s[1].type = AD_NO_MERGE;
		} else {
			int x = 0;
			if (n_fh == 1) {
				int l = (uint32_t)fh[0], st = fh[0]>>32;
				s[0].type = s[1].type = AD_PARTIAL_MERGE;
				for (i = 0; i < st; ++i)
					xseq[x] = s[0].seq[i], xqual[x++] = s[0].qual[i];
				for (i = 0; i < l; ++i) {
					int j = st + i, y;
					y = merge_base(g->opt.max_qual, s[0].seq[j], s[0].qual[j], rseq[i], rqual[i]);
					xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
				}
				if (l < s[1].l_seq) {
					for (i = l; i < s[1].l_seq; ++i)
						xseq[x] = rseq[i], xqual[x++] = rqual[i];
				} else {
					for (i = l; i < s[0].l_seq; ++i)
						xseq[x] = s[0].seq[i], xqual[x++] = s[0].qual[i];
				}
			} else if (n_rh == 1) {
				int l = (uint32_t)rh[0], st = rh[0]>>32;
				s[0].type = s[1].type = AD_COMPLETE_MERGE;
				for (i = 0; i < s[0].l_seq - st - l; ++i)
					xseq[x] = s[0].seq[i], xqual[x++] = s[0].qual[i];
				for (i = s[1].l_seq - l; i < s[1].l_seq; ++i) {
					int j = i - s[1].l_seq + (s[0].l_seq - st), y;
					y = merge_base(g->opt.max_qual, s[0].seq[j], s[0].qual[j], rseq[i], rqual[i]);
					xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
				}
			} else {
				int j, st = ch[0]>>32;
				s[0].type = s[1].type = AD_COMPLETE_MERGE;
				for (j = 0; j < s[0].l_seq; ++j) {
					int i = j + st, y;
					y = merge_base(g->opt.max_qual, s[0].seq[j], s[0].qual[j], rseq[i], rqual[i]);
					xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
				}
			}
			xseq[x] = xqual[x] = 0;
			if (x < g->opt.min_seq_len) s[0].type = s[1].type = AD_SHORT_SE;
			free(s[0].seq); free(s[0].qual);
			s[0].seq = strdup(xseq);
			s[0].qual = strdup(xqual);
			s[0].l_seq = x;
			s[1].l_seq = 0;
		}
	}
	if (s->type == AD_NO_MERGE || s->type == AD_AMBI_MERGE) {
		if (s->bc) s[1].bc = strdup(s->bc);
		// trim Illumina PE adapters
		trim_adap(&s[0], lt_adapter1, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
		trim_adap(&s[1], lt_adapter2, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
		if (s[0].l_seq < g->opt.min_seq_len || s[1].l_seq < g->opt.min_seq_len)
			s[0].type = s[1].type = AD_SHORT_PE;
	}
	if (g->opt.trim_len) {
		if (s->type == AD_PARTIAL_MERGE || s->type == AD_COMPLETE_MERGE) {
			s->l_seq -= g->opt.trim_len;
			s->seq[s->l_seq] = s->qual[s->l_seq] = 0;
			trim_bseq_5(s, g->opt.trim_len);
		} else if (s->type == AD_NO_MERGE || s->type == AD_AMBI_MERGE) {
			trim_bseq_5(&s[0], g->opt.trim_len);
			trim_bseq_5(&s[1], g->opt.trim_len);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r13
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl (%rsi), %ecx
andl %eax, %ecx
andl 0x30(%rsi), %eax
cmpl %eax, %ecx
movl %eax, %edx
cmoval %ecx, %edx
movq %rdi, -0x38(%rbp)
addq $0x30, %rsi
movq %rsi, -0x98(%rbp)
addl $0x10, %edx
andl $-0x10, %edx
movq %rsp, %r10
subq %rdx, %r10
movq %r10, %rsp
movq %rsp, %r12
subq %rdx, %r12
movq %r12, %rsp
addl %ecx, %eax
addl $0x10, %eax
andl $-0x10, %eax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x68(%rbp)
movq %rcx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x60(%rbp)
movq %rcx, %rsp
xorl %eax, %eax
xorl %ecx, %ecx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
leaq (%rsi,%r13), %rdx
movl (%r13,%rsi), %esi
movl %esi, %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
testq %r8, %r8
jle 0x38c6
leaq -0x1(%r8), %rdi
movq 0x10(%rdx), %r9
cmpb $0x4e, -0x1(%r9,%r8)
movq %rdi, %r8
je 0x38aa
incl %edi
jmp 0x38c8
xorl %edi, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl $0x80000000, %esi       # imm = 0x80000000
orl %edi, %esi
movl %esi, (%rdx)
movq 0x18(%rdx), %rsi
movb %al, (%rsi,%rdi)
movq 0x10(%rdx), %rsi
movl (%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movb %al, (%rsi,%rdx)
leaq 0x1(%rcx), %rdx
testq %rcx, %rcx
movq %rdx, %rcx
je 0x388f
movq %r10, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq 0x198(%rax), %r15
testq %r15, %r15
movq %r12, -0x30(%rbp)
je 0x3b2a
movl 0x4(%r15), %eax
addl (%r15), %eax
jle 0x3b2a
movl 0x8(%r15), %eax
movl 0xc(%r15), %ecx
addl %ecx, %eax
incl %eax
cltq
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
xorl %ebx, %ebx
movq $0x0, -0x58(%rbp)
movq %r13, -0x70(%rbp)
movq %r15, -0x50(%rbp)
leaq (%rbx,%rbx,2), %rax
shlq $0x4, %rax
movq 0x10(%r13,%rax), %rsi
movslq 0x8(%r15,%rbx,4), %rdx
movq %r14, %rdi
callq 0x2070
movslq 0x8(%r15,%rbx,4), %rax
movb $0x0, (%r14,%rax)
movl (%r15,%rbx,4), %r13d
movl $0x0, %r12d
testl %r13d, %r13d
jle 0x39ba
movq 0x10(%r15,%rbx,8), %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
movq %r14, %rsi
movl $0x3, %edx
leaq -0xe0(%rbp), %rcx
callq 0x2a70
testl %eax, %eax
jne 0x39b6
incq %r12
cmpq %r12, %r13
jne 0x398f
movl %r13d, %r12d
movq -0x50(%rbp), %r15
cmpl %r13d, %r12d
je 0x3c6d
movl %r12d, -0xa0(%rbp,%rbx,4)
leaq 0x1(%rbx), %rax
testq %rbx, %rbx
setne %cl
movq %rcx, -0x58(%rbp)
movq %rax, %rbx
movq -0x70(%rbp), %r13
je 0x3954
movq 0x20(%r15), %rax
movslq -0xa0(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x2070
movslq 0x8(%r15), %rdi
addq %r14, %rdi
movq 0x28(%r15), %rax
movslq -0x9c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq 0xc(%r15), %rdx
callq 0x2070
movslq 0x8(%r15), %rax
movslq 0xc(%r15), %rcx
addq %rax, %rcx
movb $0x0, (%r14,%rcx)
movq %r14, %rdi
callq 0x2270
movq %rax, 0x20(%r13)
movslq 0x8(%r15), %r14
testq %r14, %r14
je 0x3aa9
movq 0x10(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movq 0x18(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movl (%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%r13)
movq 0x18(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%r13), %rax
movl (%r13), %ecx
andq %rbx, %rcx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movq 0x198(%rax), %rax
movslq 0xc(%rax), %r14
testq %r14, %r14
je 0x3c7e
movq 0x40(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl 0x30(%r13), %edx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movq 0x48(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl 0x30(%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movl 0x30(%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, 0x30(%r13)
movq 0x48(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x40(%r13), %rax
movl 0x30(%r13), %ecx
andq %rbx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x3c7e
movq -0x38(%rbp), %rax
movslq 0x20(%rax), %r14
movslq 0x24(%rax), %r15
movl %r15d, %eax
addl %r14d, %eax
jle 0x3c8c
movq %rsp, %r12
movl %eax, %ebx
leaq 0x10(%rbx), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq 0x10(%r13), %rsi
movq %r12, %rdi
movq %rsi, -0x58(%rbp)
movq %r14, %rdx
callq 0x2070
leaq (%r12,%r14), %rdi
movq 0x40(%r13), %rsi
movq %r15, %rdx
callq 0x2070
movb $0x0, (%rbx,%r12)
movq %r12, %rdi
callq 0x2270
movq %rax, 0x20(%r13)
testl %r14d, %r14d
je 0x3bf2
movq -0x58(%rbp), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movq 0x18(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movl (%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%r13)
movq 0x18(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%r13), %rax
movl (%r13), %ecx
andq %rbx, %rcx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movslq 0x24(%rax), %r14
testq %r14, %r14
movq -0x30(%rbp), %r12
je 0x3c8c
movq 0x40(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl 0x30(%r13), %edx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movq 0x48(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl 0x30(%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movl 0x30(%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, 0x30(%r13)
movq 0x48(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x40(%r13), %rax
movl 0x30(%r13), %ecx
andq %rbx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x3c8c
movl $0xb, %eax
movq -0x70(%rbp), %r13
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
movq -0x30(%rbp), %r12
testb $0x1, -0x58(%rbp)
je 0x4642
movl 0x30(%r13), %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movq -0x40(%rbp), %r14
je 0x3cc9
movq 0x40(%r13), %rax
leaq 0x45d9(%rip), %rcx      # 0x8280
movq %rdi, %rdx
movsbq (%rax), %rsi
testq %rsi, %rsi
js 0x3cb9
movb (%rsi,%rcx), %sil
jmp 0x3cbc
movb $0x4e, %sil
movb %sil, -0x1(%r14,%rdx)
incq %rax
decq %rdx
jne 0x3caa
movb $0x0, (%r14,%rdi)
testl %edi, %edi
je 0x3ce7
movq 0x48(%r13), %rax
movl %edi, %ecx
movb (%rax), %dl
movb %dl, -0x1(%r12,%rcx)
incq %rax
decq %rcx
jne 0x3cd8
movb $0x0, (%r12,%rdi)
movl (%r13), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq %rdi, -0x80(%rbp)
movq 0x10(%r13), %r15
movq 0x18(%r13), %rdx
movq %rdx, -0x58(%rbp)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %r11d
movq %r11, -0x48(%rbp)
movl 0x14(%rax), %r10d
movq %r10, -0x50(%rbp)
leaq -0xe0(%rbp), %rax
movl %ebx, %edi
movq %r15, %rsi
movq -0x80(%rbp), %rcx
movq %r14, %r8
movq %r12, %r9
pushq %rax
movl $0x2, %eax
pushq %rax
pushq %r10
pushq %r11
callq 0x2e34
addq $0x20, %rsp
movq %r14, %r8
movq %rax, -0x78(%rbp)
leaq -0x100(%rbp), %rax
movl %ebx, %edi
movq %r15, %rsi
movq -0x58(%rbp), %r14
movq %r14, %rdx
movq -0x80(%rbp), %rcx
movq %r12, %r9
pushq %rax
movl $0x2, %eax
pushq %rax
pushq -0x50(%rbp)
pushq -0x48(%rbp)
callq 0x2f55
addq $0x20, %rsp
movq %rax, -0x88(%rbp)
subq $0x8, %rsp
leaq -0xf0(%rbp), %rax
movq %rbx, -0x90(%rbp)
movl %ebx, %edi
movq %r15, -0x50(%rbp)
movq %r15, %rsi
movq -0x80(%rbp), %r15
movq %r14, %rdx
movl %r15d, %ecx
movq -0x40(%rbp), %r8
movq %r12, %r9
pushq %rax
movl $0x2, %ebx
pushq %rbx
pushq -0x48(%rbp)
callq 0x303b
movq -0x88(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq $0x20, %rsp
addl %esi, %eax
addl %edx, %eax
cmpl %ebx, %eax
jl 0x3ddb
movl $0x1f, %eax
jmp 0x3e31
testl %eax, %eax
je 0x3e2c
cmpl $0x1, %edx
jne 0x3e3e
movq -0xe0(%rbp), %r12
movq %r12, %rbx
shrq $0x20, %rbx
movl $0x16, %eax
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
testl %ebx, %ebx
jle 0x3f9d
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rbx, %rdx
callq 0x2170
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %rbx, %rdx
callq 0x2170
jmp 0x3f9f
movl $0x20, %eax
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
jmp 0x42e3
cmpl $0x1, %esi
jne 0x3eb4
movq -0x100(%rbp), %rdx
movq %rdx, %r12
shrq $0x20, %r12
movl $0x15, %eax
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
addl %edx, %r12d
movq -0x90(%rbp), %rbx
movl %ebx, %eax
subl %r12d, %eax
movl %eax, -0x78(%rbp)
testl %eax, %eax
jle 0x4193
movl %r12d, %r14d
notl %r14d
addl %ebx, %r14d
incq %r14
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rdx, -0x48(%rbp)
movq %r14, %rdx
callq 0x2170
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %r14, %rdx
callq 0x2170
movq -0x48(%rbp), %rdx
subl %r12d, %ebx
jmp 0x4195
movq -0xf0(%rbp), %rax
movl $0x15, %ecx
movl %ecx, 0x34(%r13)
movl %ecx, 0x4(%r13)
movq -0x90(%rbp), %rdx
testl %edx, %edx
movq -0x30(%rbp), %rcx
je 0x4271
movq %r13, -0x70(%rbp)
sarq $0x20, %rax
movl %edx, %edx
movq %rdx, -0x80(%rbp)
addq %rax, -0x40(%rbp)
addq %rax, %rcx
movq %rcx, -0x30(%rbp)
xorl %ebx, %ebx
movq -0x50(%rbp), %rax
movsbq (%rax,%rbx), %r15
movq -0x58(%rbp), %rax
movsbl (%rax,%rbx), %r12d
movq -0x40(%rbp), %rax
movsbq (%rax,%rbx), %r13
movq %rbx, %r14
movq -0x30(%rbp), %rax
movsbl (%rax,%rbx), %ebx
cmpb %r13b, %r15b
jne 0x3f48
movq -0x38(%rbp), %rax
movl 0xc(%rax), %r13d
cmpb %bl, %r12b
cmovgl %r12d, %ebx
addl $-0x21, %ebx
callq 0x2030
shlq $0x2, %r15
addq (%rax), %r15
cmpl %r13d, %ebx
cmovgel %r13d, %ebx
jmp 0x3f68
callq 0x2030
movq (%rax), %rax
cmpb %bl, %r12b
jle 0x3f61
leaq (%rax,%r15,4), %r15
subl %ebx, %r12d
movl %r12d, %ebx
jmp 0x3f68
leaq (%rax,%r13,4), %r15
subl %r12d, %ebx
movl (%r15), %eax
shll $0x8, %ebx
addl $0x2100, %ebx           # imm = 0x2100
orl %eax, %ebx
movq -0x68(%rbp), %rcx
movq %r14, %rdx
movb %al, (%rcx,%r14)
movq -0x60(%rbp), %rax
movb %bh, (%rax,%rdx)
movq %r14, %rbx
incq %rbx
cmpq %rbx, -0x80(%rbp)
jne 0x3ef6
jmp 0x426b
xorl %ebx, %ebx
testl %r12d, %r12d
jle 0x40c3
movq %r13, -0x70(%rbp)
movq %r12, %rcx
sarq $0x20, %rcx
movl %ebx, %ebx
movq %r12, -0xa8(%rbp)
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq %r12, -0x78(%rbp)
movq -0x60(%rbp), %rax
addq %rbx, %rax
movq %rax, -0x88(%rbp)
movq -0x68(%rbp), %rax
movq %rbx, -0x48(%rbp)
addq %rbx, %rax
movq %rax, -0xb8(%rbp)
movq -0x50(%rbp), %rax
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
addq -0x58(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
xorl %ecx, %ecx
movq -0xb0(%rbp), %rax
movsbq (%rax,%rcx), %r12
movq -0xc0(%rbp), %rax
movsbl (%rax,%rcx), %r13d
movq -0x40(%rbp), %rax
movsbq (%rax,%rcx), %r15
movq -0x30(%rbp), %rax
movq %rcx, %r14
movsbl (%rax,%rcx), %ebx
cmpb %r15b, %r12b
jne 0x405a
movq -0x38(%rbp), %rax
movl 0xc(%rax), %r15d
cmpb %bl, %r13b
cmovgl %r13d, %ebx
addl $-0x21, %ebx
callq 0x2030
shlq $0x2, %r12
addq (%rax), %r12
cmpl %r15d, %ebx
cmovgel %r15d, %ebx
jmp 0x407a
callq 0x2030
movq (%rax), %rax
cmpb %bl, %r13b
jle 0x4073
leaq (%rax,%r12,4), %r12
subl %ebx, %r13d
movl %r13d, %ebx
jmp 0x407a
leaq (%rax,%r15,4), %r12
subl %r13d, %ebx
movq %r14, %rcx
movl (%r12), %eax
shll $0x8, %ebx
addl $0x2100, %ebx           # imm = 0x2100
orl %eax, %ebx
movq -0xb8(%rbp), %rdx
movb %al, (%rdx,%r14)
movq -0x88(%rbp), %rax
movb %bh, (%rax,%rcx)
incq %rcx
cmpq %rcx, -0x78(%rbp)
jne 0x4002
movq -0x48(%rbp), %rbx
addl %ecx, %ebx
movq -0x70(%rbp), %r13
movq -0x80(%rbp), %r15
movq -0xa8(%rbp), %r12
cmpl %r12d, %r15d
movq -0x30(%rbp), %r14
jle 0x4121
movl %ebx, %ebx
movq %rbx, -0x48(%rbp)
movq -0x68(%rbp), %rax
leaq (%rax,%rbx), %rdi
movslq %r12d, %rbx
movq -0x40(%rbp), %rsi
addq %rbx, %rsi
notl %r12d
addl %r15d, %r12d
incq %r12
movq %r12, %rdx
callq 0x2170
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq %rbx, %r14
movq %r14, %rsi
movq %r12, %rdx
callq 0x2170
movl %r15d, %eax
subq %rax, %rbx
xorl %eax, %eax
decq %rax
cmpq %rax, %rbx
jne 0x4117
jmp 0x4188
movq -0x90(%rbp), %rcx
cmpl %r12d, %ecx
jle 0x4273
movl %ebx, %ebx
movq -0x68(%rbp), %rax
leaq (%rax,%rbx), %rdi
movq %r12, %r14
movq %rcx, %r12
movq %rbx, %r15
movslq %r14d, %rbx
movq -0x50(%rbp), %rax
leaq (%rax,%rbx), %rsi
notl %r14d
addl %r12d, %r14d
incq %r14
movq %r14, %rdx
callq 0x2170
movq -0x60(%rbp), %rax
movq %r15, -0x48(%rbp)
leaq (%rax,%r15), %rdi
movq -0x58(%rbp), %rsi
addq %rbx, %rsi
movq %r14, %rdx
callq 0x2170
subq %r12, %rbx
xorl %eax, %eax
decq %rax
cmpq %rax, %rbx
jne 0x4180
movq -0x48(%rbp), %rbx
subl %eax, %ebx
jmp 0x4273
xorl %ebx, %ebx
testl %edx, %edx
jle 0x4273
movq %r13, -0x70(%rbp)
movl %r15d, %ecx
movq %rcx, -0x88(%rbp)
subl %edx, %r15d
movslq %r15d, %r12
movl %ebx, %ebx
movl -0x78(%rbp), %eax
movq %rbx, -0x48(%rbp)
movl %eax, -0x78(%rbp)
cltq
movq -0x50(%rbp), %rcx
movsbq (%rcx,%rax), %r13
movq -0x58(%rbp), %rcx
movsbl (%rcx,%rax), %r14d
movq -0x40(%rbp), %rax
movsbq (%rax,%r12), %r15
movq -0x30(%rbp), %rax
movsbl (%rax,%r12), %ebx
cmpb %r15b, %r13b
jne 0x420f
movq -0x38(%rbp), %rax
movl 0xc(%rax), %r15d
cmpb %bl, %r14b
cmovgl %r14d, %ebx
addl $-0x21, %ebx
callq 0x2030
shlq $0x2, %r13
addq (%rax), %r13
cmpl %r15d, %ebx
cmovgel %r15d, %ebx
jmp 0x422f
callq 0x2030
movq (%rax), %rax
cmpb %bl, %r14b
jle 0x4228
leaq (%rax,%r13,4), %r13
subl %ebx, %r14d
movl %r14d, %ebx
jmp 0x422f
leaq (%rax,%r15,4), %r13
subl %r14d, %ebx
movl (%r13), %eax
shll $0x8, %ebx
addl $0x2100, %ebx           # imm = 0x2100
orl %eax, %ebx
movq -0x68(%rbp), %rcx
movq -0x48(%rbp), %rdx
movb %al, (%rcx,%rdx)
movq -0x60(%rbp), %rax
movb %bh, (%rax,%rdx)
movq %rdx, %rbx
incq %rbx
incq %r12
movl -0x78(%rbp), %eax
incl %eax
cmpq -0x88(%rbp), %r12
jl 0x41b6
movq -0x70(%rbp), %r13
jmp 0x4273
xorl %ebx, %ebx
movslq %ebx, %rax
xorl %ecx, %ecx
movq -0x60(%rbp), %rdx
movb %cl, (%rdx,%rax)
movq -0x68(%rbp), %rdx
movb %cl, (%rdx,%rax)
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x429c
movl $0xc, %eax
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
movq -0x50(%rbp), %rdi
callq 0x2050
movq 0x18(%r13), %rdi
callq 0x2050
movq -0x68(%rbp), %rdi
callq 0x2270
movq %rax, 0x10(%r13)
movq -0x60(%rbp), %rdi
callq 0x2270
movq %rax, 0x18(%r13)
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movl $0x80000000, %eax       # imm = 0x80000000
movl (%r13), %ecx
andl %eax, %ecx
orl %ebx, %ecx
movl %ecx, (%r13)
andl %eax, 0x30(%r13)
movl 0x4(%r13), %eax
addl $-0x1f, %eax
cmpl $0x1, %eax
ja 0x44bf
movq 0x20(%r13), %rdi
testq %rdi, %rdi
je 0x4305
callq 0x2270
movq %rax, 0x50(%r13)
movq 0x3e64(%rip), %r12      # 0x8170
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
movq %rcx, -0x40(%rbp)
movl 0x1c(%rax), %r14d
movq %r12, %rdi
callq 0x20d0
movl (%r13), %ebx
movl %ebx, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movl %r15d, %edi
movq %rdx, -0x30(%rbp)
movl %eax, %ecx
movq %r12, %r8
xorl %r9d, %r9d
leaq -0xe0(%rbp), %rax
pushq %rax
pushq $0x4
pushq %r14
pushq -0x40(%rbp)
callq 0x2e34
addq $0x20, %rsp
testl %eax, %eax
jle 0x43ca
decl %eax
movq -0xe0(%rbp,%rax,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
subl %eax, %r15d
cmpl %r14d, %r15d
jle 0x43b2
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %ebx       # imm = 0x80000000
orl %ecx, %ebx
movl %ebx, (%r13)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
xorl %edx, %edx
movq -0x30(%rbp), %rsi
movb %dl, (%rsi,%rax)
movq 0x10(%r13), %rax
movl (%r13), %esi
andq %rcx, %rsi
movb %dl, (%rax,%rsi)
jmp 0x43ca
sarq $0x20, %rcx
movq -0x30(%rbp), %rdi
addq %rcx, %rdi
movslq %r15d, %rdx
movl $0x22, %esi
callq 0x2110
movq 0x3da7(%rip), %r12      # 0x8178
movq -0x38(%rbp), %rax
movl 0x18(%rax), %ecx
movq %rcx, -0x40(%rbp)
movl 0x1c(%rax), %r14d
movq %r12, %rdi
callq 0x20d0
movl 0x30(%r13), %ebx
movl %ebx, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
movl %r15d, %edi
movq %rdx, -0x30(%rbp)
movl %eax, %ecx
movq %r12, %r8
xorl %r9d, %r9d
leaq -0xe0(%rbp), %rax
pushq %rax
pushq $0x4
pushq %r14
pushq -0x40(%rbp)
callq 0x2e34
addq $0x20, %rsp
testl %eax, %eax
jle 0x448f
decl %eax
movq -0xe0(%rbp,%rax,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
subl %eax, %r15d
cmpl %r14d, %r15d
jle 0x4477
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %ebx       # imm = 0x80000000
orl %ecx, %ebx
movl %ebx, 0x30(%r13)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
xorl %edx, %edx
movq -0x30(%rbp), %rsi
movb %dl, (%rsi,%rax)
movq 0x40(%r13), %rax
movl 0x30(%r13), %esi
andq %rcx, %rsi
movb %dl, (%rax,%rsi)
jmp 0x448f
sarq $0x20, %rcx
movq -0x30(%rbp), %rdi
addq %rcx, %rdi
movslq %r15d, %rdx
movl $0x22, %esi
callq 0x2110
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl (%r13), %edx
andl %eax, %edx
movq -0x38(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpl %ecx, %edx
jl 0x44b2
movq -0x98(%rbp), %rdx
andl (%rdx), %eax
cmpl %ecx, %eax
jge 0x44bf
movl $0xd, %eax
movl %eax, 0x34(%r13)
movl %eax, 0x4(%r13)
movq -0x38(%rbp), %rax
movslq 0x28(%rax), %r14
testq %r14, %r14
je 0x4642
movl 0x4(%r13), %eax
leal -0x1f(%rax), %ecx
cmpl $0x2, %ecx
jb 0x4552
addl $-0x15, %eax
cmpl $0x1, %eax
ja 0x4642
leaq 0x10(%r13), %rax
movq %rax, -0x40(%rbp)
leaq 0x18(%r13), %rbx
movl (%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%r13)
movq 0x18(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%r13), %rax
movl (%r13), %ecx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
andq %r8, %rcx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movl 0x28(%rax), %r12d
movq 0x10(%r13), %rdi
movslq %r12d, %r14
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
andq %r8, %rdx
subq %r14, %rdx
callq 0x2200
jmp 0x45ee
movq 0x10(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movq 0x18(%r13), %rdi
leaq (%rdi,%r14), %rsi
movl (%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
movl (%r13), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%r13)
movq 0x18(%r13), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%r13), %rax
movl (%r13), %ecx
andq %rbx, %rcx
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movl 0x28(%rax), %r12d
leaq 0x40(%r13), %rax
movq %rax, -0x40(%rbp)
movq 0x40(%r13), %rdi
movslq %r12d, %r14
leaq (%rdi,%r14), %rsi
movl 0x30(%r13), %edx
andq %rbx, %rdx
subq %r14, %rdx
callq 0x2200
addq $0x48, %r13
movq %r13, %rbx
movq -0x98(%rbp), %r13
movq (%rbx), %rdi
addq %rdi, %r14
movl (%r13), %edx
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
andq %r15, %rdx
movslq %r12d, %r12
subq %r12, %rdx
movq %r14, %rsi
callq 0x2200
movl (%r13), %eax
movl %eax, %ecx
subl %r12d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%r13)
movq (%rbx), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl (%r13), %ecx
andq %r15, %rcx
movb %dl, (%rax,%rcx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq