// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/align.c
// Function: mm_align_pair
static void mm_align_pair(void *km, const mm_mapopt_t *opt, int qlen, const uint8_t *qseq, int tlen, const uint8_t *tseq, const uint8_t *junc,
						  const int8_t *mat, int w, int end_bonus, int zdrop, int ksw_flag, ksw_extz_t *ez)
{
	if (mm_dbg_flag & MM_DBG_PRINT_ALN_SEQ) {
		int i;
		fprintf(stderr, "===> q=(%d,%d), e=(%d,%d), bw=%d, ksw_flag=%d, zdrop=%d, end_bonus=%d <===\n", opt->q, opt->q2, opt->e, opt->e2, w, ksw_flag, opt->zdrop, end_bonus);
		for (i = 0; i < tlen; ++i) fputc("ACGTN"[tseq[i]], stderr);
		fputc('\n', stderr);
		for (i = 0; i < qlen; ++i) fputc("ACGTN"[qseq[i]], stderr);
		fputc('\n', stderr);
	}
	if (opt->transition != 0 && opt->b != opt->transition)
		ksw_flag |= KSW_EZ_GENERIC_SC;
	if (opt->max_sw_mat > 0 && (int64_t)tlen * qlen > opt->max_sw_mat) { // too much memory; skip alignment
		ksw_reset_extz(ez);
		ez->zdropped = 1;
	} else if (opt->flag & MM_F_SPLICE) { // spliced alignment
		assert((ksw_flag & KSW_EZ_SPLICE_FOR) == 0 || (ksw_flag & KSW_EZ_SPLICE_REV) == 0);
		if (!(opt->flag & MM_F_SPLICE_OLD)) ksw_flag |= KSW_EZ_SPLICE_CMPLX;
		ksw_exts2_sse(km, qlen, qseq, tlen, tseq, 5, mat, opt->q, opt->e, opt->q2, opt->noncan, zdrop, end_bonus, opt->junc_bonus, opt->junc_pen, ksw_flag, junc, ez);
	} else if (opt->q == opt->q2 && opt->e == opt->e2) { // affine gap
		ksw_extz2_sse(km, qlen, qseq, tlen, tseq, 5, mat, opt->q, opt->e, w, zdrop, end_bonus, ksw_flag, ez);
	} else { // dual affine gap
		ksw_extd2_sse(km, qlen, qseq, tlen, tseq, 5, mat, opt->q, opt->e, opt->q2, opt->e2, w, zdrop, end_bonus, ksw_flag, ez);
	}
	if (mm_dbg_flag & MM_DBG_PRINT_ALN_SEQ) {
		int i;
		fprintf(stderr, "score=%d, cigar=", ez->score);
		for (i = 0; i < ez->n_cigar; ++i)
			fprintf(stderr, "%d%c", ez->cigar[i]>>4, MM_CIGAR_STR[ez->cigar[i]&0xf]);
		fprintf(stderr, "\n");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %rsi, %rbx
movq 0xc0(%rsp), %rbp
movl 0xb8(%rsp), %r13d
movl 0xb0(%rsp), %r12d
movl 0xa8(%rsp), %r11d
movl 0xa0(%rsp), %esi
movq 0x98(%rsp), %r15
movq 0x90(%rsp), %r10
leaq 0x1a6f0(%rip), %r14     # 0x32928
testb $0x8, (%r14)
jne 0x183f5
movl 0x7c(%rbx), %eax
testl %eax, %eax
je 0x18259
movl %r13d, %ecx
orl $0x4, %ecx
cmpl %eax, 0x68(%rbx)
cmovel %r13d, %ecx
movl %ecx, %r13d
movq 0xf0(%rbx), %rax
testq %rax, %rax
jle 0x18285
movslq %r8d, %rcx
movslq %edx, %r9
imulq %rcx, %r9
cmpq %rax, %r9
jle 0x18285
movq %rbp, %rdi
callq 0x1863e
orb $-0x80, 0x3(%rbp)
jmp 0x183dc
movq (%rbx), %rax
testb %al, %al
js 0x182f6
movq %rdi, %r9
movl %edx, %r10d
movq %rsi, 0x20(%rsp)
movl %r8d, 0x4(%rsp)
movl 0x74(%rbx), %ecx
movl 0x6c(%rbx), %eax
movl 0x70(%rbx), %edx
movl %eax, %edi
xorl %ecx, %edi
movl 0x78(%rbx), %esi
movl %edx, %r8d
xorl %esi, %r8d
orl %edi, %r8d
jne 0x1838d
movsbl %dl, %ebx
movsbl %al, %eax
movq %r9, %rdi
movl %r10d, %esi
movq 0x28(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x30(%rsp), %r8
pushq $0x5
popq %r9
pushq %rbp
pushq %r13
pushq %r11
pushq %r12
pushq 0x40(%rsp)
pushq %rbx
pushq %rax
pushq %r15
callq 0x1c148
addq $0x40, %rsp
jmp 0x183dc
movq %r11, 0x38(%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl %r13d, %ecx
notl %ecx
testw $0x300, %cx             # imm = 0x300
je 0x18594
movl %edx, %esi
movl %r13d, %r15d
orl $0x800, %r15d           # imm = 0x800
btq $0x23, %rax
cmovbl %r13d, %r15d
movsbl 0x6c(%rbx), %eax
movsbl 0x70(%rbx), %r13d
movsbl 0x74(%rbx), %r11d
movsbl 0x84(%rbx), %r14d
movsbl 0x88(%rbx), %r12d
movsbl 0x8c(%rbx), %ebx
pushq $0x5
popq %r9
movq 0x28(%rsp), %rdx
movl %r8d, %ecx
movq 0x30(%rsp), %r8
pushq %rbp
pushq %r10
pushq %r15
pushq %rbx
pushq %r12
pushq 0x60(%rsp)
pushq 0x38(%rsp)
pushq %r14
pushq %r11
pushq %r13
pushq %rax
pushq 0x68(%rsp)
callq 0x1c41a
addq $0x60, %rsp
leaq 0x1a59d(%rip), %r14     # 0x32928
jmp 0x183dc
movsbl %dl, %edx
movq %rdx, 0x8(%rsp)
movsbl %al, %eax
movq %rax, 0x10(%rsp)
movsbl %sil, %eax
movsbl %cl, %ebx
movq %r9, %rdi
movl %r10d, %esi
movq 0x28(%rsp), %rdx
movl 0x4(%rsp), %ecx
movq 0x30(%rsp), %r8
pushq $0x5
popq %r9
pushq %rbp
pushq %r13
pushq %r11
pushq %r12
pushq 0x40(%rsp)
pushq %rax
pushq %rbx
pushq 0x40(%rsp)
pushq 0x50(%rsp)
pushq %r15
callq 0x1c2c9
addq $0x50, %rsp
testb $0x8, (%r14)
jne 0x1851f
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r10, 0x40(%rsp)
movq %rdi, 0x48(%rsp)
movl %edx, 0x1c(%rsp)
movq %r12, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq %rbp, 0x50(%rsp)
movq 0x19bdf(%rip), %rbp     # 0x31ff8
movq (%rbp), %rdi
movl 0x74(%rbx), %ecx
movl 0x6c(%rbx), %edx
movl %r8d, %r12d
movl 0x70(%rbx), %r8d
movl 0x78(%rbx), %r9d
movl 0x90(%rbx), %r10d
movq %rsi, %r15
leaq 0x112e4(%rip), %rsi     # 0x29723
xorl %r14d, %r14d
xorl %eax, %eax
movq %r11, 0x38(%rsp)
pushq %r11
pushq %r10
pushq %r13
movq %r15, 0x38(%rsp)
pushq %r15
callq 0x2260
addq $0x20, %rsp
testl %r12d, %r12d
movl $0x0, %r15d
movl %r12d, 0x4(%rsp)
cmovgl %r12d, %r15d
leaq 0x108d3(%rip), %r12     # 0x28d4b
cmpq %r14, %r15
je 0x1849a
movq 0x30(%rsp), %rax
movzbl (%rax,%r14), %eax
movsbl (%rax,%r12), %edi
movq (%rbp), %rsi
callq 0x21f0
incq %r14
jmp 0x18478
movq (%rbp), %rsi
pushq $0xa
popq %rdi
callq 0x21f0
xorl %r14d, %r14d
movl 0x1c(%rsp), %eax
testl %eax, %eax
movl $0x0, %r15d
cmovgl %eax, %r15d
cmpq %r14, %r15
je 0x184db
movq 0x28(%rsp), %rax
movzbl (%rax,%r14), %eax
movsbl (%rax,%r12), %edi
movq (%rbp), %rsi
callq 0x21f0
incq %r14
jmp 0x184b9
movq (%rbp), %rsi
pushq $0xa
popq %rdi
callq 0x21f0
movq 0x50(%rsp), %rbp
leaq 0x1a435(%rip), %r14     # 0x32928
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r12
movq 0x38(%rsp), %r11
movl 0x4(%rsp), %r8d
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %r10
jmp 0x18242
movq 0x19ad2(%rip), %r14     # 0x31ff8
movq (%r14), %rdi
movl 0x1c(%rbp), %edx
leaq 0x11326(%rip), %rsi     # 0x29859
xorl %eax, %eax
callq 0x2260
leaq 0x105ac(%rip), %r15     # 0x28aed
leaq 0x105a0(%rip), %rbx     # 0x28ae8
xorl %r12d, %r12d
movslq 0x24(%rbp), %rax
movq (%r14), %rsi
cmpq %rax, %r12
jge 0x1857e
movq 0x30(%rbp), %rax
movl (%rax,%r12,4), %eax
movl %eax, %edx
shrl $0x4, %edx
andl $0xf, %eax
movsbl (%rax,%r15), %ecx
movq %rsi, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2260
incq %r12
jmp 0x1854b
pushq $0xa
popq %rdi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21f0
leaq 0x111d4(%rip), %rdi     # 0x2976f
leaq 0x11075(%rip), %rsi     # 0x29617
leaq 0x11211(%rip), %rcx     # 0x297ba
movl $0x161, %edx            # imm = 0x161
callq 0x21a0