// File: /workspace/github_c_makefile_star2_O3/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 $0xb8, %rsp
movq %rsi, %rbx
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, %r13
addl $0x10, %edx
andl $-0x10, %edx
movq %rsp, %r8
subq %rdx, %r8
movq %r8, %rsp
movq %rsp, %r15
subq %rdx, %r15
movq %r15, %rsp
addl %ecx, %eax
addl $0x10, %eax
andl $-0x10, %eax
movq %rsp, %r9
subq %rax, %r9
movq %r9, %rsp
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %rcx, %rsp
movb $0x1, %al
xorl %ecx, %ecx
leaq (%rcx,%rcx,2), %rdx
shlq $0x4, %rdx
leaq (%rbx,%rdx), %rcx
movl (%rbx,%rdx), %edx
movl %edx, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
testq %rdi, %rdi
jle 0x3a7a
leaq -0x1(%rdi), %rsi
movq 0x10(%rcx), %r10
cmpb $0x4e, -0x1(%r10,%rdi)
movq %rsi, %rdi
je 0x3a58
incl %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jmp 0x3a7c
xorl %esi, %esi
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, (%rcx)
movq 0x18(%rcx), %rdx
movl %esi, %esi
xorl %edi, %edi
movb %dil, (%rdx,%rsi)
movq 0x10(%rcx), %rdx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movb %dil, (%rdx,%rcx)
movl $0x1, %ecx
testb $0x1, %al
movl $0x0, %eax
jne 0x3a41
movq %r9, -0x78(%rbp)
movq 0x198(%r13), %r12
testq %r12, %r12
movq %rbx, -0x30(%rbp)
movq %r13, -0x60(%rbp)
movq %r8, -0x40(%rbp)
movq %r15, -0x70(%rbp)
je 0x3ca7
movl 0x4(%r12), %eax
addl (%r12), %eax
jle 0x3ca7
movl 0x8(%r12), %eax
movl 0xc(%r12), %ecx
addl %ecx, %eax
incl %eax
cltq
addq $0xf, %rax
andq $-0x10, %rax
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
leaq -0x90(%rbp), %rcx
movb $0x1, %al
xorl %r13d, %r13d
leaq -0xc0(%rbp), %r15
movq %r12, -0x50(%rbp)
movq %rcx, -0x48(%rbp)
movl %eax, -0x38(%rbp)
leaq (,%r13,2), %rax
addq %r13, %rax
shlq $0x4, %rax
movq 0x10(%rbx,%rax), %rsi
movslq 0x8(%r12,%r13,4), %rdx
movq %r14, %rdi
callq 0x2070
movslq 0x8(%r12,%r13,4), %rax
movb $0x0, (%r14,%rax)
movslq (%r12,%r13,4), %r12
movl $0x0, %ebx
testq %r12, %r12
jle 0x3b8c
movq -0x50(%rbp), %rax
movq 0x10(%rax,%r13,8), %r13
xorl %ebx, %ebx
movq (%r13,%rbx,8), %rdi
movq %r14, %rsi
movl $0x3, %edx
movq %r15, %rcx
callq 0x2c65
testl %eax, %eax
jne 0x3b8c
incq %rbx
cmpq %rbx, %r12
jne 0x3b66
jmp 0x3e62
cmpl %r12d, %ebx
je 0x3e62
movq -0x48(%rbp), %rax
movl %ebx, (%rax)
movl $0x1, %r13d
leaq -0x8c(%rbp), %rcx
testb $0x1, -0x38(%rbp)
movl $0x0, %eax
movq -0x30(%rbp), %rbx
movq -0x50(%rbp), %r12
jne 0x3b1b
movq 0x20(%r12), %rax
movslq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x2070
movslq 0x8(%r12), %rdi
addq %r14, %rdi
movq 0x28(%r12), %rax
movslq -0x8c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq 0xc(%r12), %rdx
callq 0x2070
movslq 0x8(%r12), %rax
movslq 0xc(%r12), %rcx
addq %rax, %rcx
movb $0x0, (%r14,%rcx)
movq %r14, %rdi
callq 0x2260
movq %rax, 0x20(%rbx)
movslq 0x8(%r12), %r15
testq %r15, %r15
movq -0x60(%rbp), %r13
je 0x3c8c
movq 0x10(%rbx), %rdi
leaq (%rdi,%r15), %rsi
movl (%rbx), %edx
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rdx
subq %r15, %rdx
callq 0x21f0
movq 0x18(%rbx), %rdi
leaq (%rdi,%r15), %rsi
movl (%rbx), %edx
andq %r14, %rdx
subq %r15, %rdx
callq 0x21f0
movl (%rbx), %eax
movl %eax, %ecx
subl %r15d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%rbx)
movq 0x18(%rbx), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%rbx), %rax
movl (%rbx), %ecx
andq %r14, %rcx
movb %dl, (%rax,%rcx)
movq 0x198(%r13), %r12
movl 0xc(%r12), %r12d
testl %r12d, %r12d
movq -0x70(%rbp), %r15
movq -0x40(%rbp), %r8
jne 0x3d8d
jmp 0x3e07
movslq 0x20(%r13), %r14
movl 0x24(%r13), %r12d
movl %r12d, %eax
addl %r14d, %eax
jle 0x3e07
movslq %r12d, %rcx
movq %rcx, -0x38(%rbp)
movq %rsp, %r15
movl %eax, %ebx
leaq 0x10(%rbx), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
movq %rsi, %r13
movq %r14, %rdx
callq 0x2070
leaq (%r15,%r14), %rdi
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x2070
movb $0x0, (%rbx,%r15)
movq -0x30(%rbp), %rbx
movq %r15, %rdi
callq 0x2260
movq %rax, 0x20(%rbx)
testl %r14d, %r14d
je 0x3d7c
leaq (%r14,%r13), %rsi
movl (%rbx), %edx
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
andq %r15, %rdx
subq %r14, %rdx
movq %r13, %rdi
callq 0x21f0
movq 0x18(%rbx), %rdi
leaq (%rdi,%r14), %rsi
movl (%rbx), %edx
andq %r15, %rdx
subq %r14, %rdx
callq 0x21f0
movl (%rbx), %eax
movl %eax, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, (%rbx)
movq 0x18(%rbx), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x10(%rbx), %rax
movl (%rbx), %ecx
andq %r15, %rcx
movb %dl, (%rax,%rcx)
movq -0x60(%rbp), %rax
movl 0x24(%rax), %r12d
testl %r12d, %r12d
movq -0x70(%rbp), %r15
movq -0x40(%rbp), %r8
movq -0x60(%rbp), %r13
je 0x3e07
movq 0x40(%rbx), %rdi
movslq %r12d, %rbx
leaq (%rdi,%rbx), %rsi
movq -0x30(%rbp), %rax
movl 0x30(%rax), %edx
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rdx
subq %rbx, %rdx
callq 0x21f0
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rdi
leaq (%rdi,%rbx), %rsi
movq -0x30(%rbp), %rax
movl 0x30(%rax), %edx
andq %r14, %rdx
subq %rbx, %rdx
callq 0x21f0
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, %ecx
subl %ebx, %ecx
movq -0x30(%rbp), %rbx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ecx, %eax
movl %eax, 0x30(%rbx)
movq 0x48(%rbx), %rax
xorl %edx, %edx
movb %dl, (%rax,%rcx)
movq 0x40(%rbx), %rax
movl 0x30(%rbx), %ecx
andq %r14, %rcx
movb %dl, (%rax,%rcx)
movl 0x30(%rbx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0x3e76
movq 0x40(%rbx), %rax
leaq 0x4453(%rip), %rdi      # 0x8270
movq %rcx, %rdx
movsbq (%rax), %rsi
testq %rsi, %rsi
js 0x3e2f
movb (%rsi,%rdi), %sil
jmp 0x3e32
movb $0x4e, %sil
movb %sil, -0x1(%r8,%rdx)
incq %rax
decq %rdx
jne 0x3e20
movb $0x0, (%r8,%rcx)
movq 0x48(%rbx), %rax
movq %rcx, %rsi
movb (%rax), %dl
movb %dl, -0x1(%r15,%rsi)
incq %rax
decq %rsi
jne 0x3e4b
movq %r13, %rdx
movq %rcx, %rax
jmp 0x3e7f
movl $0xb, %eax
movq -0x30(%rbp), %rcx
movl %eax, 0x34(%rcx)
movl %eax, 0x4(%rcx)
jmp 0x4336
movq %r13, %rdx
movb $0x0, (%r8)
xorl %eax, %eax
movb $0x0, (%r15,%rax)
movl (%rbx), %r12d
movq %r12, -0x98(%rbp)
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x10(%rbx), %rsi
movq %rsi, -0x38(%rbp)
movq 0x18(%rbx), %r13
movl 0x10(%rdx), %r10d
movq %r10, -0x50(%rbp)
movl 0x14(%rdx), %ebx
movq %rbx, -0x48(%rbp)
leaq -0xc0(%rbp), %rax
movl $0x2, %r11d
movl %r12d, %edi
movq %r13, %rdx
movq %r15, %r9
pushq %rax
pushq %r11
pushq %rbx
pushq %r10
movq %r8, %r14
movq %rcx, %rbx
callq 0x3035
addq $0x20, %rsp
movq %rax, -0x80(%rbp)
leaq -0xe0(%rbp), %rax
movl %r12d, %edi
movq -0x38(%rbp), %rsi
movq %r13, %rdx
movl %ebx, %ecx
movq %r14, %r8
movq %r15, %r9
pushq %rax
movl $0x2, %eax
pushq %rax
pushq -0x48(%rbp)
pushq -0x50(%rbp)
callq 0x3128
addq $0x20, %rsp
movq %r15, %r9
movl %eax, %r15d
subq $0x8, %rsp
leaq -0xd0(%rbp), %rax
movq %r12, -0x88(%rbp)
movl %r12d, %edi
movq -0x38(%rbp), %rsi
movq %r13, -0x48(%rbp)
movq %r13, %rdx
movq %rbx, -0x68(%rbp)
movl %ebx, %ecx
movq %r14, %r8
pushq %rax
movl $0x2, %eax
pushq %rax
pushq -0x50(%rbp)
callq 0x31f4
movq -0x80(%rbp), %rdx
addq $0x20, %rsp
addl %r15d, %eax
addl %edx, %eax
movl $0x1f, %ecx
cmpl $0x1, %eax
jg 0x3fcd
testl %eax, %eax
je 0x3fc8
cmpl $0x1, %edx
jne 0x4345
movq -0xc0(%rbp), %rcx
movq %rcx, %r14
shrq $0x20, %r14
movl $0x16, %eax
movq -0x30(%rbp), %rbx
movl %eax, 0x34(%rbx)
movl %eax, 0x4(%rbx)
testl %r14d, %r14d
movq -0x60(%rbp), %r13
movq -0x78(%rbp), %r12
jle 0x4480
movq %r12, %rdi
movq -0x38(%rbp), %rsi
movq %rcx, %r15
movq %r14, %rdx
callq 0x2160
movq -0x58(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0x2160
movq %r15, %rcx
jmp 0x4483
movl $0x20, %ecx
movq -0x30(%rbp), %rbx
movl %ecx, 0x34(%rbx)
leaq 0x4(%rbx), %rdx
movl %ecx, 0x4(%rbx)
movq -0x60(%rbp), %r13
movq -0x98(%rbp), %r12
movq %rdx, -0x40(%rbp)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x3ffc
callq 0x2260
movq %rax, 0x50(%rbx)
movq 0x415d(%rip), %r15      # 0x8160
movl 0x18(%r13), %ebx
movl 0x1c(%r13), %r13d
movq %r15, %rdi
callq 0x20d0
movl %r12d, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl %r14d, %edi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movl %eax, %ecx
movq %r15, %r8
xorl %r9d, %r9d
leaq -0xc0(%rbp), %rax
pushq %rax
pushq $0x4
pushq %r13
pushq %rbx
callq 0x3035
addq $0x20, %rsp
testl %eax, %eax
jle 0x40b3
decl %eax
movq -0xc0(%rbp,%rax,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
subl %eax, %r14d
cmpl %r13d, %r14d
jle 0x409b
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %r12d      # imm = 0x80000000
orl %ecx, %r12d
movq -0x30(%rbp), %rsi
movl %r12d, (%rsi)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
xorl %edx, %edx
movq -0x48(%rbp), %rdi
movb %dl, (%rdi,%rax)
movq 0x10(%rsi), %rax
movl (%rsi), %esi
andq %rcx, %rsi
movb %dl, (%rax,%rsi)
jmp 0x40b3
sarq $0x20, %rcx
movq -0x48(%rbp), %rdi
addq %rcx, %rdi
movslq %r14d, %rdx
movl $0x22, %esi
callq 0x2110
movq 0x40ae(%rip), %r12      # 0x8168
movq -0x60(%rbp), %rax
movl 0x18(%rax), %ecx
movq %rcx, -0x38(%rbp)
movl 0x1c(%rax), %ebx
movq %r12, %rdi
callq 0x20d0
movq -0x30(%rbp), %r10
movl 0x30(%r10), %r13d
movl %r13d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq 0x40(%r10), %rsi
movq 0x48(%r10), %r14
movl %r15d, %edi
movq %r14, %rdx
movl %eax, %ecx
movq %r12, %r8
movq %rbx, %r12
xorl %r9d, %r9d
leaq -0xc0(%rbp), %rax
pushq %rax
pushq $0x4
pushq %rbx
pushq -0x38(%rbp)
movq %r10, %rbx
callq 0x3035
addq $0x20, %rsp
testl %eax, %eax
jle 0x417c
decl %eax
movq -0xc0(%rbp,%rax,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
subl %eax, %r15d
cmpl %r12d, %r15d
jle 0x4165
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %r13d      # imm = 0x80000000
orl %ecx, %r13d
movl %r13d, 0x30(%rbx)
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andq %rcx, %rax
xorl %edx, %edx
movb %dl, (%r14,%rax)
movq 0x40(%rbx), %rax
movl 0x30(%rbx), %esi
andq %rcx, %rsi
movb %dl, (%rax,%rsi)
jmp 0x417c
sarq $0x20, %rcx
addq %rcx, %r14
movslq %r15d, %rdx
movq %r14, %rdi
movl $0x22, %esi
callq 0x2110
movl (%rbx), %r12d
movl %r12d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x60(%rbp), %r13
movl 0x8(%r13), %eax
cmpl %eax, %ecx
jl 0x41a0
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl 0x30(%rbx), %ecx
cmpl %eax, %ecx
jge 0x41ab
movl $0xd, %eax
movl %eax, 0x34(%rbx)
movl %eax, 0x4(%rbx)
movslq 0x28(%r13), %r14
testq %r14, %r14
je 0x4336
movq -0x40(%rbp), %rax
movl (%rax), %eax
leal -0x1f(%rax), %ecx
cmpl $0x2, %ecx
jb 0x4270
addl $-0x15, %eax
cmpl $0x1, %eax
ja 0x4336
movl %r12d, %eax
subl %r14d, %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movq %r13, %rdx
movl $0x80000000, %r13d      # imm = 0x80000000
andl %r13d, %r12d
orl %eax, %r12d
movl %r12d, (%rbx)
movq 0x18(%rbx), %rcx
xorl %r14d, %r14d
movb %r14b, (%rcx,%rax)
movq 0x10(%rbx), %rax
movl (%rbx), %ecx
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
andq %r12, %rcx
movb %r14b, (%rax,%rcx)
movslq 0x28(%rdx), %r15
movq 0x10(%rbx), %rdi
leaq (%rdi,%r15), %rsi
movl (%rbx), %edx
andq %r12, %rdx
subq %r15, %rdx
callq 0x21f0
movq 0x18(%rbx), %rdi
leaq (%rdi,%r15), %rsi
movl (%rbx), %edx
andq %r12, %rdx
subq %r15, %rdx
callq 0x21f0
movl (%rbx), %eax
movl %eax, %ecx
subl %r15d, %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
andl %r13d, %eax
orl %ecx, %eax
movl %eax, (%rbx)
movq 0x18(%rbx), %rax
movb %r14b, (%rax,%rcx)
movq 0x10(%rbx), %rax
movl (%rbx), %ecx
andq %r12, %rcx
movb %r14b, (%rax,%rcx)
jmp 0x4336
movq 0x10(%rbx), %rdi
leaq (%rdi,%r14), %rsi
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r12d
subl %r14d, %r12d
movslq %r12d, %rdx
callq 0x21f0
movq 0x18(%rbx), %rdi
leaq (%rdi,%r14), %rsi
movl (%rbx), %edx
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
andq %r15, %rdx
subq %r14, %rdx
callq 0x21f0
movl (%rbx), %eax
movl %eax, %ecx
subl %r14d, %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
movl $0x80000000, %r14d      # imm = 0x80000000
andl %r14d, %eax
orl %ecx, %eax
movl %eax, (%rbx)
movq 0x18(%rbx), %rax
xorl %r12d, %r12d
movb %r12b, (%rax,%rcx)
movq 0x10(%rbx), %rax
movl (%rbx), %ecx
andq %r15, %rcx
movb %r12b, (%rax,%rcx)
movslq 0x28(%r13), %r13
movq 0x40(%rbx), %rdi
leaq (%rdi,%r13), %rsi
movl 0x30(%rbx), %edx
andq %r15, %rdx
subq %r13, %rdx
callq 0x21f0
movq 0x48(%rbx), %rdi
leaq (%rdi,%r13), %rsi
movl 0x30(%rbx), %edx
andq %r15, %rdx
subq %r13, %rdx
callq 0x21f0
movl 0x30(%rbx), %eax
movl %eax, %ecx
subl %r13d, %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
andl %r14d, %eax
orl %ecx, %eax
movl %eax, 0x30(%rbx)
movq 0x48(%rbx), %rax
movb %r12b, (%rax,%rcx)
movq 0x40(%rbx), %rax
movl 0x30(%rbx), %ecx
andq %r15, %rcx
movb %r12b, (%rax,%rcx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, %r15d
movq -0x60(%rbp), %r13
movq -0x88(%rbp), %rdx
jne 0x43b6
movq -0xe0(%rbp), %r12
movq %r12, %r14
shrq $0x20, %r14
movl $0x15, %eax
movq -0x30(%rbp), %rbx
movl %eax, 0x34(%rbx)
movl %eax, 0x4(%rbx)
addl %r12d, %r14d
movl %edx, %r15d
subl %r14d, %r15d
testl %r15d, %r15d
jle 0x46e7
notl %r14d
addl %edx, %r14d
incq %r14
movq -0x78(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0x2160
movq -0x58(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
callq 0x2160
movl %r14d, %esi
jmp 0x46e9
movq -0xd0(%rbp), %rbx
movl $0x15, %eax
movq -0x30(%rbp), %rcx
movl %eax, 0x34(%rcx)
movl %eax, 0x4(%rcx)
testl %edx, %edx
movq -0x78(%rbp), %r12
je 0x47a8
movq %rdx, %r14
callq 0x2030
movq (%rax), %rsi
sarq $0x20, %rbx
movl %r14d, %ecx
movq -0x40(%rbp), %r11
addq %rbx, %r11
movq -0x70(%rbp), %r10
addq %rbx, %r10
xorl %edx, %edx
movq -0x30(%rbp), %rbx
movq -0x38(%rbp), %rax
movsbq (%rax,%rdx), %rdi
movq -0x48(%rbp), %rax
movzbl (%rax,%rdx), %eax
movsbq (%r11,%rdx), %r9
movzbl (%r10,%rdx), %r8d
cmpb %r9b, %dil
jne 0x443d
movl 0xc(%r13), %r9d
cmpb %r8b, %al
cmovgl %eax, %r8d
movsbl %r8b, %eax
addl $-0x21, %eax
leaq (%rsi,%rdi,4), %rdi
cmpl %r9d, %eax
cmovgel %r9d, %eax
jmp 0x4455
cmpb %r8b, %al
jle 0x444b
leaq (%rsi,%rdi,4), %rdi
subl %r8d, %eax
jmp 0x4455
leaq (%rsi,%r9,4), %rdi
subl %eax, %r8d
movl %r8d, %eax
movl (%rdi), %edi
shll $0x8, %eax
addl $0x2100, %eax           # imm = 0x2100
orl %edi, %eax
movb %dil, (%r12,%rdx)
movq -0x58(%rbp), %rdi
movb %ah, (%rdi,%rdx)
incq %rdx
cmpq %rdx, %rcx
jne 0x43fe
movq -0x88(%rbp), %rsi
jmp 0x47b3
xorl %r14d, %r14d
movq -0x70(%rbp), %r15
movq -0x40(%rbp), %rsi
movq -0x68(%rbp), %rax
testl %ecx, %ecx
jle 0x4556
movq %rcx, %rbx
callq 0x2030
movq (%rax), %r10
movq %rbx, %rcx
sarq $0x20, %rcx
movl %r14d, %r14d
movq %rbx, -0x80(%rbp)
movl %ebx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
leaq (%rax,%r14), %rsi
movq %r14, -0x50(%rbp)
leaq (%r12,%r14), %r8
movq -0x38(%rbp), %rax
leaq (%rax,%rcx), %r9
addq -0x48(%rbp), %rcx
xorl %edi, %edi
movsbq (%r9,%rdi), %r11
movzbl (%rcx,%rdi), %eax
movq -0x40(%rbp), %rbx
movsbq (%rbx,%rdi), %r14
movzbl (%r15,%rdi), %ebx
cmpb %r14b, %r11b
jne 0x450e
movl 0xc(%r13), %r14d
cmpb %bl, %al
cmovgl %eax, %ebx
movsbl %bl, %eax
addl $-0x21, %eax
leaq (%r10,%r11,4), %r11
cmpl %r14d, %eax
cmovgel %r14d, %eax
jmp 0x4522
cmpb %bl, %al
jle 0x451a
leaq (%r10,%r11,4), %r11
subl %ebx, %eax
jmp 0x4522
leaq (%r10,%r14,4), %r11
subl %eax, %ebx
movl %ebx, %eax
movl (%r11), %r11d
shll $0x8, %eax
addl $0x2100, %eax           # imm = 0x2100
orl %r11d, %eax
movb %r11b, (%r8,%rdi)
movb %ah, (%rsi,%rdi)
incq %rdi
cmpq %rdi, %rdx
jne 0x44d6
movq -0x50(%rbp), %r14
addl %edi, %r14d
movq -0x30(%rbp), %rbx
movq -0x40(%rbp), %rsi
movq -0x68(%rbp), %rax
movq -0x80(%rbp), %rcx
cmpl %ecx, %eax
jle 0x45e4
movq %r14, -0x50(%rbp)
movl %r14d, %r14d
leaq (%r12,%r14), %rdi
movslq %ecx, %rdx
movq %rdx, -0x40(%rbp)
addq %rdx, %rsi
notl %ecx
addl %eax, %ecx
incq %rcx
movq %rcx, %rbx
movq %rcx, %rdx
callq 0x2160
addq -0x58(%rbp), %r14
addq -0x40(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2160
movl -0x68(%rbp), %ecx
subq -0x40(%rbp), %rcx
leaq 0x1(%rcx), %rax
andq $-0x2, %rax
decq %rcx
movd -0x50(%rbp), %xmm0
movq %rcx, %xmm1
pshufd $0x44, %xmm1, %xmm2     # xmm2 = xmm1[0,1,0,1]
movl $0x2, %ecx
pcmpeqd %xmm3, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm3, %xmm0
leaq (%rax,%rcx), %rdx
addq $-0x2, %rdx
addq $-0x2, %rcx
cmpq $0x2, %rdx
jne 0x45c5
jmp 0x4675
movq -0x88(%rbp), %r15
cmpl %ecx, %r15d
jle 0x46df
movq %r14, -0x50(%rbp)
movl %r14d, %r14d
leaq (%r12,%r14), %rdi
movslq %ecx, %rbx
movq -0x38(%rbp), %rax
leaq (%rax,%rbx), %rsi
notl %ecx
addl %r15d, %ecx
incq %rcx
movq %rcx, %rdx
movq %rcx, -0x80(%rbp)
callq 0x2160
addq -0x58(%rbp), %r14
movq -0x48(%rbp), %rsi
addq %rbx, %rsi
movq %r14, %rdi
movq -0x80(%rbp), %rdx
callq 0x2160
subq %rbx, %r15
leaq 0x1(%r15), %rax
andq $-0x2, %rax
decq %r15
movd -0x50(%rbp), %xmm0
movq %r15, %xmm1
pshufd $0x44, %xmm1, %xmm2     # xmm2 = xmm1[0,1,0,1]
movl $0x2, %ecx
pcmpeqd %xmm3, %xmm3
movdqa %xmm0, %xmm1
psubq %xmm3, %xmm0
leaq (%rax,%rcx), %rdx
addq $-0x2, %rdx
addq $-0x2, %rcx
cmpq $0x2, %rdx
jne 0x465b
negq %rcx
movq %rcx, %xmm3
pshufd $0x44, %xmm3, %xmm3     # xmm3 = xmm3[0,1,0,1]
por 0x19b6(%rip), %xmm3     # 0x6040
movdqa 0x19be(%rip), %xmm4     # 0x6050
pxor %xmm4, %xmm2
pxor %xmm4, %xmm3
movdqa %xmm3, %xmm4
pcmpgtd %xmm2, %xmm4
pshufd $0xa0, %xmm4, %xmm5     # xmm5 = xmm4[0,0,2,2]
pcmpeqd %xmm2, %xmm3
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
pand %xmm5, %xmm2
pshufd $0xf5, %xmm4, %xmm3     # xmm3 = xmm4[1,1,3,3]
por %xmm2, %xmm3
pand %xmm3, %xmm1
pandn %xmm0, %xmm3
por %xmm1, %xmm3
pshufd $0xee, %xmm3, %xmm0     # xmm0 = xmm3[2,3,2,3]
paddq %xmm3, %xmm0
movd %xmm0, %esi
movq -0x30(%rbp), %rbx
jmp 0x47b3
movl %r14d, %esi
jmp 0x47b3
xorl %esi, %esi
testl %r12d, %r12d
jle 0x47af
movq -0x68(%rbp), %rax
movl %eax, %ebx
subl %r12d, %ebx
movq %rsi, %r12
callq 0x2030
movq (%rax), %r14
movslq %ebx, %rcx
movq -0x30(%rbp), %rbx
movl -0x68(%rbp), %edx
movl %r12d, %r12d
movq %r12, %rsi
movq -0x78(%rbp), %r12
movq -0x40(%rbp), %r10
movslq %r15d, %rax
movq -0x38(%rbp), %rdi
movsbq (%rdi,%rax), %rdi
movq -0x48(%rbp), %r8
movzbl (%r8,%rax), %eax
movsbq (%r10,%rcx), %r9
movq -0x70(%rbp), %r8
movzbl (%r8,%rcx), %r8d
cmpb %r9b, %dil
jne 0x4765
movl 0xc(%r13), %r9d
cmpb %r8b, %al
cmovgl %eax, %r8d
movsbl %r8b, %eax
addl $-0x21, %eax
leaq (%r14,%rdi,4), %rdi
cmpl %r9d, %eax
cmovgel %r9d, %eax
jmp 0x477d
cmpb %r8b, %al
jle 0x4773
leaq (%r14,%rdi,4), %rdi
subl %r8d, %eax
jmp 0x477d
leaq (%r14,%r9,4), %rdi
subl %eax, %r8d
movl %r8d, %eax
movl (%rdi), %edi
shll $0x8, %eax
addl $0x2100, %eax           # imm = 0x2100
orl %edi, %eax
movb %dil, (%r12,%rsi)
movq -0x58(%rbp), %rdi
movb %ah, (%rdi,%rsi)
incq %rsi
incq %rcx
incl %r15d
cmpq %rdx, %rcx
jl 0x471e
jmp 0x47b3
xorl %esi, %esi
jmp 0x46d6
movq -0x78(%rbp), %r12
movq %rsi, %r14
movslq %esi, %rax
xorl %ecx, %ecx
movq -0x58(%rbp), %rdx
movb %cl, (%rdx,%rax)
movb %cl, (%r12,%rax)
cmpl 0x8(%r13), %eax
jge 0x47d7
movl $0xc, %eax
movl %eax, 0x34(%rbx)
movl %eax, 0x4(%rbx)
movq -0x38(%rbp), %rdi
callq 0x2050
movq 0x18(%rbx), %rdi
callq 0x2050
movq %r12, %rdi
callq 0x2260
movq %rax, -0x38(%rbp)
movq %rax, 0x10(%rbx)
movq -0x58(%rbp), %rdi
callq 0x2260
movq %rax, -0x48(%rbp)
movq %rax, 0x18(%rbx)
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl $0x80000000, %eax       # imm = 0x80000000
movl (%rbx), %r12d
andl %eax, %r12d
orl %r14d, %r12d
movl %r12d, (%rbx)
andl %eax, 0x30(%rbx)
leaq 0x4(%rbx), %rdx
movl 0x4(%rbx), %eax
addl $-0x1f, %eax
cmpl $0x1, %eax
jbe 0x3fe6
movq %rdx, -0x40(%rbp)
jmp 0x41ab