// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/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 0x115f5(%rip), %rax     # 0x1a9e0
leal -0x2(%rcx), %edx
decl %ecx
cmpl %esi, (%rax,%rdx,4)
ja 0x93eb
movl %ecx, %ecx
movl (%rax,%rcx,4), %r12d
cvtsi2sd %r12, %xmm0
mulsd 0xfd88(%rip), %xmm0     # 0x19190
addsd 0xfd60(%rip), %xmm0     # 0x19170
movl 0x4(%rbx), %ebp
cvttsd2si %xmm0, %r13
cmpl %r13d, %ebp
jae 0x9477
movl %r12d, %eax
shrl $0x4, %eax
leaq 0x4(,%rax,4), %r15
movq %r15, %rdi
callq 0x33e0
movq %rax, %r14
movq %rax, %rdi
movl $0xaa, %esi
movq %r15, %rdx
callq 0x3260
cmpl %r12d, (%rbx)
jae 0x947a
movq 0x18(%rbx), %rdi
leaq (,%r12,8), %rsi
callq 0x3430
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
leaq (,%r12,4), %rsi
callq 0x3430
movq %rax, 0x20(%rbx)
jmp 0x947a
xorl %r14d, %r14d
cmpl %r13d, %ebp
jae 0x9616
movl (%rbx), %eax
testl %eax, %eax
je 0x95cd
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 0x94c4
incl %r8d
movl (%rbx), %eax
cmpl %eax, %r8d
jne 0x9495
jmp 0x95cd
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 0x9508
movb 0x1(%r10), %al
testb %al, %al
je 0x950a
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 0x94f1
jmp 0x950a
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 0x9560
incl %edx
addl %edx, %esi
xorl %eax, %eax
cmpl %r12d, %esi
jb 0x9543
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 0x9537
notl %ebp
andl %r11d, %ebp
movl %ebp, (%r14,%rax,4)
cmpl (%rbx), %esi
jae 0x957b
movq 0x10(%rbx), %rdx
movl (%rdx,%rax,4), %edx
shrl %cl, %edx
testb $0x3, %dl
je 0x959c
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 0x94dd
jmp 0x94b5
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 0x958f
cmpl %r12d, %eax
jbe 0x95fc
movq 0x18(%rbx), %rdi
leaq (,%r12,8), %rsi
callq 0x3430
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
leaq (,%r12,4), %rsi
callq 0x3430
movq %rax, 0x20(%rbx)
movq 0x10(%rbx), %rdi
callq 0x3060
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
nopl (%rax)