// File: /workspace/github_c_makefile_star2_O1/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)
movq $0x0, 0x10(%rdi)
leaq 0x1e5c6(%rip), %rsi     # 0x2c9aa
movl $0x0, 0x8(%rsp)
xorl %eax, %eax
callq 0xe671
testq %r15, %r15
je 0xe43e
cmpl $0x0, 0x10(%r15)
je 0xe43e
movl $0x10, %r12d
leaq 0x1e4b5(%rip), %rbp     # 0x2c8c1
leaq 0x10(%rsp), %r14
xorl %r13d, %r13d
movq 0x20(%r15), %rax
movq -0x10(%rax,%r12), %rdx
movl (%rax,%r12), %ecx
movq %r14, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0xe671
incq %r13
movl 0x10(%r15), %eax
addq $0x18, %r12
cmpq %rax, %r13
jb 0xe414
movq 0x28(%rsp), %r14
testq %r14, %r14
je 0xe4c2
leaq 0x274f1(%rip), %r12     # 0x35940
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0x21b0
leaq 0x1e702(%rip), %rsi     # 0x2cb67
movl $0x3, %edx
movq %r14, %rdi
callq 0x2080
testl %eax, %eax
je 0xe489
leaq 0x27283(%rip), %rax     # 0x35700
cmpl $0x0, (%rax)
jle 0xe4af
callq 0x303d
jmp 0xe4af
movq %r14, %rdi
movl $0x9, %esi
callq 0x2140
testq %rax, %rax
je 0xe562
leaq 0x2725a(%rip), %rax     # 0x35700
cmpl $0x0, (%rax)
jg 0xe667
xorl %r15d, %r15d
movq %r15, %rdi
callq 0x2040
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x1e502(%rip), %rsi     # 0x2c9cb
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xe671
movq 0x30(%rsp), %rdx
testq %rdx, %rdx
movl 0xc(%rsp), %ebp
je 0xe4f6
leaq 0x1e4fd(%rip), %rsi     # 0x2c9e7
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xe671
cmpl $0x2, %ebp
jl 0xe53a
leaq 0x1e4ec(%rip), %rsi     # 0x2c9ee
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0xe671
movl %ebp, %r12d
movl $0x1, %r13d
leaq 0x1d18d(%rip), %r15     # 0x2b6ae
movq (%rbx,%r13,8), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe671
incq %r13
cmpq %r13, %r12
jne 0xe521
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x589c
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 %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 0xe595
testl %edx, %edx
jne 0xe5ac
jmp 0xe5b6
movzbl 0x1(%rcx), %edx
incq %rcx
cmpl $0x74, %edx
je 0xe5aa
cmpl $0x5c, %edx
jne 0xe5b1
movb $0x5c, %dl
jmp 0xe5ac
movb $0x9, %dl
movb %dl, (%rax)
incq %rax
incq %rcx
jmp 0xe587
movb $0x0, (%rax)
leaq 0x1e641(%rip), %rsi     # 0x2cc01
movq %r15, %rdi
callq 0x2440
testq %rax, %rax
je 0xe60b
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xe5e3
btl %esi, %edx
jb 0xe5e8
incq %rcx
jmp 0xe5d4
cmpq $0xff, %rcx
jle 0xe625
leaq 0x27108(%rip), %rax     # 0x35700
cmpl $0x0, (%rax)
jle 0xe4b2
callq 0x3075
jmp 0xe4b2
leaq 0x270ee(%rip), %rax     # 0x35700
cmpl $0x0, (%rax)
jle 0xe4b2
callq 0x3091
jmp 0xe4b2
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xe63b
btl %esi, %edx
jb 0xe644
movb %sil, (%rcx,%r12)
incq %rcx
jmp 0xe62c
leaq 0x1e2a8(%rip), %rsi     # 0x2c8f3
movl $0x0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe671
jmp 0xe4c2
callq 0x3059
jmp 0xe4af