// File: 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:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movl %esi, 0x64(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x58(%rsp)
movl $0x1, 0x54(%rsp)
movl 0x64(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
shrl %eax
orl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
shrl $0x2, %eax
orl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
shrl $0x4, %eax
orl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
shrl $0x8, %eax
orl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
shrl $0x10, %eax
orl 0x64(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
cmpl $0x4, 0x64(%rsp)
jae 0x1c07
movl $0x4, 0x64(%rsp)
movq 0x18(%rsp), %rax
movl 0x4(%rax), %eax
movl 0x64(%rsp), %ecx
shrl %ecx
movl 0x64(%rsp), %edx
shrl $0x2, %edx
addl %edx, %ecx
cmpl %ecx, %eax
jb 0x1c2f
movl $0x0, 0x54(%rsp)
jmp 0x1d12
cmpl $0x10, 0x64(%rsp)
jae 0x1c41
movl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1c4c
movl 0x64(%rsp), %eax
shrl $0x4, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x1090
movq %rax, 0x58(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x1c77
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x1f80
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x10, 0x64(%rsp)
jae 0x1c93
movl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x1c9e
movl 0x64(%rsp), %eax
shrl $0x4, %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x2, %rdx
movl $0xaa, %esi
callq 0x1050
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl 0x64(%rsp), %eax
jae 0x1d10
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x64(%rsp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x10c0
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x1d02
movq 0x58(%rsp), %rdi
callq 0x1070
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x1f80
movq 0x18(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x1d12
cmpl $0x0, 0x54(%rsp)
je 0x1f78
movl $0x0, 0x54(%rsp)
movq 0x18(%rsp), %rcx
movl 0x54(%rsp), %eax
cmpl (%rcx), %eax
je 0x1f11
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x54(%rsp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl 0x54(%rsp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x1eff
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movl 0x54(%rsp), %edx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x40(%rsp)
movl 0x64(%rsp), %ecx
subl $0x1, %ecx
movl %ecx, 0x3c(%rsp)
movl 0x54(%rsp), %ecx
andl $0xf, %ecx
shll %ecx
movl %ecx, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movq 0x10(%rax), %rax
movl 0x54(%rsp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
orq %rsi, %rdx
movl %edx, (%rax,%rcx,4)
movl $0x0, 0x30(%rsp)
leaq 0x2f(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x1f90
movl %eax, 0x38(%rsp)
movl 0x38(%rsp), %eax
andl 0x3c(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl 0x34(%rsp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1e00
jmp 0x1e1b
movl 0x34(%rsp), %eax
movl 0x30(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, 0x30(%rsp)
addl %ecx, %eax
andl 0x3c(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x1dd3
movl 0x34(%rsp), %eax
andl $0xf, %eax
shll %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x2, %edi
shlq %cl, %rdi
movq 0x18(%rsp), %rcx
xorq $-0x1, %rdi
movq 0x58(%rsp), %rax
movl 0x34(%rsp), %edx
shrl $0x4, %edx
movl %edx, %edx
movl (%rax,%rdx,4), %esi
andq %rdi, %rsi
movl %esi, (%rax,%rdx,4)
movl 0x34(%rsp), %eax
cmpl (%rcx), %eax
jae 0x1ee0
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rax
movl 0x34(%rsp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl 0x34(%rsp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x1ee0
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rcx
movl 0x34(%rsp), %edx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x24(%rsp)
movq 0x18(%rax), %rcx
movl 0x34(%rsp), %edx
movq 0x40(%rsp), %rsi
movq %rsi, (%rcx,%rdx,8)
movq 0x24(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movl 0x34(%rsp), %ecx
andl $0xf, %ecx
shll %ecx
movl %ecx, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movq 0x10(%rax), %rax
movl 0x34(%rsp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edx
orq %rsi, %rdx
movl %edx, (%rax,%rcx,4)
jmp 0x1ef8
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x34(%rsp), %ecx
movq 0x40(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1efd
jmp 0x1dac
jmp 0x1eff
jmp 0x1f01
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x1d25
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl 0x64(%rsp), %eax
jbe 0x1f42
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x64(%rsp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x10c0
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1070
movq 0x18(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, 0x10(%rax)
movl 0x64(%rsp), %ecx
movl %ecx, (%rax)
movl 0x4(%rax), %ecx
movl %ecx, 0x8(%rax)
movl (%rax), %ecx
shrl %ecx
movl (%rax), %edx
shrl $0x2, %edx
addl %edx, %ecx
movl %ecx, 0xc(%rax)
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopl (%rax)