// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %r13
movl 0x88(%rsp), %r12d
movl 0x78(%rsp), %ebp
movl 0x70(%rsp), %r10d
leaq 0x1af29(%rip), %r15     # 0x35928
testb $0x8, (%r15)
jne 0x1abda
movl 0x7c(%r13), %eax
testl %eax, %eax
je 0x1aa22
movl %r12d, %esi
orl $0x4, %esi
cmpl %eax, 0x68(%r13)
cmovel %r12d, %esi
movl %esi, %r12d
movq 0x90(%rsp), %r14
movq 0xf0(%r13), %rax
testq %rax, %rax
jle 0x1aa6f
movslq %r8d, %rsi
movslq %edx, %r11
imulq %rsi, %r11
cmpq %rax, %r11
jle 0x1aa6f
movabsq $-0x3fffffff00000001, %rax # imm = 0xC0000000FFFFFFFF
movq %rax, 0x18(%r14)
movq %rax, 0x10(%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x24(%r14)
movq $-0x80000000, (%r14)    # imm = 0x80000000
jmp 0x1abc1
movq (%r13), %rax
testb %al, %al
js 0x1aade
movl 0x6c(%r13), %r14d
movl 0x74(%r13), %ebx
cmpl %ebx, %r14d
jne 0x1ab70
movl 0x70(%r13), %esi
cmpl 0x78(%r13), %esi
jne 0x1ab70
movsbl %sil, %eax
movsbl %r14b, %r11d
movl %edx, %esi
movq %rcx, %rdx
movl %r8d, %ecx
movq %r9, %r8
movl $0x5, %r9d
movq 0x90(%rsp), %r14
pushq %r14
pushq %r12
pushq %rbp
movl 0x98(%rsp), %ebx
pushq %rbx
pushq %r10
pushq %rax
pushq %r11
pushq 0xa0(%rsp)
callq 0x1ee0c
addq $0x40, %rsp
jmp 0x1abc1
movl %r12d, %esi
notl %esi
testl $0x300, %esi            # imm = 0x300
je 0x1ad00
movq %rbp, %r10
movl %r12d, %ebx
orl $0x800, %ebx            # imm = 0x800
btq $0x23, %rax
cmovbl %r12d, %ebx
movsbl 0x6c(%r13), %r11d
movsbl 0x70(%r13), %r12d
movsbl 0x74(%r13), %ebp
movsbl 0x84(%r13), %r15d
movsbl 0x88(%r13), %eax
movsbl 0x8c(%r13), %r13d
movl %edx, %esi
movq %rcx, %rdx
movl %r8d, %ecx
movq %r9, %r8
movl $0x5, %r9d
pushq %r14
pushq 0x68(%rsp)
pushq %rbx
pushq %r13
pushq %rax
pushq %r10
movl 0xb0(%rsp), %eax
pushq %rax
pushq %r15
pushq %rbp
pushq %r12
pushq %r11
pushq 0xc0(%rsp)
callq 0x1f0e5
addq $0x60, %rsp
leaq 0x1adba(%rip), %r15     # 0x35928
jmp 0x1abc1
movsbl 0x70(%r13), %r11d
movsbl 0x78(%r13), %eax
movsbl %bl, %ebx
movsbl %r14b, %r13d
movl %edx, %esi
movq %rcx, %rdx
movl %r8d, %ecx
movq %r9, %r8
movl $0x5, %r9d
movq 0x90(%rsp), %r14
pushq %r14
pushq %r12
pushq %rbp
movl 0x98(%rsp), %r12d
pushq %r12
pushq %r10
pushq %rax
pushq %rbx
pushq %r11
pushq %r13
pushq 0xb0(%rsp)
callq 0x1ef98
addq $0x50, %rsp
testb $0x8, (%r15)
jne 0x1acf3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, 0x10(%rsp)
movl %edx, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x1a409(%rip), %rax     # 0x34ff8
movq (%rax), %rdi
movl 0x74(%r13), %ecx
movl 0x6c(%r13), %edx
movl %r8d, %ebx
movl 0x70(%r13), %r8d
movq %r9, %r14
movl 0x78(%r13), %r9d
movq %r10, %r11
movl 0x90(%r13), %r10d
leaq 0x12aca(%rip), %rsi     # 0x2d6e3
xorl %eax, %eax
pushq %rbp
pushq %r10
pushq %r12
pushq %r11
callq 0x2260
addq $0x20, %rsp
movl %ebx, 0xc(%rsp)
testl %ebx, %ebx
jle 0x1ac61
movl 0xc(%rsp), %ebp
xorl %r15d, %r15d
leaq 0x120ee(%rip), %rbx     # 0x2cd2f
movzbl (%r14,%r15), %eax
movsbl (%rax,%rbx), %edi
movq 0x1a3a7(%rip), %rax     # 0x34ff8
movq (%rax), %rsi
callq 0x21f0
incq %r15
cmpq %r15, %rbp
jne 0x1ac41
movq %r14, 0x18(%rsp)
movq 0x1a38b(%rip), %rax     # 0x34ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x21f0
cmpl $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r14
jle 0x1acb4
movl 0x8(%rsp), %ebp
xorl %r15d, %r15d
leaq 0x1209b(%rip), %rbx     # 0x2cd2f
movzbl (%r14,%r15), %eax
movsbl (%rax,%rbx), %edi
movq 0x1a354(%rip), %rax     # 0x34ff8
movq (%rax), %rsi
callq 0x21f0
incq %r15
cmpq %r15, %rbp
jne 0x1ac94
movq 0x1a33d(%rip), %rax     # 0x34ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x21f0
leaq 0x1ac59(%rip), %r15     # 0x35928
movl 0x78(%rsp), %ebp
movq 0x18(%rsp), %r9
movl 0x70(%rsp), %r10d
movl 0xc(%rsp), %r8d
movq %r14, %rcx
movl 0x8(%rsp), %edx
movq 0x10(%rsp), %rdi
jmp 0x1aa09
movq %r14, %rdi
callq 0x326d
jmp 0x1abcb
leaq 0x12a28(%rip), %rdi     # 0x2d72f
leaq 0x128c9(%rip), %rsi     # 0x2d5d7
leaq 0x12a65(%rip), %rcx     # 0x2d77a
movl $0x161, %edx            # imm = 0x161
callq 0x21a0