// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/khashpp/./khash.hpp
// Function: klib::KHash<aux_t, aux_hash, aux_eq, unsigned int>::resize(unsigned int)
int resize(khint_t new_n_buckets) {
		uint32_t *new_flags = 0;
		khint_t j = 1;
		{
			kroundup32(new_n_buckets);
			if (new_n_buckets < 4) new_n_buckets = 4;
			if (count >= (new_n_buckets>>1) + (new_n_buckets>>2)) j = 0;	/* requested count is too small */
			else { /* hash table count to be changed (shrink or expand); rehash */
				new_flags = (uint32_t*)std::malloc(__ac_fsize(new_n_buckets) * sizeof(uint32_t));
				if (!new_flags) return -1;
				::memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(uint32_t));
				if (n_buckets < new_n_buckets) {	/* expand */
					T *new_keys = (T*)std::realloc((void *)keys, new_n_buckets * sizeof(T));
					if (!new_keys) { std::free(new_flags); return -1; }
					keys = new_keys;
				} /* otherwise shrink */
			}
		}
		if (j) { /* rehashing is needed */
			for (j = 0; j != n_buckets; ++j) {
				if (__ac_iseither(flags, j) == 0) {
					T key = keys[j];
					khint_t new_mask;
					new_mask = new_n_buckets - 1;
					__ac_set_isdel_true(flags, j);
					while (1) { /* kick-out process; sort of like in Cuckoo hashing */
						khint_t k, i, step = 0;
						k = Hash()(key);
						i = k & new_mask;
						while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask;
						__ac_set_isempty_false(new_flags, i);
						if (i < n_buckets && __ac_iseither(flags, i) == 0) { /* kick out the existing element */
							{ T tmp = keys[i]; keys[i] = key; key = tmp; }
							__ac_set_isdel_true(flags, i); /* mark it as deleted in the old hash table */
						} else { /* write the element and jump out of the loop */
							keys[i] = key;
							break;
						}
					}
				}
			}
			if (n_buckets > new_n_buckets) /* shrink the hash table */
				keys = (T*)std::realloc((void *)keys, new_n_buckets * sizeof(T));
			std::free(flags); /* free the working space */
			flags = new_flags;
			n_buckets = new_n_buckets;
			n_occupied = count;
			upper_bound = (n_buckets>>1) + (n_buckets>>2);
		}
		return 0;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
decl %esi
movl %esi, %eax
shrl %eax
orl %esi, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
orl %ecx, %eax
incl %eax
cmpl $0x5, %eax
movl $0x4, %ecx
movl $0x4, %r15d
cmovael %eax, %r15d
movl 0x4(%rdi), %r13d
movl %r15d, %edx
shrl %edx
movq %r15, %r12
shrl $0x2, %r15d
addl %r15d, %edx
xorl %r14d, %r14d
cmpl %edx, %r13d
jae 0x18df
movl %edx, 0x4(%rsp)
andl $-0x4, %r15d
cmpl $0x10, %eax
cmovbl %ecx, %r15d
movq %r15, %rdi
callq 0x1090
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x1a62
movq %rax, %r14
movq %rax, %rdi
movl $0xaa, %esi
movq %r15, %rdx
callq 0x1050
movq %r12, %r15
cmpl %r15d, (%rbx)
jae 0x18e4
movq 0x18(%rbx), %rdi
movl %r15d, %esi
shlq $0x3, %rsi
callq 0x10c0
movq %rax, %r15
testq %rax, %rax
je 0x18ea
movq %r15, 0x18(%rbx)
jmp 0x18f2
movq %r12, %r15
jmp 0x1902
movl 0x4(%rsp), %edx
jmp 0x1902
movq %r14, %rdi
callq 0x1070
movl 0x4(%rsp), %edx
testq %r15, %r15
movq %r12, %r15
je 0x1a62
cmpl %edx, %r13d
jae 0x1a60
movl %edx, %r12d
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x1a2d
leal -0x1(%r15), %eax
xorl %edx, %edx
movq 0x10(%rbx), %r8
movl %edx, %r9d
shrl $0x4, %r9d
movl (%r8,%r9,4), %r10d
leal (%rdx,%rdx), %ecx
andl $0x1e, %ecx
movl %r10d, %esi
shrl %cl, %esi
testb $0x3, %sil
je 0x194b
incl %edx
movl (%rbx), %ecx
cmpl %ecx, %edx
jne 0x191e
jmp 0x1a2d
movq 0x18(%rbx), %rsi
movl %edx, %edi
movq (%rsi,%rdi,8), %rsi
movq %rsi, %rdi
shrq $0x20, %rdi
btsl %ecx, %r10d
movl %r10d, (%r8,%r9,4)
movl %esi, %r9d
andl %eax, %r9d
movl %r9d, %r8d
shrl $0x4, %r8d
movl (%r14,%r8,4), %r10d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl $0x2, %r11d
shll %cl, %r11d
testl %r10d, %r11d
jne 0x19b7
movl $0x1, %ebp
addl %ebp, %r9d
andl %eax, %r9d
movl %r9d, %r8d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl $0x2, %r11d
shll %cl, %r11d
shrl $0x4, %r8d
movl (%r14,%r8,4), %r10d
incl %ebp
testl %r10d, %r11d
je 0x198f
notl %r11d
andl %r10d, %r11d
movl %r11d, (%r14,%r8,4)
movl %r9d, %r10d
movl %esi, %r11d
cmpl (%rbx), %r9d
jae 0x19dd
movq 0x10(%rbx), %r9
movl (%r9,%r8,4), %r9d
shrl %cl, %r9d
testb $0x3, %r9b
je 0x19fe
movq 0x18(%rbx), %rcx
movq %rdi, %r8
shlq $0x20, %r8
orq %r8, %r11
movq %r11, (%rcx,%r10,8)
xorl %ecx, %ecx
testb %cl, %cl
jne 0x1964
jmp 0x193e
movq 0x18(%rbx), %r9
movq (%r9,%r10,8), %rsi
shlq $0x20, %rdi
orq %rdi, %r11
movq %r11, (%r9,%r10,8)
movq %rsi, %rdi
shrq $0x20, %rdi
movl $0x1, %r9d
shll %cl, %r9d
movq 0x10(%rbx), %rcx
orl %r9d, (%rcx,%r8,4)
movb $0x1, %cl
jmp 0x19f1
cmpl %r15d, %ecx
jbe 0x1a46
movq 0x18(%rbx), %rdi
movl %r15d, %esi
shlq $0x3, %rsi
callq 0x10c0
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rdi
callq 0x1070
movq %r14, 0x10(%rbx)
movl %r15d, (%rbx)
movl 0x4(%rbx), %eax
movl %eax, 0x8(%rbx)
movl %r12d, 0xc(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq