// File: /workspace/github_c_makefile_star2_O2/lh3[P]pre-pe/pre-lianti.c
// Function: lt_process
void lt_process(const lt_global_t *g, bseq1_t s[2])
{
	int i, k, n_hits[2], mlen;
	lt_sc_hit_t hits[2][MAX_BINDING_HITS];
	char *rseq, *rqual, *xseq, *xqual, *bc;

	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);
	bc = (char*)alloca(mlen + 1);

	// trim heading and 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;
		for (i = 0; i < sk->l_seq; ++i) // trim heading "N"
			if (sk->seq[i] != 'N') break;
		if (i) trim_bseq_5(sk, i);
	}
	// 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);
	// find binding motifs
	for (k = 0; k < 2; ++k)
		n_hits[k] = lt_sc_test(g->sc_bind, s[k].seq, MAX_BINDING_HITS, hits[k]);
	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 = LT_SHORT_SEQ;
	} else if (n_hits[0] + n_hits[1] == 0) {
		s[0].type = s[1].type = LT_NO_BINDING;
	} else if (n_hits[0] == MAX_BINDING_HITS || n_hits[1] == MAX_BINDING_HITS) {
		s[0].type = s[1].type = LT_TOO_MANY_BINDING;
	} else if (n_hits[0] > 0 && n_hits[1] > 0) { // both ends contain the binding motif
		int bpos[2], l_prom[2];
		s[0].dbl_bind = s[1].dbl_bind = 1;
		for (i = 0; i < 2; ++i) {
			bpos[i] = hits[i][n_hits[i] - 1].pos;
			l_prom[i] = lt_ue_rev1(bpos[i], s[i].seq, s[i].qual, g->sc_prom->l, lt_promoter, 0, g->opt.min_bc_len, g->opt.max_bc_pen);
			if (l_prom[i] != bpos[i] && l_prom[i] != g->sc_prom->l)
				l_prom[i] = 0;
			if (l_prom[i] < g->opt.min_bc_len) l_prom[i] = 0;
		}
		if (l_prom[0] == 0 && l_prom[1] == 0) {
			s[0].type = s[1].type = LT_CHIMERA;
		} else {
			int w = l_prom[0] < l_prom[1]? 1 : 0;
			trim_bseq_5(&s[w], bpos[w] + g->sc_bind->l);
			n_hits[w] = 0;
		}
	}
	// find end overlaps
	if ((n_hits[0] == 0 || n_hits[1] == 0) && s[0].type == LT_UNKNOWN) {
		int f, r, fpos, bpos, l_bc_prom;
		lt_sc_hit_t hits_prom;
		f = n_hits[0]? 0 : 1;
		r = f^1;
		bpos = hits[f][n_hits[f] - 1].pos;
		fpos = bpos + g->sc_bind->l;
		// barcode
		l_bc_prom = lt_ue_rev1(bpos, s[f].seq, s[f].qual, g->sc_prom->l, lt_promoter, 0, g->opt.min_bc_len, g->opt.max_bc_pen); // test if "barcode" is actually teh T7 promotor
		if (l_bc_prom >= g->opt.min_bc_len) {
			bc[0] = '*', bc[1] = 0;
		} else if (bpos < g->opt.bc_len) {
			strncpy(bc, s[f].seq, bpos);
			bc[bpos] = 0;
		} else {
			strncpy(bc, s[f].seq + (bpos - g->opt.bc_len), g->opt.bc_len);
			bc[g->opt.bc_len] = 0;
		}
		s[0].bc = strdup(bc);
		s[1].bc = strdup(bc);
		// test merge and promoter sequences
		if (lt_sc_test(g->sc_prom, &s[f].seq[fpos], 1, &hits_prom) > 0) {
			s[0].type = s[1].type = LT_POST_PROMOTER;
		} else {
			int n_fh, n_rh, n_ch;
			uint64_t fh[2], rh[2], ch[2];
			// reverse the other read
			lt_seq_revcomp(s[r].l_seq, s[r].seq, rseq);
			lt_seq_rev(s[r].l_seq, s[r].qual, rqual);
			// find overlaps
			n_fh = lt_ue_for(s[f].l_seq - bpos, &s[f].seq[bpos], &s[f].qual[bpos], s[r].l_seq, rseq, rqual, g->opt.max_ovlp_pen, g->opt.min_ovlp_len, 2, fh);
			n_rh = lt_ue_rev(s[f].l_seq - bpos, &s[f].seq[bpos], &s[f].qual[bpos], s[r].l_seq, rseq, rqual, g->opt.max_ovlp_pen, g->opt.min_ovlp_len, 2, rh);
			n_ch = lt_ue_contained(s[f].l_seq - bpos, &s[f].seq[bpos], &s[f].qual[bpos], s[r].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 = LT_AMBI_MERGE;
			} else if (n_fh + n_rh + n_ch == 0) {
				s[0].type = s[1].type = LT_NO_MERGE;
			} else {
				int x = 0;
				s[0].type = s[1].type = LT_MERGED;
				if (n_fh == 1) {
					/*  GGG19bp------------------->
					                     <--------------- */
					int l = (uint32_t)fh[0], st = fh[0]>>32;
					for (i = fpos; i < bpos + st; ++i)
						xseq[x] = s[f].seq[i], xqual[x++] = s[f].qual[i];
					for (i = fpos < bpos + st? 0 : fpos - (bpos + st); i < l; ++i) {
						int j = bpos + st + i, y;
						y = merge_base(g->opt.max_qual, s[f].seq[j], s[f].qual[j], rseq[i], rqual[i]);
						xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
					}
					if (l < s[r].l_seq) {
						for (i = l; i < s[r].l_seq; ++i)
							xseq[x] = rseq[i], xqual[x++] = rqual[i];
					} else { // FIXME: please check pre-meta.c; this block is probably buggy!!!
						for (i = bpos + l; i < s[f].l_seq; ++i)
							xseq[x] = s[f].seq[i], xqual[x++] = s[f].qual[i];
					}
				} else if (n_rh == 1) {
					/*      GGG19bp--------------------->
					   <--------------------------           */
					int l = (uint32_t)rh[0], st = rh[0]>>32, l2;
					for (i = fpos; i < s[f].l_seq - st - l; ++i)
						xseq[x] = s[f].seq[i], xqual[x++] = s[f].qual[i];
					l2 = fpos < s[f].l_seq - st - l? l : s[f].l_seq - st - fpos;
					for (i = s[r].l_seq - l2; i < s[r].l_seq; ++i) {
						int j = i - s[r].l_seq + (s[f].l_seq - st), y;
						y = merge_base(g->opt.max_qual, s[f].seq[j], s[f].qual[j], rseq[i], rqual[i]);
						xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
					}
				} else if (n_ch == 1) {
					/*    GGG19bp---------------->
					   <-----------------------------    */
					int j, st = ch[0]>>32;
					for (j = fpos; j < s[f].l_seq; ++j) {
						int i = j + st - bpos, y;
						y = merge_base(g->opt.max_qual, s[f].seq[j], s[f].qual[j], rseq[i], rqual[i]);
						xseq[x] = (uint8_t)y, xqual[x++] = y>>8;
					}
				}
				xseq[x] = xqual[x] = 0;
				for (i = 0; i < x; ++i)
					if (xseq[i] == 'N' || xseq[i] == 'n') break;
				if (i != x) s[0].type = s[1].type = LT_AMBI_BASE;
				else if (x < g->opt.min_seq_len) s[0].type = s[1].type = LT_SHORT_MERGE;
				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[0].type == LT_AMBI_MERGE || s[0].type == LT_NO_MERGE) {
			int n_ambi = 0;
			trim_bseq_5(&s[f], fpos);
			for (k = 0; k < 2; ++k) {
				for (i = 0; i < s[k].l_seq; ++i)
					if (s[k].seq[i] == 'N') ++n_ambi;
			}
			if (n_ambi) s[0].type = s[1].type = LT_AMBI_BASE;
			else if (s[f].l_seq < g->opt.min_seq_len || s[r].l_seq < g->opt.min_seq_len)
				s[0].type = s[1].type = LT_SHORT_PE;
			if (f == 1) {
				char *tmp;
				tmp = s[f].seq, s[f].seq = s[r].seq, s[r].seq = tmp;
				tmp = s[f].qual, s[f].qual = s[r].qual, s[r].qual = tmp;
				i = s[f].l_seq, s[f].l_seq = s[r].l_seq, s[r].l_seq = i;
				f = 0, r = 1;
			}
		}
	}
	if (s[0].type == LT_MERGED || s[0].type == LT_NO_MERGE || s[0].type == LT_AMBI_MERGE || s[0].type == LT_NO_BINDING) {
		if (s->type == LT_NO_BINDING) {
			for (i = 0; i < 2; ++i) {
				trim_adap(&s[i], lt_oligo_for, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 0);
				trim_adap(&s[i], lt_bind_rev, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
				trim_adap(&s[i], lt_oligo_rev, 1, g->opt.min_adap_len, g->opt.max_adap_pen, 0);
				trim_adap(&s[i], lt_bind, 1, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
			}
		} else {
			trim_adap(&s[0], lt_oligo_for, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 0);
			trim_adap(&s[0], lt_bind_rev, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
			if (s->type != LT_MERGED) {
				trim_adap(&s[1], lt_bind_rev, 0, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
				trim_adap(&s[1], lt_oligo_rev, 1, g->opt.min_adap_len, g->opt.max_adap_pen, 0);
				trim_adap(&s[1], lt_bind, 1, g->opt.min_adap_len, g->opt.max_adap_pen, 1);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl (%rsi), %edx
andl %ecx, %edx
andl 0x28(%rsi), %ecx
cmpl %ecx, %edx
movl %ecx, %eax
cmoval %edx, %eax
movq %rdi, %r14
addq $0x28, %rsi
movq %rsi, -0xc8(%rbp)
addl $0x10, %eax
andl $-0x10, %eax
movq %rsp, %rsi
subq %rax, %rsi
movq %rsi, -0x78(%rbp)
movq %rsi, %rsp
movq %rsp, %rsi
subq %rax, %rsi
movq %rsi, -0x90(%rbp)
movq %rsi, %rsp
addl %edx, %ecx
addl $0x10, %ecx
andl $-0x10, %ecx
movq %rsp, %rdx
subq %rcx, %rdx
movq %rdx, -0x70(%rbp)
movq %rdx, %rsp
movq %rsp, %rdx
subq %rcx, %rdx
movq %rdx, -0x60(%rbp)
movq %rdx, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
xorl %r15d, %r15d
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
cmpq $0x2, %r13
je 0x36ae
imulq $0x28, %r13, %rax
leaq (%rbx,%rax), %rdi
movl (%rbx,%rax), %eax
movl %eax, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
testq %rdx, %rdx
jle 0x365e
leaq -0x1(%rdx), %rcx
movq 0x10(%rdi), %rsi
cmpb $0x4e, -0x1(%rsi,%rdx)
movq %rcx, %rdx
je 0x363d
incl %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x3660
xorl %ecx, %ecx
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%rdi)
movq 0x18(%rdi), %rax
movl %ecx, %ecx
movb %r15b, (%rax,%rcx)
movq 0x10(%rdi), %rax
movl (%rdi), %ecx
andq %r12, %rcx
movb %r15b, (%rax,%rcx)
movl (%rdi), %esi
andq %r12, %rsi
xorl %eax, %eax
cmpq %rax, %rsi
je 0x369d
movq 0x10(%rdi), %rcx
cmpb $0x4e, (%rcx,%rax)
jne 0x369b
incq %rax
jmp 0x3687
movl %eax, %esi
testl %esi, %esi
je 0x36a6
callq 0x4246
incq %r13
jmp 0x3620
movq 0x3aab(%rip), %rsi      # 0x7160
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %rbx, %r13
xorl %ebx, %ebx
pushq $0x1
popq %r15
movq %r13, %rdi
xorl %edx, %edx
movl %r15d, %r9d
callq 0x42b2
movq 0x3a8e(%rip), %rsi      # 0x7168
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq -0xc8(%rbp), %rdi
xorl %edx, %edx
movl %r15d, %r9d
callq 0x42b2
movq %r14, -0x80(%rbp)
movq 0x30(%r14), %r12
movq %r13, -0x38(%rbp)
leaq 0x10(%r13), %r14
leaq -0x140(%rbp), %r13
pushq $0x3
popq %r15
cmpq $0x2, %rbx
je 0x3739
movq (%r14), %rsi
movq %r12, %rdi
movl %r15d, %edx
movq %r13, %rcx
callq 0x2c1e
movl %eax, -0x88(%rbp,%rbx,4)
incq %rbx
addq $0xc, %r13
addq $0x28, %r14
jmp 0x370e
movq -0x38(%rbp), %rbx
movl (%rbx), %eax
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x80(%rbp), %r14
movl 0x8(%r14), %edx
pushq $0x2
popq %rdi
cmpl %edx, %ecx
jl 0x376f
movq -0xc8(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
cmpl %edx, %esi
jge 0x3861
movl %edi, 0x2c(%rbx)
movl %edi, 0x4(%rbx)
movl -0x88(%rbp), %ecx
testl %ecx, %ecx
je 0x378c
cmpl $0x0, -0x84(%rbp)
jne 0x40e9
cmpl $0x0, 0x4(%rbx)
jne 0x40e9
xorl %eax, %eax
movl %ecx, -0xa8(%rbp)
testl %ecx, %ecx
setne %r15b
sete %al
movslq -0x88(%rbp,%rax,4), %rcx
imulq $0xc, %rax, %rdx
addq %rbp, %rdx
addq $-0x140, %rdx           # imm = 0xFEC0
movl -0x4(%rdx,%rcx,4), %r13d
andl $0x3fffffff, %r13d      # imm = 0x3FFFFFFF
movq 0x30(%r14), %rcx
movl (%rcx), %ecx
movq %rcx, -0xb8(%rbp)
addl %r13d, %ecx
movq %rcx, -0x40(%rbp)
imulq $0x28, %rax, %rax
movq 0x10(%rbx,%rax), %rsi
movq %rax, -0x68(%rbp)
movq 0x18(%rbx,%rax), %rdx
movq 0x38(%r14), %rax
movq %rax, -0x30(%rbp)
movl (%rax), %ecx
movq 0x3958(%rip), %r8       # 0x7158
movl 0x20(%r14), %eax
movl 0x24(%r14), %ebx
movl %r13d, %edi
movq %rsi, -0x58(%rbp)
movq %rdx, -0x48(%rbp)
xorl %r9d, %r9d
pushq %rax
pushq %rbx
callq 0x2f22
addq $0x10, %rsp
cmpl %ebx, %eax
movq %r13, -0xb0(%rbp)
movb %r15b, -0xa0(%rbp)
jge 0x38a1
movslq 0x28(%r14), %r12
cmpl %r12d, %r13d
jge 0x39a1
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq -0x58(%rbp), %r15
movq %r15, %rsi
movq %r13, %rdx
callq 0x2070
movq %rbx, %rdi
movq %r13, %r12
jmp 0x39c3
movl -0x88(%rbp), %esi
movl -0x84(%rbp), %edx
movl %esi, %edi
addl %edx, %edi
jne 0x3880
movl %r15d, 0x2c(%rbx)
movl %r15d, 0x4(%rbx)
jmp 0x3775
cmpl $0x3, %esi
setne %dil
cmpl $0x3, %edx
setne %r8b
testb %r8b, %dil
jne 0x38b9
pushq $0x4
popq %rax
movl %eax, 0x2c(%rbx)
movl %eax, 0x4(%rbx)
jmp 0x3775
movq -0x50(%rbp), %rdi
movb $0x2a, (%rdi)
pushq $0x1
popq %r12
movq -0x38(%rbp), %rbx
movq -0x58(%rbp), %r15
jmp 0x39c7
testl %esi, %esi
setle %sil
testl %edx, %edx
setle %dl
orb %sil, %dl
jne 0x3775
movl $0x80000000, %edx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x28(%rbx)
orl %edx, %eax
movl %eax, (%rbx)
movq 0x38(%r14), %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movq 0x386d(%rip), %rax      # 0x7158
movq %rax, -0x40(%rbp)
movl 0x20(%r14), %eax
movq %rax, -0x68(%rbp)
movl 0x24(%r14), %r10d
leaq 0x18(%rbx), %rcx
leaq -0x144(%rbp), %rdx
xorl %r12d, %r12d
movl -0x48(%rbp), %r15d
cmpq $0x8, %r12
je 0x3c23
movslq -0x88(%rbp,%r12), %rax
movq %rdx, -0x58(%rbp)
movl (%rdx,%rax,4), %r13d
movl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
andl %eax, %r13d
movl %r13d, -0xf0(%rbp,%r12)
movq -0x8(%rcx), %rsi
movq %rcx, -0x30(%rbp)
movq (%rcx), %rdx
movl %r13d, %edi
movl %r15d, %ecx
movq -0x40(%rbp), %r8
xorl %r9d, %r9d
pushq -0x68(%rbp)
movq %r10, %rbx
pushq %r10
callq 0x2f22
popq %rcx
popq %rdx
movl %eax, %ecx
cmpl %r15d, %eax
je 0x3967
xorl %ecx, %ecx
cmpl %r13d, %eax
cmovel %eax, %ecx
movq %rbx, %r10
cmpl %r10d, %ecx
movl $0x0, %eax
jl 0x397c
movl %ecx, %eax
movl %eax, -0xe0(%rbp,%r12)
addq $0x4, %r12
movq -0x30(%rbp), %rcx
addq $0x28, %rcx
movq -0x58(%rbp), %rdx
addq $0xc, %rdx
movq -0x38(%rbp), %rbx
jmp 0x390d
movl %r13d, %eax
subl %r12d, %eax
movslq %eax, %rsi
movq -0x58(%rbp), %r15
addq %r15, %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2070
movq %rbx, %rdi
movq -0x38(%rbp), %rbx
movb $0x0, (%rdi,%r12)
movq %rdi, %r12
callq 0x2240
movq %rax, 0x20(%rbx)
movq %r12, %rdi
callq 0x2240
movq %rax, 0x48(%rbx)
movslq -0x40(%rbp), %r13
addq %r13, %r15
pushq $0x1
popq %r12
leaq -0x10c(%rbp), %rcx
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x2c1e
testl %eax, %eax
jle 0x3a17
pushq $0x5
popq %rax
movl %eax, 0x2c(%rbx)
movl %eax, 0x4(%rbx)
jmp 0x40e9
movq %r15, -0xc0(%rbp)
movq %r13, -0x50(%rbp)
movl %r12d, -0xa4(%rbp)
movq -0x68(%rbp), %r13
addq %rbx, %r13
xorl %eax, %eax
movb -0xa0(%rbp), %cl
movb %cl, %al
movq %rax, -0xf8(%rbp)
imulq $0x28, %rax, %r15
movl (%rbx,%r15), %r12d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %r12
movq 0x10(%rbx,%r15), %rsi
movl %r12d, %edi
movq -0x78(%rbp), %rdx
callq 0x2e26
movq 0x18(%rbx,%r15), %rsi
movl %r12d, %edi
movq -0x90(%rbp), %r14
movq %r14, %rdx
callq 0x2df6
movq %r13, -0x68(%rbp)
movl (%r13), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
movq %rax, -0x98(%rbp)
movl %eax, %r13d
movq -0xb0(%rbp), %rax
subl %eax, %r13d
movl %eax, %r15d
movq -0x58(%rbp), %rax
leaq (%rax,%r15), %rsi
movq %rsi, -0x30(%rbp)
addq -0x48(%rbp), %r15
movq -0x80(%rbp), %rax
movl 0x10(%rax), %r10d
movq %r10, -0x108(%rbp)
movl 0x14(%rax), %r11d
leaq -0xf0(%rbp), %rax
movl %r13d, %edi
movq %r15, %rdx
movl %r12d, %ecx
movq -0x78(%rbp), %rbx
movq %rbx, %r8
movq %r14, %r9
pushq %rax
pushq $0x2
popq %r14
pushq %r14
pushq %r11
movq %r11, %r14
pushq %r10
callq 0x300d
addq $0x20, %rsp
movq %rax, -0xa0(%rbp)
leaq -0xe0(%rbp), %rax
movl %r13d, %edi
movq -0x30(%rbp), %rsi
movq %r15, %rdx
movl %r12d, %ecx
movq %rbx, %r8
movq -0x90(%rbp), %rbx
movq %rbx, %r9
pushq %rax
pushq $0x2
popq %rax
pushq %rax
pushq %r14
movq -0x108(%rbp), %r14
pushq %r14
callq 0x30e9
addq $0x20, %rsp
movq %rax, -0x100(%rbp)
subq $0x8, %rsp
leaq -0x120(%rbp), %rax
movl %r13d, %edi
movq -0x30(%rbp), %rsi
movq %r15, %rdx
movq %r12, -0xd0(%rbp)
movl %r12d, %ecx
movq -0x78(%rbp), %r8
movq %rbx, %r9
pushq %rax
pushq $0x2
popq %rbx
pushq %rbx
pushq %r14
callq 0x31a9
movq -0x100(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq $0x20, %rsp
leal (%rsi,%rdx), %ecx
addl %eax, %ecx
cmpl %ebx, %ecx
jl 0x3ba0
movq -0x38(%rbp), %rbx
movl $0x17, 0x2c(%rbx)
pushq $0x17
popq %rax
movq -0x80(%rbp), %r14
jmp 0x3c7f
testl %ecx, %ecx
movq -0x80(%rbp), %r14
je 0x3c71
pushq $0x15
popq %rcx
movq -0x38(%rbp), %rbx
movl %ecx, 0x2c(%rbx)
movl %ecx, 0x4(%rbx)
cmpl $0x1, %edx
movq -0x40(%rbp), %r12
jne 0x3d54
movq -0xf0(%rbp), %r15
movq %r15, %rax
shrq $0x20, %rax
movq -0xb0(%rbp), %rcx
addl %eax, %ecx
movslq %ecx, %rcx
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %r11
addq %r11, %rdx
xorl %r10d, %r10d
movq -0x70(%rbp), %rdi
movq -0x58(%rbp), %r9
movq -0xc0(%rbp), %rbx
movq -0x60(%rbp), %r8
leaq (%r11,%r10), %rsi
cmpq %rcx, %rsi
jge 0x3dbc
movb (%rbx,%r10), %sil
movb %sil, (%rdi,%r10)
movb (%rdx,%r10), %sil
movb %sil, (%r8,%r10)
incq %r10
jmp 0x3c01
movl -0xe0(%rbp), %eax
movl -0xdc(%rbp), %ecx
movl %eax, %edx
orl %ecx, %edx
jne 0x3c3c
pushq $0x6
jmp 0x3895
xorl %ebx, %ebx
cmpl %ecx, %eax
setl %bl
imulq $0x28, %rbx, %rdi
addq -0x38(%rbp), %rdi
shll $0x2, %ebx
movq 0x30(%r14), %rax
movl (%rax), %esi
addl -0xf0(%rbp,%rbx), %esi
callq 0x4246
andl $0x0, -0x88(%rbp,%rbx)
movq -0x38(%rbp), %rbx
jmp 0x3775
movq -0x38(%rbp), %rbx
movl $0x16, 0x2c(%rbx)
pushq $0x16
popq %rax
movq -0x68(%rbp), %r15
movq -0x40(%rbp), %r12
movl %eax, 0x4(%rbx)
movq %r15, %rdi
movl %r12d, %esi
callq 0x4246
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x2, %rax
je 0x3cd4
imulq $0x28, %rax, %rsi
leaq (%rbx,%rsi), %rdx
movl (%rbx,%rsi), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %edi, %edi
cmpq %rdi, %rsi
je 0x3ccf
movq 0x10(%rdx), %r8
xorl %r9d, %r9d
cmpb $0x4e, (%r8,%rdi)
sete %r9b
addl %r9d, %ecx
incq %rdi
jmp 0x3cb2
incq %rax
jmp 0x3c99
testl %ecx, %ecx
je 0x3ce3
pushq $0x1
popq %rax
movl -0xa8(%rbp), %edi
jmp 0x3d0d
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl (%r15), %esi
andl %ecx, %esi
movl 0x8(%r14), %edx
pushq $0xc
popq %rax
cmpl %edx, %esi
movl -0xa8(%rbp), %edi
jl 0x3d0d
imulq $0x28, -0xf8(%rbp), %rsi
andl (%rbx,%rsi), %ecx
cmpl %edx, %ecx
jge 0x3d13
movl %eax, 0x2c(%rbx)
movl %eax, 0x4(%rbx)
testl %edi, %edi
jne 0x40e9
movups 0x10(%r15), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, 0x10(%rbx)
movl (%r15), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %eax, %edx
andl %ecx, %edx
movl (%rbx), %esi
andl %esi, %ecx
movl $0x80000000, %edi       # imm = 0x80000000
andl %edi, %eax
orl %ecx, %eax
movl %eax, (%r15)
andl %edi, %esi
orl %edx, %esi
movl %esi, (%rbx)
jmp 0x40e9
cmpl $0x1, %esi
movq -0x70(%rbp), %r11
movq -0xc0(%rbp), %r15
jne 0x3ebb
movq -0xe0(%rbp), %rcx
movq %rcx, %rax
shrq $0x20, %rax
movq -0x98(%rbp), %rdx
movl %edx, %esi
subl %eax, %esi
movl %esi, %edx
subl %ecx, %edx
movslq %edx, %rdi
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rbx
addq %rbx, %r8
xorl %r13d, %r13d
movq -0x60(%rbp), %r10
leaq (%rbx,%r13), %r9
cmpq %rdi, %r9
jge 0x3f5f
movb (%r15,%r13), %r9b
movb %r9b, (%r11,%r13)
movb (%r8,%r13), %r9b
movb %r9b, (%r10,%r13)
incq %r13
jmp 0x3d9a
movq %r10, -0x30(%rbp)
xorl %ebx, %ebx
movq -0xb8(%rbp), %rcx
subl %eax, %ecx
cmovll %ebx, %ecx
movslq %ecx, %rcx
movslq %r15d, %r12
cltq
movq -0xb0(%rbp), %r13
addq %rax, %r13
addq %rcx, %r13
leaq (%r9,%r13), %rax
movq %rax, -0x50(%rbp)
addq -0x48(%rbp), %r13
movq -0x78(%rbp), %rax
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
movq %rcx, %r14
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
leaq (%r14,%rbx), %rax
cmpq %r12, %rax
jge 0x3e68
movq -0x80(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x50(%rbp), %rax
movsbl (%rax,%rbx), %esi
movsbl (%r13,%rbx), %edx
movq -0xa0(%rbp), %rax
movsbl (%rax,%rbx), %ecx
movq -0xb8(%rbp), %rax
movsbl (%rax,%rbx), %r8d
callq 0x4418
movq -0x70(%rbp), %rcx
addq %rbx, %rcx
movq -0x30(%rbp), %rdx
movb %al, (%rdx,%rcx)
movq -0x60(%rbp), %rcx
addq %rbx, %rcx
movb %ah, (%rdx,%rcx)
incq %rbx
jmp 0x3e11
movq -0x30(%rbp), %r13
addq %rbx, %r13
movq -0xd0(%rbp), %rdx
cmpl %r15d, %edx
jle 0x3fea
movq -0x80(%rbp), %r14
movq -0x38(%rbp), %rbx
movq -0x70(%rbp), %r11
movq -0x60(%rbp), %rcx
cmpq %rdx, %r12
jge 0x4042
movq -0x78(%rbp), %rax
movb (%rax,%r12), %al
movb %al, (%r11,%r13)
movq -0x90(%rbp), %rax
movb (%rax,%r12), %al
movb %al, (%rcx,%r13)
incq %r13
incq %r12
jmp 0x3e8f
xorl %r13d, %r13d
cmpl $0x1, %eax
movq -0x98(%rbp), %rdx
jne 0x4046
movq %r11, %r12
movq -0xb8(%rbp), %r15
addl -0x11c(%rbp), %r15d
movq -0x50(%rbp), %rax
addq %rax, -0x48(%rbp)
xorl %r13d, %r13d
movq -0x50(%rbp), %rax
addq %r13, %rax
cmpq %rdx, %rax
jge 0x403f
leal (%r15,%r13), %eax
movl 0xc(%r14), %edi
movq %r13, -0x30(%rbp)
movq -0xc0(%rbp), %rcx
movq -0x30(%rbp), %rdx
movsbl (%rcx,%rdx), %esi
movq -0x48(%rbp), %rcx
movq -0x30(%rbp), %rdx
movsbl (%rcx,%rdx), %edx
cltq
movq -0x78(%rbp), %rcx
movsbl (%rcx,%rax), %ecx
movq -0x90(%rbp), %r8
movsbl (%r8,%rax), %r8d
callq 0x4418
movq -0x98(%rbp), %rdx
movq -0x30(%rbp), %rcx
movb %al, (%r12,%rcx)
movq -0x60(%rbp), %rcx
movq -0x30(%rbp), %rsi
movb %ah, (%rcx,%rsi)
movq -0x30(%rbp), %r13
incq %r13
jmp 0x3eea
subl %r12d, %esi
cmpl %edx, %r12d
cmovll %ecx, %esi
movq -0xd0(%rbp), %rdi
movl %edi, %r15d
subl %esi, %edi
movslq %edi, %rbx
cmpl %r12d, %edx
cmovgel %r12d, %edx
movq -0x98(%rbp), %rsi
addl %esi, %r12d
addl %ecx, %eax
addl %edx, %eax
subl %eax, %r12d
cmpq %r15, %rbx
jge 0x4031
movl 0xc(%r14), %edi
movslq %r12d, %r12
movq -0x58(%rbp), %rax
movsbl (%rax,%r12), %esi
movq -0x48(%rbp), %rax
movsbl (%rax,%r12), %edx
movq -0x78(%rbp), %rax
movsbl (%rax,%rbx), %ecx
movq -0x90(%rbp), %rax
movsbl (%rax,%rbx), %r8d
callq 0x4418
movq %r13, %rdx
movq -0x70(%rbp), %rcx
movb %al, (%rcx,%r13)
movq -0x60(%rbp), %rcx
movb %ah, (%rcx,%rdx)
incq %rdx
movq %rdx, %r13
incq %rbx
incl %r12d
jmp 0x3f8f
addl -0xb0(%rbp), %r15d
movq -0x80(%rbp), %r14
movq -0x38(%rbp), %rbx
movq -0x70(%rbp), %r11
movq -0x40(%rbp), %r12
movq -0x98(%rbp), %rdx
movq -0x60(%rbp), %rcx
cmpl %r15d, %edx
jle 0x4046
movq -0x58(%rbp), %rax
movb (%rax,%r15), %al
movb %al, (%r11,%r13)
movq -0x48(%rbp), %rax
movb (%rax,%r15), %al
movb %al, (%rcx,%r13)
incq %r13
incq %r15
jmp 0x400c
movq -0x38(%rbp), %rbx
movq -0x40(%rbp), %r12
movq -0x70(%rbp), %r11
jmp 0x4046
movq %r12, %r11
movq -0x40(%rbp), %r12
movl %r13d, %r15d
movslq %r13d, %rcx
xorl %eax, %eax
movq -0x60(%rbp), %rdx
movb %al, (%rdx,%rcx)
movb %al, (%r11,%rcx)
cmpq %rax, %r15
je 0x4075
movzbl (%r11,%rax), %ecx
orl $0x20, %ecx
cmpl $0x6e, %ecx
je 0x4070
incq %rax
jmp 0x4059
cmpl %eax, %r15d
jne 0x4084
cmpl 0x8(%r14), %r15d
jge 0x4090
pushq $0xb
popq %rax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, 0x2c(%rbx)
movl %eax, 0x4(%rbx)
movq 0x10(%rbx), %rdi
movq %r11, %r13
callq 0x2050
movq 0x18(%rbx), %rdi
callq 0x2050
movq %r13, %rdi
callq 0x2240
movq %rax, 0x10(%rbx)
movq -0x60(%rbp), %rdi
callq 0x2240
movq %rax, 0x18(%rbx)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movl $0x80000000, %eax       # imm = 0x80000000
movl (%rbx), %ecx
andl %eax, %ecx
orl %r15d, %ecx
movl %ecx, (%rbx)
andl %eax, 0x28(%rbx)
movl 0x4(%rbx), %eax
andl $-0x2, %eax
cmpl $0x16, %eax
movq -0x68(%rbp), %r15
je 0x3c8a
movl 0x4(%rbx), %eax
leal -0x15(%rax), %ecx
cmpl $0x3, %ecx
jae 0x41a2
movq 0x3071(%rip), %rsi      # 0x7170
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %rbx, %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x42b2
movq 0x3065(%rip), %rsi      # 0x7180
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
pushq $0x1
popq %r9
movq %rbx, %rdi
xorl %edx, %edx
callq 0x42b2
cmpl $0x15, 0x4(%rbx)
je 0x4237
movq 0x303e(%rip), %rsi      # 0x7180
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %r14, %rbx
pushq $0x1
popq %r14
movq -0xc8(%rbp), %r15
movq %r15, %rdi
xorl %edx, %edx
movl %r14d, %r9d
callq 0x42b2
movq 0x300c(%rip), %rsi      # 0x7178
movl 0x18(%rbx), %r8d
movl 0x1c(%rbx), %ecx
movq %r15, %rdi
movl %r14d, %edx
xorl %r9d, %r9d
callq 0x42b2
movq 0x2fc8(%rip), %rsi      # 0x7150
movl 0x18(%rbx), %r8d
movl 0x1c(%rbx), %ecx
movq %r15, %rdi
movl %r14d, %edx
movl %r14d, %r9d
callq 0x42b2
jmp 0x4237
cmpl $0x3, %eax
jne 0x4237
xorl %r13d, %r13d
pushq $0x1
popq %r15
cmpq $0x50, %r13
je 0x4237
leaq (%rbx,%r13), %r12
movq 0x2fad(%rip), %rsi      # 0x7170
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %r12, %rdi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x42b2
movq 0x2fa1(%rip), %rsi      # 0x7180
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %r12, %rdi
xorl %edx, %edx
movl %r15d, %r9d
callq 0x42b2
movq 0x2f7d(%rip), %rsi      # 0x7178
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %r12, %rdi
movl %r15d, %edx
xorl %r9d, %r9d
callq 0x42b2
movq 0x2f38(%rip), %rsi      # 0x7150
movl 0x18(%r14), %r8d
movl 0x1c(%r14), %ecx
movq %r12, %rdi
movl %r15d, %edx
movl %r15d, %r9d
callq 0x42b2
addq $0x28, %r13
jmp 0x41b2
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq