// File: /workspace/github_c_makefile_star2_O3/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
movq $0x0, (%rdi)
movq %rdx, 0x8(%rsp)
movq 0x8(%rdx), %rdx
leaq 0x1e1ee(%rip), %rsi     # 0x2daf9
xorl %eax, %eax
callq 0xe575
btl $0xd, %r15d
setae %al
cmpl $0x2, %r14d
setl %cl
testl %ebp, %ebp
sets %dl
orb %cl, %dl
orb %al, %dl
jne 0xf941
incl %ebp
leaq 0x1e172(%rip), %rsi     # 0x2daa7
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe575
movq 0x8(%rsp), %rax
movl (%rax), %edx
testq %r12, %r12
je 0xf9af
movl 0x10(%r12), %ecx
movl 0x14(%r12), %r8d
btl $0xa, 0x3c(%r12)
leaq 0x1de44(%rip), %rax     # 0x2d7a9
adcq $0x0, %rax
movsbl (%rax), %r9d
leaq 0x1e158(%rip), %rsi     # 0x2dacc
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movq 0x10(%rsp), %r14
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rdx
leaq (%rdx,%rdx,2), %rcx
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0xf9eb
leaq 0x1e159(%rip), %rsi     # 0x2daf9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe575
jmp 0xf9fc
leaq 0x1e0f5(%rip), %rsi     # 0x2daab
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
testl %r13d, %r13d
js 0xfbd6
leaq 0x1e0f3(%rip), %rsi     # 0x2dac3
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 0xe575
leaq 0x1e0ec(%rip), %rsi     # 0x2dade
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rcx
leaq (%rcx,%rcx,2), %rcx
movl 0x10(%rax,%rcx,8), %edx
leaq 0x1e0c9(%rip), %rsi     # 0x2dadd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movabsq $0x100000000, %rax      # imm = 0x100000000
andq %r15, %rax
movq %rax, 0x18(%rsp)
je 0xfa3a
testb $0x4, 0x3d(%r12)
jne 0xfa46
movl 0x18(%r12), %edx
movl 0x1c(%r12), %ecx
jmp 0xfa63
movq 0x20(%r14), %rax
movslq 0x8(%r12), %rcx
leaq (%rcx,%rcx,2), %rcx
movl 0x10(%rax,%rcx,8), %ecx
movl %ecx, %edx
subl 0x1c(%r12), %edx
subl 0x18(%r12), %ecx
leaq 0x1e070(%rip), %rsi     # 0x2dada
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movl 0x2c(%r12), %edx
movl 0x30(%r12), %ecx
leaq 0x1e055(%rip), %rsi     # 0x2dada
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movzbl 0x3c(%r12), %edx
leaq 0x1e041(%rip), %rsi     # 0x2dadd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movq %rbx, %rdi
movq %r12, %rsi
callq 0xfbe5
testl %r13d, %r13d
js 0xfaca
leaq 0x1e006(%rip), %rsi     # 0x2dac3
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe575
movq 0x48(%r12), %rax
testq %rax, %rax
sete %cl
testb $0x20, %r15b
sete %dl
orb %cl, %dl
jne 0xfb3a
leaq 0x1dffa(%rip), %rsi     # 0x2dae1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe575
movq 0x48(%r12), %rax
cmpl $0x0, 0x18(%rax)
je 0xfb3a
leaq 0x1dfea(%rip), %r14     # 0x2daed
leaq 0x1dfde(%rip), %r13     # 0x2dae8
xorl %ebp, %ebp
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 0xe575
incq %rbp
movq 0x48(%r12), %rax
movl 0x18(%rax), %ecx
cmpq %rcx, %rbp
jb 0xfb0c
testq %rax, %rax
sete %al
movabsq $0x2001000040, %rcx     # imm = 0x2001000040
testq %rcx, %r15
sete %cl
orb %al, %cl
jne 0xfba2
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
movq 0x18(%rsp), %r11
shrq $0x20, %r11
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %r12, %r8
pushq %r11
pushq $0x1
pushq %r10
pushq %rax
callq 0xee3a
addq $0x20, %rsp
btl $0x19, %r15d
jae 0xfbd6
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
je 0xfbd6
leaq 0x1df3a(%rip), %rsi     # 0x2daf8
movq %rbx, %rdi
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe575
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq