// File: /workspace/github_c_makefile_star2_O0/skoren[P]bacValidation/bamcat.c
// Function: append_text
static inline void append_text(bam_header_t *header, kstring_t *str)
{
	size_t x = header->l_text, y = header->l_text + str->l + 2; // 2 = 1 byte dret + 1 byte null
	kroundup32(x); kroundup32(y);
	if (x < y) 
    {
        header->n_text = y;
        header->text = (char*)realloc(header->text, y);
        if ( !header->text ) 
        {
            fprintf(stderr,"realloc failed to alloc %ld bytes\n", y);
            abort();
        }
    }
    // Sanity check
    if ( header->l_text+str->l+1 >= header->n_text )
    {
        fprintf(stderr,"append_text FIXME: %ld>=%ld, x=%ld,y=%ld\n",  header->l_text+str->l+1,(long)header->n_text,x,y);
        abort();
    }
	strncpy(header->text + header->l_text, str->s, str->l+1); // we cannot use strcpy() here.
	header->l_text += str->l + 1;
	header->text[header->l_text] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x10(%rbp), %rcx
addq (%rcx), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq %rax
orq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq $0x2, %rax
orq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq $0x4, %rax
orq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq $0x8, %rax
orq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
shrq $0x10, %rax
orq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq %rax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq $0x2, %rax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq $0x4, %rax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq $0x8, %rax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shrq $0x10, %rax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x9280
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x3650
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x927e
movq 0xdd6c(%rip), %rax      # 0x16fd0
movq (%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x93c7(%rip), %rsi      # 0x12639
movb $0x0, %al
callq 0x3590
callq 0x31b0
jmp 0x9280
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movq -0x10(%rbp), %rcx
addq (%rcx), %rax
addq $0x1, %rax
movq -0x8(%rbp), %rcx
movl 0x34(%rcx), %ecx
cmpq %rcx, %rax
jb 0x92e0
movq 0xdd2b(%rip), %rax      # 0x16fd0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, %edx
movq -0x10(%rbp), %rax
addq (%rax), %rdx
addq $0x1, %rdx
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, %ecx
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
leaq 0x9388(%rip), %rsi      # 0x1265c
movb $0x0, %al
callq 0x3590
callq 0x31b0
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
addq $0x1, %rdx
callq 0x3190
movq -0x10(%rbp), %rax
movq (%rax), %rdx
addq $0x1, %rdx
movq -0x8(%rbp), %rax
movl 0x30(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x30(%rcx), %ecx
movb $0x0, (%rax,%rcx)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)