// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/format.c
// Function: sam_write_rg_line
static int sam_write_rg_line(kstring_t *str, const char *s)
{
	char *p, *q, *r, *rg_line = 0;
	memset(mm_rg_id, 0, 256);
	if (s == 0) return 0;
	if (strstr(s, "@RG") != s) {
		if (mm_verbose >= 1) fprintf(stderr, "[ERROR] the read group line is not started with @RG\n");
		goto err_set_rg;
	}
	if (strstr(s, "\t") != NULL) {
		if (mm_verbose >= 1) fprintf(stderr, "[ERROR] the read group line contained literal <tab> characters -- replace with escaped tabs: \\t\n");
		goto err_set_rg;
	}
	rg_line = (char*)malloc(strlen(s) + 1);
	strcpy(rg_line, s);
	mm_escape(rg_line);
	if ((p = strstr(rg_line, "\tID:")) == 0) {
		if (mm_verbose >= 1) fprintf(stderr, "[ERROR] no ID within the read group line\n");
		goto err_set_rg;
	}
	p += 4;
	for (q = p; *q && *q != '\t' && *q != '\n'; ++q);
	if (q - p + 1 > 256) {
		if (mm_verbose >= 1) fprintf(stderr, "[ERROR] @RG:ID is longer than 255 characters\n");
		goto err_set_rg;
	}
	for (q = p, r = mm_rg_id; *q && *q != '\t' && *q != '\n'; ++q)
		*r++ = *q;
	mm_sprintf_lite(str, "%s\n", rg_line);
	return 0;

err_set_rg:
	free(rg_line);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
leaq 0x49f61(%rip), %rdi     # 0x5e950
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x21b0
cmpq $0x0, -0x18(%rbp)
jne 0x14a0e
movl $0x0, -0x4(%rbp)
jmp 0x14c3f
movq -0x18(%rbp), %rdi
leaq 0x42d56(%rip), %rsi     # 0x5776f
callq 0x2430
cmpq -0x18(%rbp), %rax
je 0x14a4d
leaq 0x49ce5(%rip), %rax     # 0x5e710
cmpl $0x1, (%rax)
jl 0x14a48
movq 0x495c1(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
leaq 0x42d32(%rip), %rsi     # 0x57773
movb $0x0, %al
callq 0x2250
jmp 0x14c2f
movq -0x18(%rbp), %rdi
leaq 0x42cce(%rip), %rsi     # 0x57726
callq 0x2430
cmpq $0x0, %rax
je 0x14a8c
leaq 0x49ca6(%rip), %rax     # 0x5e710
cmpl $0x1, (%rax)
jl 0x14a87
movq 0x49582(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
leaq 0x42d28(%rip), %rsi     # 0x577a8
movb $0x0, %al
callq 0x2250
jmp 0x14c2f
movq -0x18(%rbp), %rdi
callq 0x2130
movq %rax, %rdi
addq $0x1, %rdi
callq 0x22e0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2090
movq -0x38(%rbp), %rdi
callq 0x17290
movq -0x38(%rbp), %rdi
leaq 0x42d43(%rip), %rsi     # 0x57809
callq 0x2430
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x14afe
leaq 0x49c34(%rip), %rax     # 0x5e710
cmpl $0x1, (%rax)
jl 0x14af9
movq 0x49510(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
leaq 0x42d1c(%rip), %rsi     # 0x5780e
movb $0x0, %al
callq 0x2250
jmp 0x14c2f
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x14b44
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x39(%rbp)
je 0x14b44
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x14b4d
jmp 0x14b5d
jmp 0x14b4f
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x14b12
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
cmpq $0x100, %rax            # imm = 0x100
jle 0x14b9d
leaq 0x49b95(%rip), %rax     # 0x5e710
cmpl $0x1, (%rax)
jl 0x14b98
movq 0x49471(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
leaq 0x42ca7(%rip), %rsi     # 0x57838
movb $0x0, %al
callq 0x2250
jmp 0x14c2f
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq 0x49da4(%rip), %rax     # 0x5e950
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3a(%rbp)
je 0x14be2
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x3a(%rbp)
je 0x14be2
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
testb $0x1, %al
jne 0x14beb
jmp 0x14c10
movq -0x28(%rbp), %rax
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x14bb0
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x428dc(%rip), %rsi     # 0x574fb
movb $0x0, %al
callq 0x144f0
movl $0x0, -0x4(%rbp)
jmp 0x14c3f
movq -0x38(%rbp), %rdi
callq 0x2040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)