// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/format.c
// Function: mm_write_paf4
void mm_write_paf4(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, const mm_reg1_t *r, void *km, int64_t opt_flag, int rep_len, int n_seg, int seg_idx)
{
	s->l = 0;
	mm_sprintf_lite(s, "%s", t->name);
	if ((opt_flag & MM_F_FRAG_MODE) && n_seg >= 2 && seg_idx >= 0)
		mm_sprintf_lite(s, "/%d", seg_idx + 1);
	if (r == 0) {
		mm_sprintf_lite(s, "\t%d\t0\t0\t*\t*\t0\t0\t0\t0\t0\t0", t->l_seq);
		if (rep_len >= 0) mm_sprintf_lite(s, "\trl:i:%d", rep_len);
		return;
	}
	mm_sprintf_lite(s, "\t%d\t%d\t%d\t%c\t", t->l_seq, r->qs, r->qe, "+-"[r->rev]);
	if (mi->seq[r->rid].name) mm_sprintf_lite(s, "%s", mi->seq[r->rid].name);
	else mm_sprintf_lite(s, "%d", r->rid);
	mm_sprintf_lite(s, "\t%d", mi->seq[r->rid].len);
	if ((opt_flag & MM_F_QSTRAND) && r->rev)
		mm_sprintf_lite(s, "\t%d\t%d", mi->seq[r->rid].len - r->re, mi->seq[r->rid].len - r->rs);
	else
		mm_sprintf_lite(s, "\t%d\t%d", r->rs, r->re);
	mm_sprintf_lite(s, "\t%d\t%d", r->mlen, r->blen);
	mm_sprintf_lite(s, "\t%d", r->mapq);
	write_tags(s, r);
	if (rep_len >= 0) mm_sprintf_lite(s, "\trl:i:%d", rep_len);
	if (r->p && (opt_flag & MM_F_OUT_CG)) {
		uint32_t k;
		mm_sprintf_lite(s, "\tcg:Z:");
		for (k = 0; k < r->p->n_cigar; ++k)
			mm_sprintf_lite(s, "%d%c", r->p->cigar[k]>>4, MM_CIGAR_STR[r->p->cigar[k]&0xf]);
	}
	if (r->p && (opt_flag & (MM_F_OUT_CS|MM_F_OUT_DS|MM_F_OUT_MD)))
		write_cs_ds_or_MD(km, s, mi, t, r, !(opt_flag&MM_F_OUT_CS_LONG), !!(opt_flag&MM_F_OUT_MD), !!(opt_flag&MM_F_OUT_DS), 1, !!(opt_flag&MM_F_QSTRAND));
	if ((opt_flag & MM_F_COPY_COMMENT) && t->comment)
		mm_sprintf_lite(s, "\t%s", t->comment);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, 0x20(%rsp)
movq %rcx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
movl 0x70(%rsp), %ebp
movl 0x60(%rsp), %r13d
movl 0x68(%rsp), %r14d
andq $0x0, (%rdi)
movq %rdx, 0x8(%rsp)
movq 0x8(%rdx), %rdx
leaq 0x1abd1(%rip), %rsi     # 0x28af9
xorl %eax, %eax
callq 0xce8e
btl $0xd, %r15d
setae %al
cmpl $0x2, %r14d
setl %cl
testl %ebp, %ebp
sets %dl
orb %cl, %dl
orb %al, %dl
jne 0xdf5e
incl %ebp
leaq 0x1ab55(%rip), %rsi     # 0x28aa7
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xce8e
movq 0x8(%rsp), %rax
movl (%rax), %edx
testq %r12, %r12
je 0xdfcc
movl 0x10(%r12), %ecx
movl 0x14(%r12), %r8d
btl $0xa, 0x3c(%r12)
leaq 0x1a827(%rip), %rax     # 0x287a9
adcq $0x0, %rax
movsbl (%rax), %r9d
leaq 0x1ab3b(%rip), %rsi     # 0x28acc
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movq 0x10(%rsp), %r14
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rdx
imulq $0x18, %rdx, %rcx
movq (%rax,%rcx), %rax
testq %rax, %rax
je 0xe008
leaq 0x1ab3c(%rip), %rsi     # 0x28af9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xce8e
jmp 0xe019
leaq 0x1aad8(%rip), %rsi     # 0x28aab
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
testl %r13d, %r13d
js 0xe1ec
leaq 0x1aad6(%rip), %rsi     # 0x28ac3
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xce8e
leaq 0x1aacf(%rip), %rsi     # 0x28ade
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rcx
imulq $0x18, %rcx, %rcx
movl 0x10(%rax,%rcx), %edx
leaq 0x1aaac(%rip), %rsi     # 0x28add
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movabsq $0x100000000, %rbp      # imm = 0x100000000
andq %r15, %rbp
je 0xe052
testb $0x4, 0x3d(%r12)
jne 0xe05e
movl 0x18(%r12), %edx
movl 0x1c(%r12), %ecx
jmp 0xe07b
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rcx
imulq $0x18, %rcx, %rcx
movl 0x10(%rax,%rcx), %ecx
movl %ecx, %edx
subl 0x1c(%r12), %edx
subl 0x18(%r12), %ecx
leaq 0x1aa58(%rip), %rsi     # 0x28ada
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movl 0x2c(%r12), %edx
movl 0x30(%r12), %ecx
leaq 0x1aa3d(%rip), %rsi     # 0x28ada
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movzbl 0x3c(%r12), %edx
leaq 0x1aa29(%rip), %rsi     # 0x28add
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe1fb
testl %r13d, %r13d
js 0xe0e2
leaq 0x1a9ee(%rip), %rsi     # 0x28ac3
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xce8e
movq 0x48(%r12), %rax
testq %rax, %rax
sete %cl
testb $0x20, %r15b
sete %dl
orb %cl, %dl
jne 0xe158
movq %rbp, 0x18(%rsp)
leaq 0x1a9dd(%rip), %rsi     # 0x28ae1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xce8e
leaq 0x1a9d8(%rip), %r14     # 0x28aed
leaq 0x1a9cc(%rip), %r13     # 0x28ae8
xorl %ebp, %ebp
movq 0x48(%r12), %rax
movl 0x18(%rax), %ecx
cmpq %rcx, %rbp
jae 0xe14e
movl 0x1c(%rax,%rbp,4), %eax
movl %eax, %edx
shrl $0x4, %edx
andl $0xf, %eax
movsbl (%rax,%r14), %ecx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xce8e
incq %rbp
jmp 0xe11e
movq 0x10(%rsp), %r14
movq 0x18(%rsp), %rbp
testq %rax, %rax
sete %al
movabsq $0x2001000040, %rcx     # imm = 0x2001000040
testq %rcx, %r15
sete %cl
orb %al, %cl
jne 0xe1b8
xorl %r9d, %r9d
btl $0xb, %r15d
setae %r9b
movl %r15d, %eax
shrl $0x18, %eax
andl $0x1, %eax
movq %r15, %r10
shrq $0x25, %r10
andl $0x1, %r10d
shrq $0x20, %rbp
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
movq %r12, %r8
pushq %rbp
pushq $0x1
pushq %r10
pushq %rax
callq 0xd4c5
addq $0x20, %rsp
btl $0x19, %r15d
jae 0xe1ec
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
je 0xe1ec
leaq 0x1a924(%rip), %rsi     # 0x28af8
movq %rbx, %rdi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xce8e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq