// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/format.c
// Function: write_sam_cigar
static void write_sam_cigar(kstring_t *s, int sam_flag, int in_tag, int qlen, const mm_reg1_t *r, int64_t opt_flag)
{
	if (r->p == 0) {
		mm_sprintf_lite(s, "*");
	} else {
		uint32_t k, clip_len[2];
		clip_len[0] = r->rev? qlen - r->qe : r->qs;
		clip_len[1] = r->rev? r->qs : qlen - r->qe;
		if (in_tag) {
			int clip_char = (((sam_flag&0x800) || ((sam_flag&0x100) && (opt_flag&MM_F_SECONDARY_SEQ))) &&
							 !(opt_flag&MM_F_SOFTCLIP)) ? 5 : 4;
			mm_sprintf_lite(s, "\tCG:B:I");
			if (clip_len[0]) mm_sprintf_lite(s, ",%u", clip_len[0]<<4|clip_char);
			for (k = 0; k < r->p->n_cigar; ++k)
				mm_sprintf_lite(s, ",%u", r->p->cigar[k]);
			if (clip_len[1]) mm_sprintf_lite(s, ",%u", clip_len[1]<<4|clip_char);
		} else {
			int clip_char = (((sam_flag&0x800) || ((sam_flag&0x100) && (opt_flag&MM_F_SECONDARY_SEQ))) &&
							 !(opt_flag&MM_F_SOFTCLIP)) ? 'H' : 'S';
			assert(clip_len[0] < qlen && clip_len[1] < qlen);
			if (clip_len[0]) mm_sprintf_lite(s, "%d%c", clip_len[0], clip_char);
			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 (clip_len[1]) mm_sprintf_lite(s, "%d%c", clip_len[1], clip_char);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x16c5f
movq -0x8(%rbp), %rdi
leaq 0x40adf(%rip), %rsi     # 0x57732
movb $0x0, %al
callq 0x144f0
jmp 0x16f09
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x16c80
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x40(%rbp)
jmp 0x16c8a
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x16cae
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x44(%rbp)
jmp 0x16cbb
movl -0x14(%rbp), %eax
movq -0x20(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x10(%rbp)
je 0x16dcc
movl -0xc(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x16d04
movl -0xc(%rbp), %ecx
andl $0x100, %ecx            # imm = 0x100
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x45(%rbp)
je 0x16d1a
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
andq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x45(%rbp)
je 0x16d1a
movq -0x28(%rbp), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %dl
movl $0x4, %eax
movl $0x5, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x40d8c(%rip), %rsi     # 0x57ac7
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0x34(%rbp)
je 0x16d63
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
shll $0x4, %edx
orl -0x38(%rbp), %edx
leaq 0x40d73(%rip), %rsi     # 0x57acf
movb $0x0, %al
callq 0x144f0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl 0x18(%rcx), %eax
jae 0x16da6
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x2c(%rbp), %ecx
movl 0x1c(%rax,%rcx,4), %edx
leaq 0x40d3b(%rip), %rsi     # 0x57acf
movb $0x0, %al
callq 0x144f0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x16d6a
cmpl $0x0, -0x30(%rbp)
je 0x16dc7
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %edx
shll $0x4, %edx
orl -0x38(%rbp), %edx
leaq 0x40d0f(%rip), %rsi     # 0x57acf
movb $0x0, %al
callq 0x144f0
jmp 0x16f07
movl -0xc(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x16e05
movl -0xc(%rbp), %ecx
andl $0x100, %ecx            # imm = 0x100
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x46(%rbp)
je 0x16e1b
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
andq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x46(%rbp)
je 0x16e1b
movq -0x28(%rbp), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
movb %al, -0x46(%rbp)
movb -0x46(%rbp), %dl
movl $0x53, %eax
movl $0x48, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x16e43
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x16e43
jmp 0x16e62
leaq 0x40c89(%rip), %rdi     # 0x57ad3
leaq 0x407bb(%rip), %rsi     # 0x5760c
movl $0x1f7, %edx            # imm = 0x1F7
leaq 0x40c9f(%rip), %rcx     # 0x57afc
callq 0x21a0
cmpl $0x0, -0x34(%rbp)
je 0x16e80
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x3c(%rbp), %ecx
leaq 0x40857(%rip), %rsi     # 0x576d0
movb $0x0, %al
callq 0x144f0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl 0x18(%rcx), %eax
jae 0x16ee7
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x2c(%rbp), %ecx
movl 0x1c(%rax,%rcx,4), %edx
shrl $0x4, %edx
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x2c(%rbp), %ecx
movl 0x1c(%rax,%rcx,4), %eax
andl $0xf, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x4080b(%rip), %rax     # 0x576d5
movsbl (%rax,%rcx), %ecx
leaq 0x407fb(%rip), %rsi     # 0x576d0
movb $0x0, %al
callq 0x144f0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x16e87
cmpl $0x0, -0x30(%rbp)
je 0x16f05
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %edx
movl -0x3c(%rbp), %ecx
leaq 0x407d2(%rip), %rsi     # 0x576d0
movb $0x0, %al
callq 0x144f0
jmp 0x16f07
jmp 0x16f09
addq $0x50, %rsp
popq %rbp
retq
nop