// File: /workspace/github_c_makefile_star2_O3/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 0x1f6de(%rip), %rsi     # 0x2d9ca
movl $0x0, 0x8(%rsp)
xorl %eax, %eax
callq 0xe575
testq %r15, %r15
je 0xe346
cmpl $0x0, 0x10(%r15)
je 0xe346
movl $0x10, %r12d
leaq 0x1f5cd(%rip), %rbp     # 0x2d8e1
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 0xe575
incq %r13
movl 0x10(%r15), %eax
addq $0x18, %r12
cmpq %rax, %r13
jb 0xe31c
movq 0x28(%rsp), %r14
testq %r14, %r14
je 0xe3c6
leaq 0x285e9(%rip), %r12     # 0x36940
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
xorl %esi, %esi
callq 0x21b0
cmpb $0x40, (%r14)
jne 0xe3a3
cmpb $0x52, 0x1(%r14)
jne 0xe3a3
cmpb $0x47, 0x2(%r14)
jne 0xe3a3
movq %r14, %rdi
movl $0x9, %esi
callq 0x2140
testq %rax, %rax
je 0xe470
leaq 0x28369(%rip), %rax     # 0x36700
cmpl $0x0, (%rax)
jle 0xe3b3
callq 0x304f
jmp 0xe3b3
leaq 0x28356(%rip), %rax     # 0x36700
cmpl $0x0, (%rax)
jg 0xe466
xorl %r15d, %r15d
movq %r15, %rdi
callq 0x2040
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x1f61e(%rip), %rsi     # 0x2d9eb
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xe575
movq 0x30(%rsp), %rdx
testq %rdx, %rdx
movl 0xc(%rsp), %ebp
je 0xe3fa
leaq 0x1f619(%rip), %rsi     # 0x2da07
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0xe575
cmpl $0x2, %ebp
jl 0xe43e
leaq 0x1f608(%rip), %rsi     # 0x2da0e
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0xe575
movl %ebp, %r12d
movl $0x1, %r13d
leaq 0x1e286(%rip), %r15     # 0x2c6ab
movq (%rbx,%r13,8), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe575
incq %r13
cmpq %r13, %r12
jne 0xe425
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x5804
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
callq 0x3033
jmp 0xe3b3
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 0xe4a3
testl %edx, %edx
jne 0xe4ba
jmp 0xe4c4
movzbl 0x1(%rcx), %edx
incq %rcx
cmpl $0x74, %edx
je 0xe4b8
cmpl $0x5c, %edx
jne 0xe4bf
movb $0x5c, %dl
jmp 0xe4ba
movb $0x9, %dl
movb %dl, (%rax)
incq %rax
incq %rcx
jmp 0xe495
movb $0x0, (%rax)
leaq 0x1f74f(%rip), %rsi     # 0x2dc1d
movq %r15, %rdi
callq 0x2440
testq %rax, %rax
je 0xe519
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xe4f1
btl %esi, %edx
jb 0xe4f6
incq %rcx
jmp 0xe4e2
cmpq $0xff, %rcx
jle 0xe533
leaq 0x281fa(%rip), %rax     # 0x36700
cmpl $0x0, (%rax)
jle 0xe3b6
callq 0x306b
jmp 0xe3b6
leaq 0x281e0(%rip), %rax     # 0x36700
cmpl $0x0, (%rax)
jle 0xe3b6
callq 0x3087
jmp 0xe3b6
xorl %ecx, %ecx
movl $0x601, %edx            # imm = 0x601
movzbl 0x4(%rax,%rcx), %esi
cmpl $0xa, %esi
ja 0xe549
btl %esi, %edx
jb 0xe552
movb %sil, (%rcx,%r12)
incq %rcx
jmp 0xe53a
leaq 0x1f3ba(%rip), %rsi     # 0x2d913
movl $0x0, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe575
jmp 0xe3c6