// File: /workspace/github_cpp_makefile_star2_O1/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_aux.c
// Function: kh_resize_s
void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data)
{
	int ori_len = b->data_len;
	b->data_len += 3 + len;
	b->l_aux += 3 + len;
	if (b->m_data < b->data_len) {
		b->m_data = b->data_len;
		kroundup32(b->m_data);
		b->data = (uint8_t*)realloc(b->data, b->m_data);
	}
	b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1];
	b->data[ori_len + 2] = type;
	memcpy(b->data + ori_len + 3, data, len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x21, %ecx
leaq 0x14912(%rip), %rax     # 0x262e0
leal -0x2(%rcx), %edx
decl %ecx
cmpl %esi, (%rax,%rdx,4)
ja 0x119ce
movl %ecx, %ecx
movl (%rax,%rcx,4), %r12d
cvtsi2sd %r12, %xmm0
mulsd 0x12ca5(%rip), %xmm0    # 0x24690
addsd 0x12aa5(%rip), %xmm0    # 0x24498
movl 0x4(%rbx), %ebp
cvttsd2si %xmm0, %r13
cmpl %r13d, %ebp
jae 0x11a5a
movl %r12d, %eax
shrl $0x4, %eax
leaq 0x4(,%rax,4), %r15
movq %r15, %rdi
callq 0x31d0
movq %rax, %r14
movq %rax, %rdi
movl $0xaa, %esi
movq %r15, %rdx
callq 0x3060
cmpl %r12d, (%rbx)
jae 0x11a5d
movq 0x18(%rbx), %rdi
leaq (,%r12,8), %rsi
callq 0x3610
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
leaq (,%r12,4), %rsi
callq 0x3610
movq %rax, 0x20(%rbx)
jmp 0x11a5d
xorl %r14d, %r14d
cmpl %r13d, %ebp
jae 0x11bf9
movl (%rbx), %eax
testl %eax, %eax
je 0x11bb0
leal -0x1(%r12), %edi
xorl %r8d, %r8d
movq 0x10(%rbx), %rax
movl %r8d, %edx
shrl $0x4, %edx
movl (%rax,%rdx,4), %esi
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %esi, %r9d
shrl %cl, %r9d
testb $0x3, %r9b
je 0x11aa7
incl %r8d
movl (%rbx), %eax
cmpl %eax, %r8d
jne 0x11a78
jmp 0x11bb0
movl %r8d, %r9d
movq 0x18(%rbx), %r10
movq 0x20(%rbx), %r11
movq (%r10,%r9,8), %r10
movl (%r11,%r9,4), %r9d
btsl %ecx, %esi
movl %esi, (%rax,%rdx,4)
movsbl (%r10), %ecx
testl %ecx, %ecx
je 0x11aeb
movb 0x1(%r10), %al
testb %al, %al
je 0x11aed
leaq 0x2(%r10), %rdx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x11ad4
jmp 0x11aed
xorl %ecx, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r12d
movl %edx, %esi
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %esi, %eax
movl %esi, %ecx
addl %esi, %ecx
andl $0x1e, %ecx
movl $0x2, %ebp
shll %cl, %ebp
shrl $0x4, %eax
movl (%r14,%rax,4), %r11d
testl %r11d, %ebp
jne 0x11b43
incl %edx
addl %edx, %esi
xorl %eax, %eax
cmpl %r12d, %esi
jb 0x11b26
movl %r12d, %eax
subl %eax, %esi
movl %esi, %eax
shrl $0x4, %eax
movl (%r14,%rax,4), %r11d
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl $0x2, %ebp
shll %cl, %ebp
testl %r11d, %ebp
je 0x11b1a
notl %ebp
andl %r11d, %ebp
movl %ebp, (%r14,%rax,4)
cmpl (%rbx), %esi
jae 0x11b5e
movq 0x10(%rbx), %rdx
movl (%rdx,%rax,4), %edx
shrl %cl, %edx
testb $0x3, %dl
je 0x11b7f
movq 0x18(%rbx), %rax
movl %esi, %ecx
movq %r10, (%rax,%rcx,8)
movq 0x20(%rbx), %rax
movl %r9d, (%rax,%rcx,4)
xorl %eax, %eax
testb %al, %al
jne 0x11ac0
jmp 0x11a98
movq 0x18(%rbx), %rdx
movl %esi, %esi
movq (%rdx,%rsi,8), %r11
movq %r10, (%rdx,%rsi,8)
movq 0x20(%rbx), %rdx
movl (%rdx,%rsi,4), %ebp
movl %r9d, (%rdx,%rsi,4)
movl $0x1, %edx
shll %cl, %edx
movq 0x10(%rbx), %rcx
orl %edx, (%rcx,%rax,4)
movb $0x1, %al
movq %r11, %r10
movl %ebp, %r9d
jmp 0x11b72
cmpl %r12d, %eax
jbe 0x11bdf
movq 0x18(%rbx), %rdi
leaq (,%r12,8), %rsi
callq 0x3610
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
leaq (,%r12,4), %rsi
callq 0x3610
movq %rax, 0x20(%rbx)
movq 0x10(%rbx), %rdi
callq 0x32c0
movq %r14, 0x10(%rbx)
movl %r12d, (%rbx)
movl 0x4(%rbx), %eax
movl %eax, 0x8(%rbx)
movl %r13d, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq