// File: /workspace/github_c_makefile_star2_O3/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
movl %r8d, %r14d
movq %rsi, %r13
movl 0x88(%rsp), %r12d
movl 0x78(%rsp), %ebp
movl 0x70(%rsp), %r11d
leaq 0x1bf3c(%rip), %r15     # 0x36928
testb $0x8, (%r15)
jne 0x1abfd
movl 0x7c(%r13), %eax
testl %eax, %eax
je 0x1aa0f
movl %r12d, %esi
orl $0x4, %esi
cmpl %eax, 0x68(%r13)
cmovel %r12d, %esi
movl %esi, %r12d
movq 0xf0(%r13), %rax
testq %rax, %rax
jle 0x1aa56
movslq %r14d, %rsi
movslq %edx, %r8
imulq %rsi, %r8
cmpq %rax, %r8
jle 0x1aa56
movaps 0x13bbf(%rip), %xmm0    # 0x2e5f0
movq 0x90(%rsp), %r14
movups %xmm0, 0x10(%r14)
movq $0x0, 0x24(%r14)
movaps 0x13bb3(%rip), %xmm0    # 0x2e600
movups %xmm0, (%r14)
jmp 0x1abe4
movq (%r13), %rax
testb %al, %al
js 0x1aae2
movq %rdi, %r10
movl %edx, %ebx
movq %rcx, %r11
movl 0x74(%r13), %ecx
movl 0x6c(%r13), %edx
movl 0x70(%r13), %esi
movl %edx, %eax
xorl %ecx, %eax
movl 0x78(%r13), %edi
movl %esi, %r8d
xorl %edi, %r8d
orl %eax, %r8d
jne 0x1ab7c
movsbl %sil, %eax
movsbl %dl, %r13d
movq %r10, %rdi
movl %ebx, %esi
movq %r11, %rdx
movl %r14d, %ecx
movq %r9, %r8
movl $0x5, %r9d
movq 0x90(%rsp), %r14
pushq %r14
pushq %r12
pushq %rbp
movl 0x98(%rsp), %r10d
pushq %r10
movl 0x90(%rsp), %r10d
pushq %r10
pushq %rax
pushq %r13
pushq 0xa0(%rsp)
callq 0x1ee64
addq $0x40, %rsp
jmp 0x1abe4
movl %r12d, %esi
notl %esi
testl $0x300, %esi            # imm = 0x300
je 0x1ad17
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 %r14d, %ecx
movq %r9, %r8
movl $0x5, %r9d
movq 0x90(%rsp), %r14
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 0x1f136
addq $0x60, %rsp
leaq 0x1bdae(%rip), %r15     # 0x36928
jmp 0x1abe4
movsbl %sil, %eax
movq %rax, 0x8(%rsp)
movsbl %dl, %eax
movq %rax, (%rsp)
movsbl %dil, %eax
movsbl %cl, %r13d
movq %r10, %rdi
movl %ebx, %esi
movq %r11, %rdx
movl %r14d, %ecx
movq %r9, %r8
movl $0x5, %r9d
movq 0x90(%rsp), %r14
pushq %r14
pushq %r12
pushq %rbp
movl 0x98(%rsp), %r10d
pushq %r10
movl 0x90(%rsp), %r10d
pushq %r10
pushq %rax
pushq %r13
pushq 0x40(%rsp)
pushq 0x40(%rsp)
pushq 0xb0(%rsp)
callq 0x1efe5
addq $0x50, %rsp
testb $0x8, (%r15)
jne 0x1ad0a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, 0x10(%rsp)
movl %edx, (%rsp)
movq %rcx, 0x20(%rsp)
movq 0x1b3e7(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
movl 0x74(%r13), %ecx
movl 0x6c(%r13), %edx
movl 0x70(%r13), %r8d
movl %r14d, %ebx
movq %r9, %r14
movl 0x78(%r13), %r9d
movl 0x90(%r13), %r10d
leaq 0x13b2b(%rip), %rsi     # 0x2e763
xorl %eax, %eax
pushq %rbp
pushq %r10
pushq %r12
pushq %r11
callq 0x2260
addq $0x20, %rsp
movl %ebx, 0x8(%rsp)
testl %ebx, %ebx
jle 0x1ac80
movl 0x8(%rsp), %r15d
xorl %ebp, %ebp
leaq 0x130eb(%rip), %rbx     # 0x2dd4b
movzbl (%r14,%rbp), %eax
movsbl (%rax,%rbx), %edi
movq 0x1b388(%rip), %rax     # 0x35ff8
movq (%rax), %rsi
callq 0x21f0
incq %rbp
cmpq %rbp, %r15
jne 0x1ac60
movq %r14, 0x18(%rsp)
movq 0x1b36c(%rip), %rax     # 0x35ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x21f0
cmpl $0x0, (%rsp)
movq 0x20(%rsp), %rbx
jle 0x1acd1
movl (%rsp), %r15d
xorl %ebp, %ebp
leaq 0x1309a(%rip), %r14     # 0x2dd4b
movzbl (%rbx,%rbp), %eax
movsbl (%rax,%r14), %edi
movq 0x1b337(%rip), %rax     # 0x35ff8
movq (%rax), %rsi
callq 0x21f0
incq %rbp
cmpq %rbp, %r15
jne 0x1acb1
movq 0x1b320(%rip), %rax     # 0x35ff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x21f0
leaq 0x1bc3c(%rip), %r15     # 0x36928
movl 0x78(%rsp), %ebp
movq 0x18(%rsp), %r9
movl 0x8(%rsp), %r14d
movq %rbx, %rcx
movl (%rsp), %edx
movq 0x10(%rsp), %rdi
jmp 0x1a9f6
movq %r14, %rdi
callq 0x3247
jmp 0x1abee
leaq 0x13a91(%rip), %rdi     # 0x2e7af
leaq 0x13932(%rip), %rsi     # 0x2e657
leaq 0x13ace(%rip), %rcx     # 0x2e7fa
movl $0x161, %edx            # imm = 0x161
callq 0x21a0