// File: /workspace/github_c_makefile_star2_O3/lh3[P]miniprot/format.c
// Function: mp_write_paf
void mp_write_paf(kstring_t *s, const mp_idx_t *mi, const mp_mapopt_t *opt, const mp_bseq1_t *seq, const mp_reg1_t *r)
{
	const mp_ctg_t *ctg;
	if (opt->flag & (MP_F_GFF|MP_F_GTF)) mp_sprintf_lite(s, "##PAF\t");
	if (r == 0) {
		mp_sprintf_lite(s, "%s\t%d\t0\t0\t*\t*\t0\t0\t0\t0\t0\t0\n", seq->name, seq->l_seq);
		return;
	}
	ctg = &mi->nt->ctg[r->vid>>1];
	mp_sprintf_lite(s, "%s\t%d\t%d\t%d\t%c\t%s\t%ld\t", seq->name, seq->l_seq, r->qs, r->qe, "+-"[r->vid&1], ctg->name, (long)ctg->len);
	if (r->vid&1) mp_sprintf_lite(s, "%ld\t%ld\t", (long)(ctg->len - r->ve), (long)(ctg->len - r->vs));
	else mp_sprintf_lite(s, "%ld\t%ld\t", (long)r->vs, (long)r->ve);
	if (r->p) {
		int32_t k;
		mp_sprintf_lite(s, "%d\t%d\t0\tAS:i:%d\tms:i:%d\tnp:i:%d\tfs:i:%d\tst:i:%d\tda:i:%d\tdo:i:%d\t",
			r->p->n_iden * 3, r->p->blen, r->p->dp_score, r->p->dp_max, r->p->n_plus, r->p->n_fs, r->p->n_stop, r->p->dist_start, r->p->dist_stop);
		mp_sprintf_lite(s, "cg:Z:");
		for (k = 0; k < r->p->n_cigar; ++k)
			mp_sprintf_lite(s, "%d%c", r->p->cigar[k]>>4, NS_CIGAR_STR[r->p->cigar[k]&0xf]);
	} else mp_sprintf_lite(s, "%d\t%d\t%d", r->chn_sc, r->chn_sc_ungap, r->cnt);
	if (!(opt->flag & MP_F_NO_CS)) {
		mp_sprintf_lite(s, "\t");
		mp_write_cs(s, mi, &seq->seq[r->qs], r);
	}
	mp_sprintf_lite(s, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r12
movq %rcx, %r15
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r13
testb $0x28, (%rdx)
je 0x10045
leaq 0x5306(%rip), %rsi      # 0x15341
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
testq %r12, %r12
je 0x100c1
movq %r14, (%rsp)
movq 0x18(%r14), %rax
movq 0x28(%rax), %rbx
movl 0x30(%r12), %eax
movl 0x34(%r12), %r8d
movl %eax, %ecx
shrl %ecx
leaq (%rcx,%rcx,2), %r14
movq 0x8(%r15), %rdx
movl (%r15), %ecx
movl 0x38(%r12), %r9d
andl $0x1, %eax
leaq 0x46e6(%rip), %rsi      # 0x14764
movsbl (%rax,%rsi), %r10d
subq $0x8, %rsp
leaq 0x52d5(%rip), %rsi      # 0x15363
movq %r13, %rdi
xorl %eax, %eax
pushq 0x8(%rbx,%r14,8)
pushq 0x10(%rbx,%r14,8)
pushq %r10
callq 0xf8b8
addq $0x20, %rsp
testb $0x1, 0x30(%r12)
movq %rbp, 0x10(%rsp)
jne 0x100e7
movq 0x40(%r12), %rdx
movq 0x48(%r12), %rcx
jmp 0x100fc
movq 0x8(%r15), %rdx
movl (%r15), %ecx
leaq 0x5279(%rip), %rsi      # 0x15348
movq %r13, %rdi
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf8b8
leaq (%rbx,%r14,8), %rax
movq 0x8(%rax), %rcx
movq %rcx, %rdx
subq 0x48(%r12), %rdx
subq 0x40(%r12), %rcx
leaq 0x5277(%rip), %rsi      # 0x1537a
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
movq 0x60(%r12), %rax
testq %rax, %rax
movq %r13, 0x20(%rsp)
je 0x101ca
movl 0x28(%rax), %ecx
leal (%rcx,%rcx,2), %edx
movl 0x14(%rax), %ecx
movl (%rax), %r8d
movl 0x4(%rax), %r9d
movl 0x2c(%rax), %r10d
movl 0x18(%rax), %r11d
movl 0x1c(%rax), %ebx
movl 0x24(%rax), %r14d
movl 0x20(%rax), %r13d
subq $0x8, %rsp
leaq 0x5235(%rip), %rsi      # 0x15383
movq 0x28(%rsp), %rdi
xorl %eax, %eax
pushq %r13
movq 0x30(%rsp), %r13
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0xf8b8
addq $0x30, %rsp
leaq 0x5251(%rip), %rsi      # 0x153c4
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
movq 0x60(%r12), %rax
cmpl $0x0, 0xc(%rax)
jle 0x101ea
leaq 0x5240(%rip), %rbx      # 0x153cf
leaq 0x5234(%rip), %rbp      # 0x153ca
xorl %r14d, %r14d
movl 0x30(%rax,%r14,4), %eax
movl %eax, %edx
shrl $0x4, %edx
andl $0xf, %eax
movsbl (%rax,%rbx), %ecx
movq %r13, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0xf8b8
incq %r14
movq 0x60(%r12), %rax
movslq 0xc(%rax), %rcx
cmpq %rcx, %r14
jl 0x10199
jmp 0x101ea
movl 0x4(%r12), %r8d
movl 0x24(%r12), %edx
movl 0x28(%r12), %ecx
leaq 0x51ff(%rip), %rsi      # 0x153df
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
movq 0x10(%rsp), %rax
testb $0x2, 0x1(%rax)
jne 0x1086a
leaq 0x52c2(%rip), %rsi      # 0x154c2
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
movq 0x60(%r12), %r14
testq %r14, %r14
je 0x1086a
movq 0x10(%r15), %rax
movq %rax, 0x30(%rsp)
movq %r12, 0x28(%rsp)
movslq 0x34(%r12), %rbx
leaq 0x51b6(%rip), %rsi      # 0x153e8
movq %r13, %rdi
xorl %eax, %eax
callq 0xf8b8
movslq 0xc(%r14), %rax
testq %rax, %rax
movq %r14, %r12
jle 0x10299
movl $0x10, %esi
xorl %ecx, %ecx
movl 0x30(%r12,%rcx,4), %r8d
movl %r8d, %edi
andl $0xf, %edi
movl %r8d, %edx
shrl $0x4, %edx
cmpl $0x1, %edi
setne %r9b
andl $0xe, %r8d
cmpl $0xa, %r8d
setne %r8b
testb %r8b, %r9b
jne 0x1027f
cmpl %edx, %esi
cmovlel %edx, %esi
jmp 0x1028c
cmpl $0x2, %edi
jne 0x1028c
leal (%rdx,%rdx,2), %edx
cmpl %edx, %esi
cmovlel %edx, %esi
incq %rcx
cmpq %rcx, %rax
jne 0x1024f
addl $0x10, %esi
jmp 0x1029e
movl $0x20, %esi
movq $0x0, 0x8(%rsp)
xorl %edi, %edi
callq 0x84a5
movq %rax, %r15
movq 0x28(%rsp), %r14
movq 0x48(%r14), %rsi
subq 0x40(%r14), %rsi
xorl %edi, %edi
callq 0x84a5
movq (%rsp), %rcx
movq 0x18(%rcx), %rdi
movl 0x30(%r14), %esi
movq 0x40(%r14), %rdx
movq 0x48(%r14), %rcx
movq %rax, 0x18(%rsp)
movq %rax, %r8
callq 0xc6d2
movq 0x48(%r14), %rcx
subq 0x40(%r14), %rcx
cmpq %rcx, %rax
jne 0x10889
cmpl $0x0, 0xc(%r12)
jle 0x1083c
addq %rbx, 0x30(%rsp)
movq 0x18(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x48(%rsp)
leaq 0x5145(%rip), %rdi      # 0x15462
xorl %ebp, %ebp
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq 0x28(%rsp), %rbx
movq %r12, 0x40(%rsp)
movq %rbp, 0x10(%rsp)
movl 0x30(%r12,%rbp,4), %eax
movl %eax, %ebp
andl $0xf, %ebp
movl %eax, %r14d
shrl $0x4, %r14d
cmpl $0xb, %ebp
ja 0x1048f
leal (%r14,%r14,2), %esi
leaq 0x4f50(%rip), %rdx      # 0x152b4
movslq (%rdx,%rbp,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %esi, 0x3c(%rsp)
cmpl $0x10, %eax
jb 0x107e9
movslq (%rsp), %rbx
addq 0x48(%rsp), %rbx
movslq 0x8(%rsp), %r13
addq 0x30(%rsp), %r13
xorl %r12d, %r12d
xorl %edx, %edx
movq %r14, 0x50(%rsp)
movb -0x2(%rbx), %al
movb -0x1(%rbx), %cl
movl %eax, %esi
shlb $0x4, %sil
leal (,%rcx,4), %edi
orb %sil, %dil
movb (%rbx), %sil
orb %sil, %dil
movzbl %dil, %edi
addq 0x8c1a(%rip), %rdi      # 0x18fd8
leaq 0x913b(%rip), %r9       # 0x19500
leaq 0x58(%r9), %r8
cmpb $0x4, %sil
cmovaeq %r8, %rdi
cmpb $0x4, %cl
cmovaeq %r8, %rdi
cmpb $0x4, %al
cmovaeq %r8, %rdi
movb (%rdi), %cl
movzbl (%r13), %esi
cmpb (%r9,%rsi), %cl
jne 0x103ff
leal 0x1(%rdx), %ebp
incl %r12d
cmpl %r14d, %r12d
jne 0x10481
jmp 0x107d0
testl %edx, %edx
movq 0x20(%rsp), %r14
jle 0x1041c
movq %r14, %rdi
leaq 0x504c(%rip), %rsi      # 0x1545e
xorl %eax, %eax
callq 0xf8b8
movb -0x2(%rbx), %al
movzbl %al, %eax
leaq 0x503c(%rip), %rcx      # 0x15462
movb (%rax,%rcx), %al
movb %al, (%r15)
movzbl -0x1(%rbx), %eax
movb (%rax,%rcx), %al
movb %al, 0x1(%r15)
movzbl (%rbx), %eax
movb (%rax,%rcx), %al
movb %al, 0x2(%r15)
callq 0x2030
movq (%rax), %rax
movsbq (%r13), %rcx
movb (%rax,%rcx,4), %al
movb %al, 0x3(%r15)
movb $0x0, 0x4(%r15)
xorl %ebp, %ebp
movq %r14, %rdi
leaq 0x5002(%rip), %rsi      # 0x15468
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
incl %r12d
movq 0x50(%rsp), %r14
cmpl %r14d, %r12d
je 0x107e9
incq %r13
addq $0x3, %rbx
movl %ebp, %edx
jmp 0x10397
cmpl $0x3, %ebp
setne %cl
andl $0xe, %eax
cmpl $0xc, %eax
setne %al
testb %al, %cl
jne 0x10818
xorl %eax, %eax
cmpl $0xc, %ebp
setne %al
incl %eax
movl %eax, %ebx
xorl $0x3, %ebx
movl %eax, %r12d
cmpl $0x3, %ebp
movl $0x0, %ecx
cmovel %ecx, %r12d
cmovel %ecx, %ebx
je 0x1052e
movslq (%rsp), %rcx
movl %eax, %r13d
addq 0x18(%rsp), %rcx
xorl %eax, %eax
movzbl (%rcx,%rax), %edx
movb (%rdx,%rdi), %dl
movb %dl, (%r15,%rax)
incq %rax
cmpq %rax, %r13
jne 0x104d7
callq 0x2030
movq (%rax), %rax
movslq 0x8(%rsp), %rcx
movq 0x30(%rsp), %rdx
movsbq (%rdx,%rcx), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%r15,%r13)
movb $0x0, 0x1(%r15,%r13)
movq 0x20(%rsp), %r13
movq %r13, %rdi
leaq 0x4f4b(%rip), %rsi      # 0x15468
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
leaq 0x4f34(%rip), %rdi      # 0x15462
movq (%rsp), %r9
leal (%r12,%r9), %eax
cltq
movq 0x18(%rsp), %rsi
movzbl (%rsi,%rax), %ecx
movsbl (%rcx,%rdi), %edx
movzbl 0x1(%rsi,%rax), %eax
movsbl (%rax,%rdi), %ecx
addl %ebx, %r12d
movl %r14d, %r8d
subl %r12d, %r8d
addl %r14d, %r9d
movq %r9, (%rsp)
movl %r9d, %eax
subl %ebx, %eax
movslq %eax, %r14
movzbl -0x2(%rsi,%r14), %eax
movsbl (%rax,%rdi), %r9d
movzbl -0x1(%rsi,%r14), %eax
movsbl (%rax,%rdi), %r10d
subq $0x8, %rsp
movq %r13, %rdi
leaq 0x4eea(%rip), %rsi      # 0x15474
xorl %eax, %eax
pushq %r10
callq 0xf8b8
addq $0x10, %rsp
testl %ebx, %ebx
movq 0x40(%rsp), %r12
je 0x105dd
addq 0x18(%rsp), %r14
movl %ebx, %eax
xorl %ecx, %ecx
leaq 0x4eb2(%rip), %rsi      # 0x15462
movzbl (%r14,%rcx), %edx
movb (%rdx,%rsi), %dl
movb %dl, (%r15,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x105b0
movb $0x0, (%r15,%rax)
movq %r13, %rdi
leaq 0x4e9d(%rip), %rsi      # 0x15470
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
xorl %eax, %eax
cmpl $0x3, %ebp
setne %al
movq 0x8(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x8(%rsp)
movq 0x28(%rsp), %rbx
jmp 0x10811
movl %esi, %r14d
cmpl $0x10, %eax
jae 0x1064b
xorl %eax, %eax
movq 0x10(%rsp), %rbp
jmp 0x10672
cmpl $0x10, %eax
jae 0x10697
xorl %ecx, %ecx
movq 0x10(%rsp), %rbp
jmp 0x106c8
cmpl $0x10, %eax
jae 0x106f3
xorl %eax, %eax
movq 0x10(%rsp), %rbp
jmp 0x1071a
cmpl $0x10, %eax
jae 0x10743
xorl %ebx, %ebx
movq 0x10(%rsp), %rbp
jmp 0x10769
movslq (%rsp), %rcx
movl %r14d, %eax
addq 0x18(%rsp), %rcx
xorl %edx, %edx
movq 0x10(%rsp), %rbp
movzbl (%rcx,%rdx), %esi
movb (%rsi,%rdi), %sil
movb %sil, (%r15,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x1065e
movb $0x0, (%r15,%rax)
movq %r13, %rdi
leaq 0x4def(%rip), %rsi      # 0x15470
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
addl (%rsp), %r14d
movl %r14d, %eax
jmp 0x1073a
callq 0x2030
movslq 0x8(%rsp), %rdx
movl %r14d, %ecx
addq 0x30(%rsp), %rdx
xorl %esi, %esi
movq 0x10(%rsp), %rbp
movq (%rax), %rdi
movsbq (%rdx,%rsi), %r8
movb (%rdi,%r8,4), %dil
movb %dil, (%r15,%rsi)
incq %rsi
cmpq %rsi, %rcx
jne 0x106b0
movb $0x0, (%r15,%rcx)
movq %r13, %rdi
leaq 0x4d95(%rip), %rsi      # 0x1546c
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
addl 0x8(%rsp), %r14d
movl %r14d, %eax
movq %rax, 0x8(%rsp)
jmp 0x107c7
movslq (%rsp), %rcx
movl %r14d, %eax
addq 0x18(%rsp), %rcx
xorl %edx, %edx
movq 0x10(%rsp), %rbp
movzbl (%rcx,%rdx), %esi
movb (%rsi,%rdi), %sil
movb %sil, (%r15,%rdx)
incq %rdx
cmpq %rdx, %rax
jne 0x10706
movb $0x0, (%r15,%rax)
movq %r13, %rdi
leaq 0x4d47(%rip), %rsi      # 0x15470
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
addl (%rsp), %r14d
movl %r14d, %eax
movq %rax, (%rsp)
jmp 0x107c7
movslq (%rsp), %rax
addq 0x18(%rsp), %rax
xorl %ecx, %ecx
movq 0x10(%rsp), %rbp
movzbl (%rax,%rcx), %edx
movb (%rdx,%rdi), %dl
movb %dl, (%r15,%rcx)
incq %rcx
cmpq %rcx, %r14
jne 0x10753
movq %r14, %rbx
movq %r14, %r13
callq 0x2030
movq (%rax), %rax
movq 0x8(%rsp), %r14
movslq %r14d, %r14
movq 0x30(%rsp), %rcx
movsbq (%rcx,%r14), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%r15,%rbx)
movb $0x0, 0x1(%r15,%rbx)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0x4cc6(%rip), %rsi      # 0x15468
movq %r15, %rdx
xorl %eax, %eax
callq 0xf8b8
addl (%rsp), %r13d
incl %r14d
movq %r14, 0x8(%rsp)
movl %r13d, %eax
movq %rbx, %r13
movq %rax, (%rsp)
movq 0x28(%rsp), %rbx
leaq 0x4c94(%rip), %rdi      # 0x15462
jmp 0x1081d
testl %edx, %edx
js 0x107e9
movq 0x20(%rsp), %rdi
leaq 0x4c7e(%rip), %rsi      # 0x1545e
movl %ebp, %edx
xorl %eax, %eax
callq 0xf8b8
movq (%rsp), %rax
addl 0x3c(%rsp), %eax
movq %rax, (%rsp)
addl 0x8(%rsp), %r14d
movl %r14d, %eax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbx
movq 0x40(%rsp), %r12
leaq 0x4c4a(%rip), %rdi      # 0x15462
movq 0x10(%rsp), %rbp
incq %rbp
movslq 0xc(%r12), %rax
cmpq %rax, %rbp
jl 0x1033a
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
movslq (%rsp), %rcx
jmp 0x10843
xorl %ecx, %ecx
movq 0x28(%rsp), %rbx
cmpq %rcx, %rax
jne 0x108a8
movl 0x38(%rbx), %eax
subl 0x34(%rbx), %eax
cmpl %eax, 0x8(%rsp)
jne 0x108c7
xorl %edi, %edi
movq 0x18(%rsp), %rsi
callq 0x83df
xorl %edi, %edi
movq %r15, %rsi
callq 0x83df
leaq 0x4610(%rip), %rsi      # 0x14e81
movq %r13, %rdi
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf8b8
leaq 0x4b5e(%rip), %rdi      # 0x153ee
leaq 0x4b6d(%rip), %rsi      # 0x15404
leaq 0x4b6f(%rip), %rcx      # 0x1540d
movl $0x77, %edx
callq 0x2150
leaq 0x4bd1(%rip), %rdi      # 0x15480
leaq 0x4b4e(%rip), %rsi      # 0x15404
leaq 0x4b50(%rip), %rcx      # 0x1540d
movl $0xb7, %edx
callq 0x2150
leaq 0x4bc6(%rip), %rdi      # 0x15494
leaq 0x4b2f(%rip), %rsi      # 0x15404
leaq 0x4b31(%rip), %rcx      # 0x1540d
movl $0xb8, %edx
callq 0x2150