// File: /workspace/github_c_makefile_star2_O2/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 $0x68, %rsp
movq %r8, %r13
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
testb $0x28, (%rdx)
je 0xe1ed
leaq 0x5126(%rip), %rsi      # 0x13309
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdd2c
movq %rbx, 0x10(%rsp)
testq %r13, %r13
je 0xe269
movq %r14, 0x18(%rsp)
movq 0x18(%r14), %rax
movq 0x28(%rax), %rbx
movl 0x30(%r13), %eax
movl 0x34(%r13), %r8d
movl %eax, %ecx
shrl %ecx
imulq $0x18, %rcx, %r14
movq 0x8(%r15), %rdx
movl (%r15), %ecx
movl 0x38(%r13), %r9d
andl $0x1, %eax
leaq 0x453b(%rip), %rsi      # 0x12764
movsbl (%rax,%rsi), %r10d
subq $0x8, %rsp
leaq 0x50f2(%rip), %rsi      # 0x1332b
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
xorl %eax, %eax
pushq 0x8(%rbx,%r14)
pushq 0x10(%rbx,%r14)
pushq %r10
callq 0xdd2c
addq $0x20, %rsp
testb $0x1, 0x30(%r13)
jne 0xe291
movq 0x40(%r13), %rdx
movq 0x48(%r13), %rcx
jmp 0xe2a3
movq 0x8(%r15), %rdx
movl (%r15), %ecx
leaq 0x5099(%rip), %rsi      # 0x13310
movq 0x10(%rsp), %rdi
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdd2c
addq %r14, %rbx
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
subq 0x48(%r13), %rdx
subq 0x40(%r13), %rcx
leaq 0x5098(%rip), %rsi      # 0x13342
movq %rbp, %rdi
xorl %eax, %eax
callq 0xdd2c
movq 0x60(%r13), %rax
testq %rax, %rax
je 0xe371
imull $0x3, 0x28(%rax), %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), %ebp
subq $0x8, %rsp
leaq 0x505f(%rip), %rsi      # 0x1334b
movq %r15, 0x40(%rsp)
movq %r12, %r15
movq %r13, %r12
movq 0x18(%rsp), %r13
movq %r13, %rdi
xorl %eax, %eax
pushq %rbp
pushq %r14
pushq %rbx
pushq %r11
pushq %r10
callq 0xdd2c
addq $0x30, %rsp
leaq 0x5073(%rip), %rsi      # 0x1338c
movq %r13, %rdi
movq %r12, %r13
movq %r15, %r12
movq 0x38(%rsp), %r15
xorl %eax, %eax
callq 0xdd2c
leaq 0x5062(%rip), %rbx      # 0x13397
leaq 0x5056(%rip), %rbp      # 0x13392
xorl %r14d, %r14d
movq 0x60(%r13), %rax
movslq 0xc(%rax), %rcx
cmpq %rcx, %r14
jge 0xe390
movl 0x30(%rax,%r14,4), %eax
movl %eax, %edx
shrl $0x4, %edx
andl $0xf, %eax
movsbl (%rax,%rbx), %ecx
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0xdd2c
incq %r14
jmp 0xe33f
movl 0x4(%r13), %r8d
movl 0x24(%r13), %edx
movl 0x28(%r13), %ecx
leaq 0x5023(%rip), %rsi      # 0x133a7
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xdd2c
testb $0x2, 0x1(%r12)
jne 0xe9c7
leaq 0x50e7(%rip), %rsi      # 0x1348a
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xdd2c
movq 0x60(%r13), %r14
testq %r14, %r14
je 0xe9c7
movslq 0x34(%r13), %rax
addq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
leaq 0x4fde(%rip), %rsi      # 0x133b0
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xdd2c
movl 0xc(%r14), %eax
testl %eax, %eax
cmovlel %ebx, %eax
pushq $0x10
popq %rsi
cmpq %rbx, %rax
je 0xe42d
movl 0x30(%r14,%rbx,4), %edi
movl %edi, %edx
andl $0xf, %edx
movl %edi, %ecx
shrl $0x4, %ecx
cmpl $0x1, %edx
setne %r8b
andl $0xe, %edi
cmpl $0xa, %edi
setne %dil
testb %dil, %r8b
jne 0xe41b
cmpl %ecx, %esi
cmovlel %ecx, %esi
jmp 0xe428
cmpl $0x2, %edx
jne 0xe428
leal (%rcx,%rcx,2), %ecx
cmpl %ecx, %esi
cmovlel %ecx, %esi
incq %rbx
jmp 0xe3ea
addl $0x10, %esi
xorl %edi, %edi
callq 0x7460
movq %rax, %r15
movq 0x48(%r13), %rsi
subq 0x40(%r13), %rsi
xorl %edi, %edi
callq 0x7460
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x30(%r13), %esi
movq 0x40(%r13), %rdx
movq 0x48(%r13), %rcx
movq %rbx, %r8
callq 0xaeb0
movq 0x48(%r13), %rcx
movq %r13, 0x48(%rsp)
subq 0x40(%r13), %rcx
cmpq %rcx, %rax
jne 0xe9e8
movq %rbx, 0x20(%rsp)
leaq 0x2(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x4f96(%rip), %rdi      # 0x1342a
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %edx, %edx
movq 0x10(%rsp), %r13
movq %r14, 0x28(%rsp)
movslq 0xc(%r14), %rax
movslq %edx, %rbx
cmpq %rax, %rbp
jge 0xe994
movq %rbp, 0x30(%rsp)
movl 0x30(%r14,%rbp,4), %r10d
movl %r10d, %ebp
andl $0xf, %ebp
movl %r10d, %r9d
shrl $0x4, %r9d
movl %r12d, 0xc(%rsp)
movslq %r12d, %r12
cmpl $0xb, %ebp
movq %r9, 0x18(%rsp)
ja 0xe5ff
leaq (%r9,%r9,2), %r8
leaq 0x4d93(%rip), %rcx      # 0x13280
movslq (%rcx,%rbp,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r8, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
addq 0x50(%rsp), %rbx
addq 0x40(%rsp), %r12
shrl $0x4, %r10d
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r10, 0x38(%rsp)
cmpl %r13d, %r10d
je 0xe6ca
movb -0x2(%rbx), %al
movb -0x1(%rbx), %cl
movl %eax, %edx
shlb $0x4, %dl
leal (,%rcx,4), %esi
orb %dl, %sil
movb (%rbx), %dl
orb %dl, %sil
movzbl %sil, %esi
addq 0x9a92(%rip), %rsi      # 0x17fd8
leaq 0x9fc3(%rip), %r8       # 0x18510
leaq 0x58(%r8), %rdi
cmpb $0x4, %dl
cmovaeq %rdi, %rsi
cmpb $0x4, %cl
cmovaeq %rdi, %rsi
cmpb $0x4, %al
cmovaeq %rdi, %rsi
movb (%rsi), %cl
movzbl (%r12,%r13), %edx
cmpb (%r8,%rdx), %cl
jne 0xe576
incl %ebp
jmp 0xe5f3
testl %ebp, %ebp
movq 0x10(%rsp), %r14
jle 0xe595
movq %r14, %rdi
leaq 0x4e9d(%rip), %rsi      # 0x13426
movl %ebp, %edx
xorl %eax, %eax
callq 0xdd2c
movb -0x2(%rbx), %al
movzbl %al, %eax
leaq 0x4e8b(%rip), %rcx      # 0x1342a
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 (%r12,%r13), %rcx
movb (%rax,%rcx,4), %al
movb %al, 0x3(%r15)
movb $0x0, 0x4(%r15)
xorl %ebp, %ebp
movq %r14, %rdi
leaq 0x4e51(%rip), %rsi      # 0x13430
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd2c
movq 0x18(%rsp), %r9
movq 0x38(%rsp), %r10
addq $0x3, %rbx
incq %r13
jmp 0xe518
cmpl $0x3, %ebp
setne %al
andl $0xe, %r10d
cmpl $0xc, %r10d
setne %cl
testb %cl, %al
jne 0xe851
xorl %eax, %eax
cmpl $0xc, %ebp
setne %al
incl %eax
movl %eax, %r14d
xorl $0x3, %r14d
movl %eax, %r13d
cmpl $0x3, %ebp
movl $0x0, %ecx
cmovel %ecx, %r13d
cmovel %ecx, %r14d
je 0xe8b3
movl %r14d, 0x38(%rsp)
movl %eax, %r14d
addq 0x20(%rsp), %rbx
xorl %eax, %eax
cmpq %rax, %r14
je 0xe867
movzbl (%rbx,%rax), %ecx
movb (%rcx,%rdi), %cl
movb %cl, (%r15,%rax)
incq %rax
jmp 0xe651
addq 0x20(%rsp), %rbx
xorl %eax, %eax
movq 0x28(%rsp), %r14
movl 0xc(%rsp), %r12d
movq 0x30(%rsp), %rbp
cmpq %rax, %r8
je 0xe695
movzbl (%rbx,%rax), %ecx
movb (%rcx,%rdi), %cl
movb %cl, (%r15,%rax)
incq %rax
jmp 0xe680
movb $0x0, (%r15,%r8)
movq %r13, %rdi
leaq 0x4d94(%rip), %rsi      # 0x13438
movq %rdx, %rbx
movq %r15, %rdx
xorl %eax, %eax
movq %r8, %r13
callq 0xdd2c
leaq 0x4d6f(%rip), %rdi      # 0x1342a
addl %r13d, %ebx
movq 0x10(%rsp), %r13
movl %ebx, %eax
jmp 0xe98a
testl %ebp, %ebp
movq 0x10(%rsp), %r13
jle 0xe6eb
movq %r13, %rdi
leaq 0x4d49(%rip), %rsi      # 0x13426
movl %ebp, %edx
xorl %eax, %eax
callq 0xdd2c
movq 0x18(%rsp), %r9
movq 0x60(%rsp), %rax
addl 0x58(%rsp), %eax
addl 0xc(%rsp), %r9d
movl %r9d, %r12d
movq 0x28(%rsp), %r14
leaq 0x4d22(%rip), %rdi      # 0x1342a
jmp 0xe85d
movq %rdx, %r14
addq 0x40(%rsp), %r12
xorl %ebx, %ebx
movq 0x30(%rsp), %rbp
cmpq %rbx, %r9
je 0xe73f
callq 0x2030
movq 0x18(%rsp), %r9
movq (%rax), %rax
movsbq (%r12,%rbx), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%r15,%rbx)
incq %rbx
jmp 0xe71c
movb $0x0, (%r15,%r9)
movq %r13, %rdi
leaq 0x4ce6(%rip), %rsi      # 0x13434
movq %r15, %rdx
xorl %eax, %eax
movq %r9, %rbx
callq 0xdd2c
addl 0xc(%rsp), %ebx
movl %ebx, %r12d
movl %r14d, %eax
movq 0x28(%rsp), %r14
leaq 0x4cb9(%rip), %rdi      # 0x1342a
jmp 0xe98a
addq 0x20(%rsp), %rbx
xorl %eax, %eax
movq 0x28(%rsp), %r14
movl 0xc(%rsp), %r12d
movq 0x30(%rsp), %rbp
cmpq %rax, %r9
je 0xe7a1
movzbl (%rbx,%rax), %ecx
movb (%rcx,%rdi), %cl
movb %cl, (%r15,%rax)
incq %rax
jmp 0xe78c
movb $0x0, (%r15,%r9)
movq %r13, %rdi
leaq 0x4c88(%rip), %rsi      # 0x13438
movq %rdx, %rbx
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd2c
movq 0x18(%rsp), %rax
leaq 0x4c61(%rip), %rdi      # 0x1342a
addl %ebx, %eax
jmp 0xe98a
addq 0x20(%rsp), %rbx
xorl %eax, %eax
movq 0x30(%rsp), %rbp
cmpq %rax, %r9
je 0xe7f1
movzbl (%rbx,%rax), %ecx
movb (%rcx,%rdi), %cl
movb %cl, (%r15,%rax)
incq %rax
jmp 0xe7dc
movq %rdx, %rbx
callq 0x2030
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movsbq (%rcx,%r12), %rcx
movb (%rax,%rcx,4), %al
movq 0x18(%rsp), %rcx
movb %al, (%r15,%rcx)
movq 0x18(%rsp), %rax
movb $0x0, 0x1(%r15,%rax)
movq %r13, %rdi
leaq 0x4c09(%rip), %rsi      # 0x13430
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd2c
movq 0x18(%rsp), %rax
leaq 0x4bed(%rip), %rdi      # 0x1342a
addl %ebx, %eax
movl 0xc(%rsp), %r12d
incl %r12d
movq 0x28(%rsp), %r14
jmp 0xe98a
movl %edx, %eax
movq 0x28(%rsp), %r14
movl 0xc(%rsp), %r12d
movq 0x30(%rsp), %rbp
jmp 0xe98a
movq %rdx, %rbx
callq 0x2030
movq (%rax), %rax
movq 0x40(%rsp), %rcx
movsbq (%rcx,%r12), %rcx
movb (%rax,%rcx,4), %al
movb %al, (%r15,%r14)
movb $0x0, 0x1(%r15,%r14)
movq 0x10(%rsp), %rdi
leaq 0x4b9b(%rip), %rsi      # 0x13430
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd2c
movq %rbx, %rdx
movq 0x18(%rsp), %r9
leaq 0x4b7c(%rip), %rdi      # 0x1342a
movl 0x38(%rsp), %r14d
leal (%rdx,%r13), %eax
cltq
movq 0x20(%rsp), %rsi
movzbl (%rsi,%rax), %ecx
movq %rdx, %r10
movsbl (%rcx,%rdi), %edx
movzbl 0x1(%rsi,%rax), %eax
movsbl (%rax,%rdi), %ecx
addl %r14d, %r13d
movl %r9d, %r8d
subl %r13d, %r8d
addl %r10d, %r9d
movq %r9, 0x18(%rsp)
movl %r9d, %eax
subl %r14d, %eax
movslq %eax, %rbx
movzbl -0x2(%rsi,%rbx), %eax
movsbl (%rax,%rdi), %r9d
movzbl -0x1(%rsi,%rbx), %eax
movsbl (%rax,%rdi), %r10d
subq $0x8, %rsp
movq 0x18(%rsp), %r13
movq %r13, %rdi
leaq 0x4b29(%rip), %rsi      # 0x1343c
xorl %eax, %eax
pushq %r10
callq 0xdd2c
popq %rcx
popq %rdx
testl %r14d, %r14d
movl %r14d, %eax
movq 0x28(%rsp), %r14
movl 0xc(%rsp), %r12d
je 0xe96e
addq 0x20(%rsp), %rbx
movl %eax, %eax
xorl %ecx, %ecx
leaq 0x4aea(%rip), %rsi      # 0x1342a
cmpq %rcx, %rax
je 0xe955
movzbl (%rbx,%rcx), %edx
movb (%rdx,%rsi), %dl
movb %dl, (%r15,%rcx)
incq %rcx
jmp 0xe940
movb $0x0, (%r15,%rax)
movq %r13, %rdi
leaq 0x4ad4(%rip), %rsi      # 0x13438
movq %r15, %rdx
xorl %eax, %eax
callq 0xdd2c
xorl %eax, %eax
cmpl $0x3, %ebp
setne %al
addl %eax, %r12d
leaq 0x4aaa(%rip), %rdi      # 0x1342a
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %rax
incq %rbp
movl %eax, %edx
jmp 0xe4a5
movq 0x48(%rsp), %rcx
movq 0x48(%rcx), %rax
subq 0x40(%rcx), %rax
cmpq %rbx, %rax
jne 0xea05
movl 0x38(%rcx), %eax
subl 0x34(%rcx), %eax
cmpl %eax, %r12d
movq 0x20(%rsp), %rsi
jne 0xea24
xorl %edi, %edi
callq 0x736b
xorl %edi, %edi
movq %r15, %rsi
callq 0x736b
leaq 0x44b3(%rip), %rsi      # 0x12e81
movq 0x10(%rsp), %rdi
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdd2c
leaq 0x49c7(%rip), %rdi      # 0x133b6
leaq 0x49d6(%rip), %rsi      # 0x133cc
leaq 0x49d8(%rip), %rcx      # 0x133d5
pushq $0x77
popq %rdx
callq 0x2150
leaq 0x4a3c(%rip), %rdi      # 0x13448
leaq 0x49b9(%rip), %rsi      # 0x133cc
leaq 0x49bb(%rip), %rcx      # 0x133d5
movl $0xb7, %edx
callq 0x2150
leaq 0x4a31(%rip), %rdi      # 0x1345c
leaq 0x499a(%rip), %rsi      # 0x133cc
leaq 0x499c(%rip), %rcx      # 0x133d5
movl $0xb8, %edx
callq 0x2150