// File: /workspace/github_c_makefile_star2_O1/xiongxu[P]bam2bedGraph2/samtools-0.1.19/sample.c
// Function: add_pair
static void add_pair(bam_sample_t *sm, khash_t(sm) *sm2id, const char *key, const char *val)
{
	khint_t k_rg, k_sm;
	int ret;
	khash_t(sm) *rg2smid = (khash_t(sm)*)sm->rg2smid;
	k_rg = kh_get(sm, rg2smid, key);
	if (k_rg != kh_end(rg2smid)) return; // duplicated @RG-ID
	k_rg = kh_put(sm, rg2smid, strdup(key), &ret);
	k_sm = kh_get(sm, sm2id, val);
	if (k_sm == kh_end(sm2id)) { // absent
		if (sm->n == sm->m) {
			sm->m = sm->m? sm->m<<1 : 1;
			sm->smpl = realloc(sm->smpl, sizeof(void*) * sm->m);
		}
		sm->smpl[sm->n] = strdup(val);
		k_sm = kh_put(sm, sm2id, sm->smpl[sm->n], &ret);
		kh_val(sm2id, k_sm) = sm->n++;
	}
	kh_val(rg2smid, k_rg) = kh_val(sm2id, k_sm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r13
movq %rsi, 0x10(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x20(%rsp)
movl (%rax), %r12d
testl %r12d, %r12d
movq %rdi, 0x30(%rsp)
movq %rcx, 0x8(%rsp)
je 0x1699f
movsbl (%r13), %esi
xorl %r9d, %r9d
movl $0x0, %ecx
testl %esi, %esi
je 0x169ac
movb 0x1(%r13), %al
testb %al, %al
je 0x169aa
leaq 0x2(%r13), %rdx
movl %esi, %ecx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x16988
jmp 0x169ac
movq %rcx, %r15
xorl %r14d, %r14d
jmp 0x16a4d
movl %esi, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r12d
movl %edx, %edi
leal -0x1(%r12), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
movl %edx, %ebx
incl %ebx
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rsi
movl %edi, %r14d
movl %edi, 0x4(%rsp)
movq %rsi, 0x18(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%r14,%r14), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x16a3b
testb $0x1, %al
jne 0x16a21
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r13, %rsi
callq 0x35a0
movq 0x18(%rsp), %rsi
movl 0x4(%rsp), %edi
xorl %r9d, %r9d
testl %eax, %eax
je 0x16a3b
addl %ebx, %r14d
cmpl %r12d, %r14d
movl %r12d, %eax
cmovbl %r9d, %eax
subl %eax, %r14d
cmpl %edi, %r14d
jne 0x169d9
movl %r12d, %r14d
jmp 0x16a48
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r12d, %r14d
movq 0x8(%rsp), %r15
cmpl %r12d, %r14d
jne 0x16bf6
movq %r13, %rdi
callq 0x3570
leaq 0x2c(%rsp), %rdx
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x16fa4
movl %eax, %ebp
movq 0x10(%rsp), %rax
movl (%rax), %r14d
testl %r14d, %r14d
je 0x16ab3
movsbl (%r15), %esi
xorl %edi, %edi
movl $0x0, %ecx
testl %esi, %esi
je 0x16abd
movb 0x1(%r15), %al
testb %al, %al
je 0x16abb
leaq 0x2(%r15), %rdx
movl %esi, %ecx
movl %ecx, %esi
shll $0x5, %esi
subl %ecx, %esi
movsbl %al, %ecx
addl %esi, %ecx
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x16a9c
jmp 0x16abd
xorl %r13d, %r13d
jmp 0x16b5e
movl %esi, %ecx
movl %ebp, 0x18(%rsp)
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
movl %edx, %ebx
leal -0x1(%r14), %esi
movl %ecx, %eax
xorl %edx, %edx
divl %esi
incl %edx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r12
movl %ebx, %r13d
movl %edx, 0x4(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%r12,%rax,4), %ebp
leal (,%r13,2), %r15d
andl $0x1e, %r15d
movl %ebp, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x16b48
testb $0x1, %al
jne 0x16b2f
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x8(%rsp), %rsi
callq 0x35a0
movl 0x4(%rsp), %edx
xorl %edi, %edi
testl %eax, %eax
je 0x16b48
addl %edx, %r13d
cmpl %r14d, %r13d
movl %r14d, %eax
cmovbl %edi, %eax
subl %eax, %r13d
cmpl %ebx, %r13d
jne 0x16ae6
movl %r14d, %r13d
jmp 0x16b55
movl %r15d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
cmovnel %r14d, %r13d
movq 0x8(%rsp), %r15
movl 0x18(%rsp), %ebp
cmpl %r14d, %r13d
jne 0x16bd9
movq 0x30(%rsp), %r14
movl 0x4(%r14), %eax
cmpl %eax, (%r14)
jne 0x16b96
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x1, %eax
cmovnel %ecx, %eax
movl %eax, 0x4(%r14)
movq 0x8(%r14), %rdi
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x3720
movq %rax, 0x8(%r14)
movq %r15, %rdi
callq 0x3570
movq 0x8(%r14), %rcx
movslq (%r14), %rdx
movq %rax, (%rcx,%rdx,8)
movq 0x8(%r14), %rax
movq (%rax,%rdx,8), %rsi
leaq 0x2c(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x16fa4
movl %eax, %r13d
movl (%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movq 0x20(%rbx), %rcx
movl %r13d, %edx
movl %eax, (%rcx,%rdx,4)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movl %r13d, %ecx
movl (%rax,%rcx,4), %eax
movq 0x20(%rsp), %rcx
movq 0x20(%rcx), %rcx
movl %ebp, %edx
movl %eax, (%rcx,%rdx,4)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq