// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/format.c
// Function: mm_write_sam_hdr
int mm_write_sam_hdr(const mm_idx_t *idx, const char *rg, const char *ver, int argc, char *argv[])
{
	kstring_t str = {0,0,0};
	int ret = 0;
	mm_sprintf_lite(&str, "@HD\tVN:1.6\tSO:unsorted\tGO:query\n");
	if (idx) {
		uint32_t i;
		for (i = 0; i < idx->n_seq; ++i)
			mm_sprintf_lite(&str, "@SQ\tSN:%s\tLN:%d\n", idx->seq[i].name, idx->seq[i].len);
	}
	if (rg) ret = sam_write_rg_line(&str, rg);
	mm_sprintf_lite(&str, "@PG\tID:minimap2\tPN:minimap2");
	if (ver) mm_sprintf_lite(&str, "\tVN:%s", ver);
	if (argc > 1) {
		int i;
		mm_sprintf_lite(&str, "\tCL:minimap2");
		for (i = 1; i < argc; ++i)
			mm_sprintf_lite(&str, " %s", argv[i]);
	}
	mm_err_puts(str.s);
	free(str.s);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %rbx
movl %ecx, 0xc(%rsp)
movq %rdx, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x1be09(%rip), %rsi     # 0x289ca
movl $0x0, 0x8(%rsp)
xorl %eax, %eax
callq 0xce8e
testq %r15, %r15
je 0xcc14
pushq $0x10
popq %r12
leaq 0x1bd01(%rip), %rbp     # 0x288e1
leaq 0x10(%rsp), %r14
xorl %r13d, %r13d
movl 0x10(%r15), %eax
cmpq %rax, %r13
jae 0xcc14
movq 0x20(%r15), %rax
movq -0x10(%rax,%r12), %rdx
movl (%rax,%r12), %ecx
movq %r14, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0xce8e
incq %r13
addq $0x18, %r12
jmp 0xcbe8
movq 0x28(%rsp), %r14
testq %r14, %r14
je 0xcca6
leaq 0x25d17(%rip), %r12     # 0x32940
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0x21b0
cmpb $0x40, (%r14)
jne 0xcc84
cmpb $0x52, 0x1(%r14)
jne 0xcc84
cmpb $0x47, 0x2(%r14)
jne 0xcc84
pushq $0x9
popq %rsi
movq %r14, %rdi
callq 0x2140
testq %rax, %rax
je 0xcd67
leaq 0x25a99(%rip), %rax     # 0x32700
cmpl $0x0, (%rax)
jle 0xcc94
movq 0x25385(%rip), %rax     # 0x31ff8
movq (%rax), %rcx
leaq 0x1bf3f(%rip), %rdi     # 0x28bbc
pushq $0x60
jmp 0xcd59
leaq 0x25a75(%rip), %rax     # 0x32700
cmpl $0x0, (%rax)
jg 0xcd46
xorl %r15d, %r15d
movq %r15, %rdi
callq 0x2040
pushq $-0x1
popq %rax
movl %eax, 0x8(%rsp)
leaq 0x1bd3e(%rip), %rsi     # 0x289eb
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xce8e
movq 0x30(%rsp), %rdx
testq %rdx, %rdx
movl 0xc(%rsp), %ebp
je 0xccda
leaq 0x1bd39(%rip), %rsi     # 0x28a07
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xce8e
cmpl $0x2, %ebp
jl 0xcd1e
pushq $0x1
popq %r12
leaq 0x1bd24(%rip), %rsi     # 0x28a0e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0xce8e
movl %ebp, %r13d
leaq 0x1a9a8(%rip), %r15     # 0x276ab
cmpq %r12, %r13
je 0xcd1e
movq (%rbx,%r12,8), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xce8e
incq %r12
jmp 0xcd03
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x4550
movq %rbx, %rdi
callq 0x2040
movl 0x8(%rsp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x252ab(%rip), %rax     # 0x31ff8
movq (%rax), %rcx
leaq 0x1be30(%rip), %rdi     # 0x28b87
pushq $0x34
popq %rsi
pushq $0x1
popq %rdx
callq 0x23f0
jmp 0xcc94
movq %r14, %rdi
callq 0x2130
leaq 0x1(%rax), %rdi
callq 0x22f0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x2090
movq %r15, %rcx
movq %r15, %rax
movzbl (%rcx), %edx
cmpl $0x5c, %edx
je 0xcd9a
testl %edx, %edx
jne 0xcdb1
jmp 0xcdbb
movzbl 0x1(%rcx), %edx
incq %rcx
cmpl $0x74, %edx
je 0xcdaf
cmpl $0x5c, %edx
jne 0xcdb6
movb $0x5c, %dl
jmp 0xcdb1
movb $0x9, %dl
movb %dl, (%rax)
incq %rax
incq %rcx
jmp 0xcd8c
movb $0x0, (%rax)
leaq 0x1be58(%rip), %rsi     # 0x28c1d
movq %r15, %rdi
callq 0x2440
testq %rax, %rax
je 0xce1b
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xcde8
btl %esi, %edx
jb 0xcded
incq %rcx
jmp 0xcdd9
cmpq $0xff, %rcx
jle 0xce4c
leaq 0x25903(%rip), %rax     # 0x32700
cmpl $0x0, (%rax)
jle 0xcc97
movq 0x251eb(%rip), %rax     # 0x31ff8
movq (%rax), %rcx
leaq 0x1be35(%rip), %rdi     # 0x28c4c
pushq $0x2d
jmp 0xce3e
leaq 0x258de(%rip), %rax     # 0x32700
cmpl $0x0, (%rax)
jle 0xcc97
movq 0x251c6(%rip), %rax     # 0x31ff8
movq (%rax), %rcx
leaq 0x1bde6(%rip), %rdi     # 0x28c22
pushq $0x29
popq %rsi
pushq $0x1
popq %rdx
callq 0x23f0
jmp 0xcc97
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xce62
btl %esi, %edx
jb 0xce6b
movb %sil, (%rcx,%r12)
incq %rcx
jmp 0xce53
leaq 0x1baa1(%rip), %rsi     # 0x28913
movl $0x0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xce8e
jmp 0xcca6