// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwa.c
// Function: bwa_set_rg
char *bwa_set_rg(const char *s)
{
	char *p, *q, *r, *rg_line = 0;
	memset(bwa_rg_id, 0, 256);
	if (strstr(s, "@RG") != s) {
		logMessage(__func__, LOG_LEVEL_ERROR, "The read group line does not start with @RG\n");
		goto err_set_rg;
	}
	rg_line = strdup(s);
	bwa_escape(rg_line);
	if ((p = strstr(rg_line, "\tID:")) == 0) {
		logMessage(__func__, LOG_LEVEL_ERROR, "No ID at 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) {
		logMessage(__func__, LOG_LEVEL_ERROR, "@RG:ID is longer than 255 characters\n");
		goto err_set_rg;
	}
	for (q = p, r = bwa_rg_id; *q && *q != '\t' && *q != '\n'; ++q)
		*r++ = *q;
	return rg_line;

err_set_rg:
	free(rg_line);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x30(%rbp)
leaq 0x26425(%rip), %rdi     # 0x40e70
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x3130
movq -0x10(%rbp), %rdi
leaq 0x1fb34(%rip), %rsi     # 0x3a596
callq 0x3080
cmpq -0x10(%rbp), %rax
je 0x1aa8c
leaq 0x1fb26(%rip), %rdi     # 0x3a59a
movl $0x1, %esi
leaq 0x1fb25(%rip), %rdx     # 0x3a5a5
movb $0x0, %al
callq 0x12510
jmp 0x1abfd
movq -0x10(%rbp), %rdi
leaq 0x1f92e(%rip), %rsi     # 0x3a3c5
movl $0x1ac, %edx            # imm = 0x1AC
leaq 0x1faf7(%rip), %rcx     # 0x3a59a
callq 0x31df0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1ac20
movq -0x30(%rbp), %rdi
leaq 0x1fb12(%rip), %rsi     # 0x3a5d2
callq 0x3080
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x1aaee
leaq 0x1fac4(%rip), %rdi     # 0x3a59a
movl $0x1, %esi
leaq 0x1faf5(%rip), %rdx     # 0x3a5d7
movb $0x0, %al
callq 0x12510
jmp 0x1abfd
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x31(%rbp)
je 0x1ab34
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x31(%rbp)
je 0x1ab34
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x1ab3d
jmp 0x1ab4d
jmp 0x1ab3f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1ab02
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
cmpq $0x100, %rax            # imm = 0x100
jle 0x1ab80
leaq 0x1fa2f(%rip), %rdi     # 0x3a59a
movl $0x1, %esi
leaq 0x1fa7e(%rip), %rdx     # 0x3a5f5
movb $0x0, %al
callq 0x12510
jmp 0x1abfd
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x262e1(%rip), %rax     # 0x40e70
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x32(%rbp)
je 0x1abc5
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x32(%rbp)
je 0x1abc5
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x1abce
jmp 0x1abf3
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x28(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movb %cl, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1ab93
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1ac0e
movq -0x30(%rbp), %rdi
callq 0x3380
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)