LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/array.h
// Function: array<string>::remove_range(unsigned long, unsigned long)
void remove_range(size_t start, size_t end)
	{
		for (size_t n=start;n<end;n++)
			this->items[n].~T();
		memmove((void*)(this->items+start), (void*)(this->items+end), sizeof(T)*(this->count-end));
		resize_shrink_noinit(this->count - (end-start));
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %r12
shlq $0x4, %r12
movq %rsi, %r13
movq (%r14), %rdi
cmpq %r15, %r13
jae 0xf3e3
addq %r12, %rdi
callq 0x56b4
incq %r13
addq $0x10, %r12
jmp 0xf3ca
movq %rbx, %rax
shlq $0x4, %rax
addq %rdi, %rax
movq %r15, %rsi
shlq $0x4, %rsi
addq %rdi, %rsi
movq 0x8(%r14), %rdx
subq %r15, %rdx
shlq $0x4, %rdx
movq %rax, %rdi
callq 0x3600
subq %r15, %rbx
addq 0x8(%r14), %rbx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf0e0
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/json.cpp
// Function: jsonparser::nextch()
uint8_t jsonparser::nextch()
{
again: ;
	uint8_t ret = *(m_data++);
	if (ret >= 33) return ret;
	if (LIKELY(isspace(ret))) goto again;
	if (m_data > m_data_end)
	{
		m_data--;
		return '\0';
	}
	return '\1'; // all pre-space non-whitespace is invalid, just pick one at random
}

// Assembly:
movq 0x10(%rdi), %rcx
leaq 0x19581(%rip), %rdx     # 0x28c90
movq %rcx, %rax
incq %rcx
movq %rcx, 0x10(%rdi)
movzbl (%rax), %eax
cmpq $0x20, %rax
ja 0xf739
cmpb $0x0, (%rdx,%rax)
js 0xf70f
movb $0x1, %al
cmpq 0x18(%rdi), %rcx
jbe 0xf739
decq %rcx
movq %rcx, 0x10(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/json.cpp
// Function: jsonparser::skipcomma(unsigned long)
bool jsonparser::skipcomma(size_t depth)
{
	uint8_t ch = nextch();
	if (ch == ',' || ch == '\0')
	{
		if ((m_nesting.size() >= depth) == (ch == '\0')) return false;
		if (m_nesting.get_or(m_nesting.size()-depth, false) == true)
			m_want_key = true;
		if (ch == ',')
			m_need_value = true;
		return true;
	}
	if (ch == ']' || ch == '}')
	{
		m_data--;
		return true;
	}
	return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0xf704
movl %eax, %ebp
cmpb $0x2c, %al
je 0xf757
movzbl %bpl, %eax
testl %eax, %eax
jne 0xf78c
testb %bpl, %bpl
sete %al
movq 0x30(%rbx), %rsi
subq %r14, %rsi
setb %cl
xorb %al, %cl
jne 0xf79e
leaq 0x28(%rbx), %rdi
xorl %edx, %edx
callq 0x559c
testb %al, %al
je 0xf77e
movb $0x1, 0x20(%rbx)
movb $0x1, %al
cmpb $0x2c, %bpl
jne 0xf7a0
movb $0x1, 0x21(%rbx)
jmp 0xf7a0
andb $-0x21, %bpl
cmpb $0x5d, %bpl
jne 0xf79e
decq 0x10(%rbx)
movb $0x1, %al
jmp 0xf7a0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/json.cpp
// Function: JSON::parse(string)
bool JSON::parse(string s)
{
	// it would not do to have some function changing the value of null for everybody else
	// this check is only needed here; all of JSON's other members are conceptually const, though most aren't marked as such
	if (this == &c_null)
		abort();
	
	m_chld_list.reset();
	m_chld_map.reset();
	
	jsonparser p(std::move(s));
	bool ok = true;
	jsonparser::event ev = p.next();
	construct(p, ev, &ok, 1000);
	
	ev = p.next();
	if (!ok || ev.action != jsonparser::finish)
	{
		m_action = jsonparser::error;
		return false;
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq 0x31098(%rip), %rax     # 0x41360
cmpq %rax, %rdi
je 0x1039d
movq %rsi, %r14
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x104f8
leaq 0x30(%rbx), %rdi
callq 0x10ed8
movups (%r14), %xmm0
leaq 0x10(%rsp), %r12
movaps %xmm0, (%r12)
movb $0xf, 0xf(%r14)
movb $0x0, (%r14)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x10500
movq %r12, %rdi
callq 0x56b4
leaq 0xf(%rsp), %r14
movb $0x1, (%r14)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xf7a6
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x100c2
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xf7a6
movq 0x10(%r13), %rax
movups (%r13), %xmm0
movaps %xmm0, (%r12)
cmpl $0xc, (%r12)
movq %rax, 0x10(%r12)
sete %bpl
andb (%r14), %bpl
jne 0x1037f
movl $0xb, (%rbx)
leaq 0x50(%rsp), %rdi
callq 0x10542
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3180
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/set.h
// Function: set<map<string, JSON>::node>::destruct()
void destruct()
	{
		for (size_t i=0;i<m_valid.size();i++)
		{
			if (m_valid[i])
			{
				m_data[i].~T();
			}
		}
		m_count = 0;
		m_used_slots = 0;
		free(m_data);
		m_valid.reset();
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x8(%rdi), %rbx
xorl %r12d, %r12d
movq %rsp, %r15
xorl %r13d, %r13d
cmpq 0x10(%r14), %r13
jae 0x1098c
movq %rbx, (%rsp)
movq %r13, 0x8(%rsp)
movq %r15, %rdi
callq 0x5624
testb %al, %al
je 0x10983
movq (%r14), %rdi
addq %r12, %rdi
callq 0x109b2
incq %r13
addq $0x68, %r12
jmp 0x1095d
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
movq (%r14), %rdi
callq 0x3430
movq %rbx, %rdi
callq 0x109c8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/set.h
// Function: map<string, JSON>::node& set<map<string, JSON>::node>::get_create<string>(string const&, bool)
T& get_create(const T2& item, bool known_new = false)
	{
		if (!m_data)
			rehash(m_valid.size());
		
		size_t pos = known_new ? -1 : find_pos_insert(item);
		
		if (pos == (size_t)-1 || !m_valid[pos])
		{
			grow();
			pos = find_pos_insert(item); // recalculate this, grow() may have moved it
			//do not move grow() earlier; it invalidates references, get_create(item_that_exists) is not allowed to do that
			
			if (tag(pos) == i_empty) m_used_slots++;
			new(&m_data[pos]) T(item);
			m_valid[pos] = true;
			m_count++;
		}
		
		return m_data[pos];
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x10af8
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x10b8c
testb %bpl, %bpl
jne 0x10b2a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d98
cmpq $-0x1, %rax
je 0x10b2a
movq %rax, %r15
leaq 0x8(%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movq %r15, 0x8(%rdi)
callq 0x5624
testb %al, %al
jne 0x10b79
movq %rbx, %rdi
callq 0x10c72
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10d98
movq %rax, %r15
movq (%rbx), %rax
imulq $0x68, %r15, %rcx
leaq (%rax,%rcx), %rdi
cmpb $0x0, (%rax,%rcx)
jne 0x10b55
incq 0x18(%rbx)
movq %r14, %rsi
callq 0x10ca0
leaq 0x8(%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movq %r15, 0x8(%rdi)
pushq $0x1
popq %rsi
callq 0x10cb6
incq 0x20(%rbx)
imulq $0x68, %r15, %rax
addq (%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/set.h
// Function: set<map<string, JSON>::node>::rehash(unsigned long)
void rehash(size_t newsize)
	{
		T* prev_data = m_data;
		bitarray prev_valid = std::move(m_valid);
		
		m_data = xcalloc(newsize, sizeof(T));
		static_assert(sizeof(T) >= 1); // otherwise the tags mess up (zero-size objects are useless in sets, 
		m_valid.reset();               // and I'm not sure if they're expressible in standard C++, but no reason not to check)
		m_valid.resize(newsize);
		
		for (size_t i=0;i<prev_valid.size();i++)
		{
			if (!prev_valid[i]) continue;
			
			size_t pos = find_pos_full<true, false>(prev_data[i]);
			//this is known to not overwrite any existing object; if it does, someone screwed up
			memcpy((void*)&m_data[pos], (void*)&prev_data[i], sizeof(T));
			m_valid[pos] = true;
		}
		free(prev_data);
		m_used_slots = m_count;
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
leaq 0x8(%rdi), %r15
movups 0x8(%rdi), %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x11600
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x109c8
movq %r15, %rdi
movq %r14, %rsi
callq 0x4498
xorl %ebp, %ebp
movq %rsp, %r13
movq %r12, 0x20(%rsp)
movq %r12, %r14
cmpq 0x18(%rsp), %rbp
jae 0x10c46
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, 0x8(%rsp)
movq %r13, %rdi
callq 0x5624
testb %al, %al
je 0x10c3d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10cce
movq %rax, %r12
imulq $0x68, %rax, %rdi
addq (%rbx), %rdi
movq %r14, %rsi
pushq $0x68
popq %rdx
callq 0x3280
movq %r15, (%rsp)
movq %r12, 0x8(%rsp)
movq %r13, %rdi
pushq $0x1
popq %rsi
callq 0x10cb6
incq %rbp
addq $0x68, %r14
jmp 0x10be8
movq 0x20(%rsp), %rdi
callq 0x3430
movq 0x20(%rbx), %rax
movq %rax, 0x18(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x470a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/set.h
// Function: unsigned long set<map<string, JSON>::node>::find_pos_full<true, true, string>(string const&) const
size_t find_pos_full(const T2& item) const
	{
		if (!m_data) return -1;
		
		size_t hashv = hash_shuffle(local_hash<T2>(item, 0));
		size_t i = 0;
		
		size_t emptyslot = -1;
		
		while (true)
		{
			//I could use hashv + i+(i+1)/2 <http://stackoverflow.com/a/15770445>
			//but due to hash_shuffle, it hurts as much as it helps.
			size_t pos = (hashv + i) & (m_valid.size()-1);
			if (want_used && m_valid[pos] && m_data[pos] == item)
				return pos;
			if (!m_valid[pos])
			{
				if (emptyslot == (size_t)-1) emptyslot = pos;
				if (tag(pos) == i_empty)
				{
					if (want_empty) return emptyslot;
					else return -1;
				}
			}
			i++;
//if(i > m_valid.size()) *(char*)1=1;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, (%rdi)
je 0x10e1f
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x10d7a
movq %rax, %rdi
callq 0x10d3f
movq %rax, %r12
leaq 0x8(%r14), %r13
pushq $-0x1
popq %r15
movq 0x10(%r14), %rbp
decq %rbp
andq %r12, %rbp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4682
testb %al, %al
je 0x10df6
imulq $0x68, %rbp, %rdi
addq (%r14), %rdi
movq %rbx, %rsi
callq 0x1550e
testb %al, %al
jne 0x10e25
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4682
testb %al, %al
jne 0x10e1a
cmpq $-0x1, %r15
cmoveq %rbp, %r15
movq (%r14), %rax
imulq $0x68, %rbp, %rcx
cmpb $0x0, (%rax,%rcx)
je 0x10e28
incq %r12
jmp 0x10dca
pushq $-0x1
popq %r15
jmp 0x10e28
movq %rbp, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/json.h
// Function: jsonwriter::comma()
void comma()
	{
		if (m_comma) m_data += ',';
		m_comma = true;
		
		if (UNLIKELY(m_indent_block == 0))
		{
			if (m_indent_is_value)
			{
				m_data += ' ';
				m_indent_is_value = false;
			}
			else if (m_indent_depth)
			{
				cstring indent_str = (&"        "[8-m_indent_size]);
				m_data += '\n';
				for (int i=0;i<m_indent_depth;i++)
				{
					m_data += indent_str;
				}
			}
		}
	}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x10(%rdi)
jne 0x110d0
pushq $0x2c
popq %rsi
movq %rbx, %rdi
callq 0x4354
movb $0x1, 0x10(%rbx)
cmpb $0x0, 0x12(%rbx)
je 0x110e1
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
cmpb $0x1, 0x11(%rbx)
jne 0x110f8
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x4354
movb $0x0, 0x11(%rbx)
jmp 0x110da
cmpl $0x0, 0x14(%rbx)
je 0x110da
movzbl 0x13(%rbx), %eax
leaq 0x1796c(%rip), %rsi     # 0x28a75
subq %rax, %rsi
addq $0x8, %rsi
leaq 0x8(%rsp), %rdi
callq 0x42ce
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x4354
xorl %ebp, %ebp
cmpl 0x14(%rbx), %ebp
jge 0x110da
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x4296
incl %ebp
jmp 0x11127
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/array.h
// Function: void arrayvieww<unsigned long>::ssort<arrayvieww<unsigned long>::sort()::'lambda'(unsigned long const&, unsigned long const&)>(arrayvieww<unsigned long>::sort()::'lambda'(unsigned long const&, unsigned long const&) const&)
void ssort(const Tless& less)
	{
		// insertion sort; not the fastest, but it's adaptive, it's simple, and its constant factors are good
		// no real point upgrading to something faster, stable sort is rare
		for (size_t a=1;a<this->count;a++)
		{
			if (!less(this->items[a], this->items[a-1]))
				continue;
			
			size_t probe = 1;
			while (probe < a && less(this->items[a], this->items[a-probe]))
				probe *= 2;
			
			size_t min = a-probe;
			probe /= 2;
			while (probe)
			{
				if (min+probe > a || !less(this->items[a], this->items[min+probe]))
					min += probe;
				probe /= 2;
			}
			
			if (min > a || !less(this->items[a], this->items[min]))
				min++;
			
			size_t newpos = min;
			
			char tmp[sizeof(T)];
			memcpy((void*)tmp, (void*)&this->items[a], sizeof(T));
			memmove((void*)&this->items[newpos+1], (void*)&this->items[newpos], sizeof(T)*(a-newpos));
			memcpy((void*)&this->items[newpos], tmp, sizeof(T));
		}
	}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %r14
movq %r14, %r15
cmpq 0x8(%rbx), %r15
jae 0x1459f
movq (%rbx), %rax
movq (%rax,%r15,8), %r12
cmpq -0x8(%rax,%r15,8), %r12
jae 0x1459a
movq %r14, %rcx
movq %r15, %rdx
subq %rcx, %rdx
jbe 0x1454d
cmpq (%rax,%rdx,8), %r12
jae 0x1454d
addq %rcx, %rcx
jmp 0x1453a
movq %rdx, %r13
cmpq $0x2, %rcx
jb 0x1456a
shrq %rcx
leaq (%rcx,%r13), %rdx
cmpq %r15, %rdx
ja 0x1454d
cmpq (%rax,%rdx,8), %r12
jb 0x14550
jmp 0x1454d
cmpq %r15, %r13
ja 0x14575
cmpq (%rax,%r13,8), %r12
jb 0x14578
incq %r13
leaq (%rax,%r13,8), %rsi
leaq (%rax,%r13,8), %rdi
addq $0x8, %rdi
movq %r15, %rdx
subq %r13, %rdx
shlq $0x3, %rdx
callq 0x3600
movq (%rbx), %rax
movq %r12, (%rax,%r13,8)
incq %r15
jmp 0x14523
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/memmem.cpp
// Function: memmem_arlib(void const*, unsigned long, void const*, unsigned long)
void* memmem_arlib(const void * haystack, size_t haystacklen, const void * needle, size_t needlelen)
{
	if (UNLIKELY(needlelen == 0)) return (void*)haystack;
	
	const void * hay_orig = haystack;
	haystack = memchr(haystack, *(uint8_t*)needle, haystacklen);
	if (!haystack) return NULL;
	if (needlelen == 1) return (void*)haystack;
	
	haystacklen -= (uint8_t*)haystack - (uint8_t*)hay_orig;
	if (UNLIKELY(needlelen > haystacklen)) return NULL;
	
#ifdef runtime__SSE4_2__
	// don't use this for needle length 16, both do one byte per iteration and _mm_cmpestri is slow
	if (needlelen <= 15 && runtime__SSE4_2__) return (void*)memmem_sse42((uint8_t*)haystack, haystacklen, (uint8_t*)needle, needlelen);
#endif
	
#if !defined(_WIN32) && !defined(ARLIB_TEST) // for long needles, use libc; we're roughly equally fast, and code reuse means smaller
	return memmem(haystack, haystacklen, needle, needlelen);
#endif
	
	return (void*)memmem_rollhash((uint8_t*)haystack, haystacklen, (uint8_t*)needle, needlelen);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rcx, %rcx
je 0x11437
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movzbl (%rdx), %esi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x33b0
testq %rax, %rax
je 0x11435
cmpq $0x1, %r14
jne 0x113fb
movq %rax, %rbx
jmp 0x11437
subq %rax, %rbx
addq %r12, %rbx
cmpq %r14, %rbx
jb 0x11435
cmpq $0xf, %r14
ja 0x11419
leaq 0x2fec1(%rip), %rcx     # 0x412d4
testb $0x10, 0x2(%rcx)
jne 0x11446
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3620
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1145f
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/memmem.cpp
// Function: memmem_sse42(unsigned char const*, unsigned long, unsigned char const*, unsigned long)
__attribute__((target("sse4.2")))
static const uint8_t * memmem_sse42(const uint8_t * haystack, size_t haystacklen, const uint8_t * needle, size_t needlelen)
{
	__m128i needle_sse = load_sse2_small_highundef(needle, needlelen);
	
	__m128i firstbyte = needle_sse;
	firstbyte = _mm_unpacklo_epi8(firstbyte, firstbyte); // duplicate bottom byte, ignore upper 14
	firstbyte = _mm_unpacklo_epi16(firstbyte, firstbyte); // duplicate bottom two bytes, ignore upper 12
	firstbyte = _mm_shuffle_epi32(firstbyte, _MM_SHUFFLE(0,0,0,0)); // and duplicate bottom four to all 16
	
	size_t step = 16+1-needlelen;
	
#define CMPSTR_FLAGS (_SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ORDERED|_SIDD_LEAST_SIGNIFICANT)
	while (haystacklen >= 16)
	{
		__m128i haystack_sse = _mm_loadu_si128((__m128i*)haystack);
		if (_mm_movemask_epi8(_mm_cmpeq_epi8(haystack_sse, firstbyte)) == 0)
		{
			// look for first byte first; if not found, skip cmpestri, it's slow
			haystack += 16;
			haystacklen -= 16;
			continue;
		}
		
		int pos = _mm_cmpestri(needle_sse, needlelen, haystack_sse, 16, CMPSTR_FLAGS);
		
		if (pos < (int)step)
			return haystack + pos;
		
		haystack += step; // using 'pos' instead reduces iteration count, but using 'step' is faster. cmpestri latency is high
		haystacklen -= step;
	}
	
	// load_sse2_small_highundef fails for len=0, but haystacklen is known >= 1
	// the only way for it to be 0 is if step=16, which means needlelen=1, but that returns after memchr
	__m128i haystack_sse = load_sse2_small_highundef(haystack, haystacklen);
	int pos = _mm_cmpestri(needle_sse, needlelen, haystack_sse, haystacklen, CMPSTR_FLAGS);
	if (pos < (int)(haystacklen+1-needlelen))
		return haystack + pos;
#undef CMPSTR_FLAGS
	
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r12
movaps %xmm0, (%r12)
movq %r12, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x3280
movdqa (%r12), %xmm3
movdqa %xmm3, %xmm0
pshufb 0x16ccf(%rip), %xmm0    # 0x28170
pushq $0x11
popq %rsi
subq %r15, %rsi
pushq $0x10
popq %rdx
cmpq $0x10, %r14
jb 0x114e3
movdqu (%rbx), %xmm1
movdqa %xmm1, %xmm2
pcmpeqb %xmm0, %xmm2
pmovmskb %xmm2, %eax
testl %eax, %eax
je 0x114d9
movl %r15d, %eax
pcmpestri $0xc, %xmm1, %xmm3
cmpl %esi, %ecx
jl 0x1152f
addq %rsi, %rbx
subq %rsi, %r14
jmp 0x114aa
addq $0x10, %rbx
addq $-0x10, %r14
jmp 0x114aa
pxor %xmm0, %xmm0
leaq 0x10(%rsp), %r12
movdqa %xmm0, (%r12)
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movdqa %xmm3, (%rsp)
callq 0x3280
movl %r15d, %eax
movl %r14d, %edx
movdqa (%rsp), %xmm0
pcmpestri $0xc, (%r12), %xmm0
subl %r15d, %r14d
incl %r14d
movslq %ecx, %rax
addq %rax, %rbx
xorl %ecx, %ecx
cmpl %r14d, %eax
cmovgeq %rcx, %rbx
jmp 0x11535
movslq %ecx, %rax
addq %rax, %rbx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/misc.cpp
// Function: hash(unsigned char const*, unsigned long)
size_t hash(const uint8_t * val, size_t n)
{
	// update staticmap.cpp if changing this
	
	size_t hash = 5381;
	while (n >= sizeof(size_t))
	{
		size_t tmp;
		memcpy(&tmp, val, sizeof(size_t));        // extra >>7 because otherwise bottom byte of output would
		hash = (hash^(hash>>7)^tmp) * 2546270801; //  only be affected by every 8th byte of input
		val += sizeof(size_t);                    // the number is just a random prime between 2^31 and 2^32
		n -= sizeof(size_t);
	}
	while (n)
	{
		hash = (hash ^ *val) * 31; // 31 is a quite common multiplier, don't know why
		val++;
		n--;
	}
	return hash;
}

// Assembly:
movl $0x1505, %eax           # imm = 0x1505
movl $0x97c50251, %ecx       # imm = 0x97C50251
cmpq $0x7, %rsi
jbe 0x1166e
movq %rax, %rdx
shrq $0x7, %rdx
xorq (%rdi), %rdx
xorq %rax, %rdx
imulq %rcx, %rdx
addq $0x8, %rdi
addq $-0x8, %rsi
movq %rdx, %rax
jmp 0x1164a
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x11685
movzbl (%rdi,%rcx), %edx
xorq %rdx, %rax
imulq $0x1f, %rax, %rax
incq %rcx
jmp 0x11670
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/misc.cpp
// Function: debugf64(double vector[2] const&)
void debugc8(const __m128i& vals)
{
	char inner[sizeof(__m128i)/sizeof(char)];
	memcpy(inner, &vals, sizeof(__m128i));
	for (size_t i : range(ARRAY_SIZE(inner)))
		printf("%c%c", inner[i], (i == ARRAY_SIZE(inner)-1 ? '\n' : ' '));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movaps (%rdi), %xmm0
movaps %xmm0, 0x10(%rsp)
movq %rsp, %rbx
pushq $0xa
popq %rbp
pushq $0x20
popq %r15
leaq 0x16c63(%rip), %r14     # 0x28a8f
xorl %r12d, %r12d
cmpq $0x2, %r12
je 0x11e73
movsd 0x10(%rsp,%r12,8), %xmm0
movq %rbx, %rdi
callq 0x16582
cmpb $0x0, 0xf(%rsp)
movq %rbx, %rsi
jns 0x11e52
movq (%rsp), %rsi
cmpq $0x1, %r12
movl %r15d, %edx
cmovel %ebp, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x3050
movq %rbx, %rdi
callq 0x56b4
incq %r12
jmp 0x11e2f
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/opengl/helpers.cpp
// Function: aropengl_base::create(aropengl_base::context*, char const*, void (**)())
bool aropengl_base::create(context* core, const char * symNames, funcptr* symDest)
{
	destroy();
	
	this->core = core;
#ifdef ARLIB_GUI
	this->port = NULL;
#endif
	if (!core) return false;
	
	while (*symNames)
	{
		*symDest = core->getProcAddress(symNames);
		//nulls here are fine, don't worry about them
		symDest++;
		symNames += strlen(symNames)+1;
	}
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
callq 0x12356
movq %r14, (%r12)
testq %r14, %r14
je 0x12343
cmpb $0x0, (%r15)
je 0x12343
movq (%r14), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %rax, (%rbx)
addq $0x8, %rbx
movq %r15, %rdi
callq 0x30f0
addq %rax, %r15
incq %r15
jmp 0x1231a
testq %r14, %r14
setne %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/random.cpp
// Function: random_base_t<false>::rand_mod(unsigned int)
uint32_t random_base_t<is_global>::rand_mod(uint32_t limit)
{
	// if RAND_MAX+1 is not a multiple of 'limit', rand() mod limit becomes biased towards lower values
	// to avoid that, find the highest multiple of limit <= RAND_MAX+1,
	// and if the returned value is higher than that, discard it and create a new one
	// alternatively and equivalently, that many values can be discarded from the lower end of the results
	// the size of the discarded section must be (RAND_MAX+1) mod limit, and discarding low ones is easier
	
	// unfortunately, RAND_MAX+1 is 2^32, which won't fit in a uint32
	// however, for a >= b, a%b equals (a-b)%b, and UINT32_MAX+1 is always greater than limit
	// the extra -1 +1 needed to avoid an overflow can also be avoided, by using how unsigned integer overflow is defined
	// so the calculation needed is simply
	uint32_t minvalid = -limit % limit;
	
	while (true)
	{
		uint32_t candidate = rand32();
		if (candidate < minvalid) continue;
		return candidate%limit;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
negl %eax
xorl %edx, %edx
divl %esi
movl %edx, %ebp
movq %r14, %rdi
callq 0x12370
cmpl %ebp, %eax
jb 0x1244b
xorl %edx, %edx
divl %ebx
movl %edx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/random.cpp
// Function: random_base_t<false>::rand_mod(unsigned long)
uint64_t random_base_t<is_global>::rand_mod(uint64_t limit)
{
	if (LIKELY(limit <= 0xFFFFFFFF)) return rand_mod((uint32_t)limit);
	uint64_t minvalid = -limit % limit;
	
	while (true)
	{
		uint64_t candidate = rand64();
		if (candidate < minvalid) continue;
		return candidate%limit;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rax
shrq $0x20, %rax
jne 0x12488
movq %r14, %rdi
movl %ebx, %esi
callq 0x12438
movl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rax
negq %rax
xorl %edx, %edx
divq %rbx
movq %rdx, %r15
movq %r14, %rdi
callq 0x12410
cmpq %r15, %rax
jb 0x12496
xorl %edx, %edx
divq %rbx
movq %rdx, %rax
jmp 0x12482
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/runloop-poll.cpp
// Function: runloop2::run(async<void>)
void run(async<void> event)
	{
		waiter<void, void> wait;
		event.then(&wait);
		auto& loop = get_loop();
		while (wait.is_waiting())
			loop.step(true);
	}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x681(%rip), %rax       # 0x12f2a
movq %rax, 0x8(%rsi)
callq 0x8abc
callq 0x12600
movq %rax, %rbx
pushq $0x1
popq %rbp
cmpq $0x0, 0x8(%rsp)
je 0x128d1
movq %rbx, %rdi
movl %ebp, %esi
callq 0x126aa
jmp 0x128bd
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/runloop-poll.cpp
// Function: (anonymous namespace)::runloop2_poll::fds_t::reallocate(unsigned long)
void reallocate(size_t newsize)
		{
#ifdef EXTRA_POLLFDS
			size_t cursize = max_used;
#else
			size_t cursize = waiting.size();
#endif
			waiting.resize(newsize);
			wait_fd.resize(newsize);
			for (size_t i=0;i<cursize;i++)
				waiting[i].prod.moved();
#ifndef EXTRA_POLLFDS
			for (size_t i=cursize;i<newsize;i++)
				wait_fd[i].fd = ~(i+1);
#endif
		}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %r12
cmpq %rsi, %r12
jae 0x12bf5
leaq -0x1(%r12), %rax
bsrq %rax, %rcx
pushq $0x2
popq %rax
shlq %cl, %rax
cmpq $0x8, %r12
pushq $0x8
popq %rcx
cmovaeq %rax, %rcx
cmpq %rbx, %rcx
setb %al
movq (%r14), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x12bc1
leaq -0x1(%rbx), %rax
bsrq %rax, %rcx
pushq $0x20
popq %rax
shlq %cl, %rax
cmpq $0x8, %rbx
movl $0x80, %esi
cmovaeq %rax, %rsi
callq 0x115b4
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
movq %r12, %rax
shlq $0x4, %rax
orq $0x8, %rax
leaq 0xcf(%rip), %rcx        # 0x12ca6
movq %r12, %rdx
cmpq %rbx, %rdx
jae 0x12c57
movq (%r14), %rsi
andq $0x0, -0x8(%rsi,%rax)
movq %rcx, (%rsi,%rax)
incq %rdx
addq $0x10, %rax
jmp 0x12bda
jbe 0x12c57
movq %rbx, %r15
shlq $0x4, %r15
movq %r12, %rax
movq %rbx, %r13
cmpq %rax, %r13
jae 0x12c21
movq (%r14), %rdi
addq %r15, %rdi
callq 0x12e30
incq %r13
movq 0x8(%r14), %rax
addq $0x10, %r15
jmp 0x12c04
cmpq %rbx, %rax
jbe 0x12c57
leaq -0x1(%rbx), %rcx
bsrq %rcx, %rcx
pushq $0x2
popq %rdx
shlq %cl, %rdx
cmpq $0x8, %rbx
pushq $0x8
popq %rsi
cmovaeq %rdx, %rsi
cmpq %rsi, %rax
jbe 0x12c53
movq (%r14), %rdi
shlq $0x4, %rsi
callq 0x115b4
movq %rax, (%r14)
movq %rbx, 0x8(%r14)
leaq 0x10(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x12d14
movq (%r14), %rax
movq %r12, %rcx
subq $0x1, %rcx
jb 0x12c83
movq (%rax), %rdx
testq %rdx, %rdx
je 0x12c7d
movq %rax, (%rdx)
addq $0x10, %rax
jmp 0x12c6c
movq (%r15), %rax
pushq $-0x2
popq %rcx
subl %r12d, %ecx
cmpq %rbx, %r12
jae 0x12c9c
movl %ecx, (%rax,%r12,8)
incq %r12
decl %ecx
jmp 0x12c8c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/runloop2.h
// Function: producer<void, (anonymous namespace)::runloop2_poll::fds_t::waiter_node::prod_t>::cancel_s(producer_base<void>*)
static void cancel_s(producer_base<T>* self)
	{
		if (self->wait)
			self->wait->prod = nullptr;
		self->wait = nullptr;
		if constexpr (!std::is_same_v<T2, void>)
		{
			static_assert(std::is_base_of_v<producer, T2>);
			((T2*)self)->cancel();
		}
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x12cb6
andq $0x0, (%rax)
andq $0x0, (%rbx)
callq 0x12600
subq (%rax), %rbx
movq %rbx, %rcx
sarq $0x4, %rcx
movl 0x20(%rax), %edx
notl %edx
movq 0x10(%rax), %rsi
sarq %rbx
movl %edx, (%rsi,%rbx)
movq %rcx, 0x20(%rax)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/array.h
// Function: fifo<std::__n4861::coroutine_handle<void>>::push(std::__n4861::coroutine_handle<void>)
void push(T item)
	{
		if (wr == capacity)
		{
			if (rd <= capacity/2)
			{
				if (capacity == 0)
					capacity = 8;
				else
					capacity *= 2;
				items = xrealloc(items, sizeof(T)*capacity);
			}
			for (size_t n=0;n<rd;n++)
				items[n].~T();
			memmove(items, items+rd, sizeof(T)*(wr-rd));
			wr -= rd;
			rd = 0;
		}
		new(&items[wr]) T(std::move(item));
		wr++;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdx
cmpq 0x8(%rdi), %rdx
jne 0x12eb8
movq (%rbx), %rdi
movq 0x10(%rbx), %rax
movq %rdx, %rcx
shrq %rcx
cmpq %rcx, %rax
ja 0x12e9b
leaq (%rdx,%rdx), %rax
testq %rdx, %rdx
pushq $0x8
popq %rsi
cmovneq %rax, %rsi
movq %rsi, 0x8(%rbx)
shlq $0x3, %rsi
callq 0x115b4
movq %rax, %rdi
movq %rax, (%rbx)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rdx
leaq (%rdi,%rax,8), %rsi
subq %rax, %rdx
shlq $0x3, %rdx
callq 0x3600
movq 0x18(%rbx), %rdx
subq 0x10(%rbx), %rdx
andq $0x0, 0x10(%rbx)
movq (%rbx), %rax
movq %r14, (%rax,%rdx,8)
incq %rdx
movq %rdx, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::open(cstrnul, bool)
bool staticmap::open(cstrnul fn, bool map_writable)
{
	if (!f.open(fn, (file2::mode)(file2::m_write | file2::m_exclusive))) return false;
	this->map_writable = map_writable;
	this->sector_size = f.sector_size();
	
	mmap = f.mmapw(map_writable);
	if (mmap.size() == 0)
		create();
	else if (rd64(off_header) == t_meta+off_r_objsize && rd64(off_r_sig) == sig_passive)
		{} // do nothing
	else if (rd64(off_header) == t_meta+off_r_objsize && rd64(off_r_sig) == sig_active)
	{
		if (mmap.size() <= 1024 || rd64(off_r_entries) == 0)
			create();
		else
			recover();
	}
	else
		f.close();
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdi, %r14
leaq 0x4(%rdi), %r15
pushq $0x9
popq %rcx
movq %r15, %rdi
callq 0x7dbc
movl %eax, %ebx
testb %al, %al
je 0x1302e
movb %bpl, 0x18(%r14)
movq %r15, %rdi
callq 0x13f14
movl %eax, 0x1c(%r14)
movzbl %bpl, %edx
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x13f36
leaq 0x8(%r14), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x13f4a
movq %r13, %rdi
callq 0x7ea0
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x1301c
movq (%r12), %rcx
cmpq $0x202, (%rcx)          # imm = 0x202
jne 0x13026
movq 0x8(%rcx), %rdx
movabsq $0x70616d736c7261, %rsi # imm = 0x70616D736C7261
cmpq %rsi, %rdx
je 0x1302e
movabsq $0x170616d736c7261, %rsi # imm = 0x170616D736C7261
cmpq %rsi, %rdx
jne 0x13026
cmpq $0x401, %rax            # imm = 0x401
jb 0x1301c
cmpq $0x0, 0x20(%rcx)
je 0x1301c
movq %r14, %rdi
callq 0x13154
jmp 0x1302e
movq %r14, %rdi
callq 0x13040
jmp 0x1302e
movq %r15, %rdi
callq 0x803e
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::create()
void staticmap::create()
{
	mmap = nullptr;
	uint8_t buf[off_r_objsize + 512];
	
	writeu_le64(buf+off_header, off_r_objsize+t_meta);
	writeu_le64(buf+off_r_sig, sig_active);
	writeu_le64(buf+off_r_hm_ptr, 512); // hashmap pointer
	writeu_le64(buf+off_r_hm_load, 0); // number of used hashmap slots
	writeu_le64(buf+off_r_entries, 0); // number of object members
	for (int i=5;i<=9;i++) writeu_le64(buf+off_r_freespace(i), 0); // no freespaces of size 32 to 512
	for (int i=10;i<=15;i++) writeu_le64(buf+off_r_freespace(i), 1<<i); // have freespaces of size 1024 to 32768
	for (int i=16;i<=63;i++) writeu_le64(buf+off_r_freespace(i), 1); // no freespaces of size 65536 to 9223372036854775808
	
	writeu_le64(buf+512, 512+t_meta); // hashmap header
	for (int i=2;i<=63;i++) writeu_le64(buf+512+i*8, 0); // fill the hashmap
	f.pwrite(0, buf);
	
	f.resize(65536, mmap, map_writable);
	
	for (int i=10;i<=15;i++)
		wr64(1<<i, (1<<i)+t_free, 0, off_r_freespace(i)); // header, next_obj, prev_ptr
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x7ea0
movq $0x202, (%rsp)          # imm = 0x202
movabsq $0x170616d736c7261, %rax # imm = 0x170616D736C7261
movq %rax, 0x8(%rsp)
movq $0x200, 0x10(%rsp)      # imm = 0x200
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
pushq $0x5
popq %rax
cmpq $0xa, %rax
je 0x13099
andq $0x0, (%rsp,%rax,8)
incq %rax
jmp 0x13089
pushq $0xa
popq %rcx
pushq $0x1
popq %r12
cmpq $0x10, %rcx
je 0x130b4
movl %r12d, %eax
shll %cl, %eax
movq %rax, (%rsp,%rcx,8)
incq %rcx
jmp 0x130a0
pushq $0x10
popq %rax
cmpq $0x40, %rax
je 0x130ca
movq $0x1, (%rsp,%rax,8)
incq %rax
jmp 0x130b7
movq $0x202, 0x200(%rsp) # imm = 0x202
pushq $0x42
popq %rax
cmpq $0x80, %rax
je 0x130eb
andq $0x0, (%rsp,%rax,8)
incq %rax
jmp 0x130d9
leaq 0x4(%rbx), %r15
movq %rsp, %rdx
movl $0x400, %ecx            # imm = 0x400
movq %r15, %rdi
xorl %esi, %esi
callq 0x13f72
movzbl 0x18(%rbx), %ecx
movl $0x10000, %esi          # imm = 0x10000
movq %r15, %rdi
movq %r14, %rdx
callq 0x865a
pushq $0x50
popq %r14
pushq $0xa
popq %rbp
cmpq $0x80, %r14
je 0x13144
movl %r12d, %edx
movl %ebp, %ecx
shll %cl, %edx
movq %rbx, %rdi
movq %rdx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x13f92
addq $0x8, %r14
incl %ebp
jmp 0x1311c
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::free(unsigned long)
void staticmap::free(uint64_t addr)
{
//printf("free %lu\n", addr);
	uint64_t size = rd64(addr+off_header) & ~t_typemask;
again:
	uint64_t other = addr ^ size;
	if (rd64(other+off_header) == size + t_free)
	{
		uint64_t next_obj = rd64(other+off_f_nextobj);
		f.pwrite(rd64(other+off_f_prevptr), mmap.slice(other+off_f_nextobj, 8));  // *(other.prev_ptr) = other.next_obj;
		if (next_obj)                                                             // if (other.next_obj)
			f.pwrite(next_obj+off_f_prevptr, mmap.slice(other+off_f_prevptr, 8)); //   other.next_obj->prev_ptr = other.prev_ptr;
		
		addr &= ~size;
		size *= 2;
		goto again;
	}
	
	uint64_t bucket_pos = off_r_freespace(ilog2(size));
	// bucket_pos can be 1 if the freed space is combined with a sibling, such that the entire right half of the file is now free
	uint64_t prev_free = rd64(bucket_pos) & ~1;
	if (prev_free > 1)
		wr64(prev_free+off_f_prevptr, addr+off_f_nextobj);
	wr64(addr, size+t_free, prev_free, bucket_pos);
	wr64(bucket_pos, addr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rcx
movq 0x8(%rdi), %rax
movq (%rax,%rsi), %r15
andq $-0x10, %r15
leaq 0x4(%rdi), %rbx
pushq $0x8
popq %r14
movq %rcx, %rbp
xorq %r15, %rbp
cmpq %r15, (%rax,%rbp)
jne 0x1341f
movq %rcx, (%rsp)
leaq (%rax,%rbp), %rdx
addq $0x8, %rdx
movq 0x8(%rax,%rbp), %r13
movq 0x10(%rax,%rbp), %rsi
movq %rdi, %r12
movq %rbx, %rdi
movq %r14, %rcx
callq 0x13f72
testq %r13, %r13
je 0x13405
addq $0x10, %rbp
addq $0x10, %r13
addq 0x8(%r12), %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x13f72
movq %r15, %rax
notq %rax
movq (%rsp), %rcx
andq %rax, %rcx
addq %r15, %r15
movq 0x8(%r12), %rax
movq %r12, %rdi
jmp 0x133b2
bsrq %r15, %r12
xorl $0x3f, %r12d
shll $0x3, %r12d
xorq $0x1f8, %r12            # imm = 0x1F8
movq (%rax,%r12), %rax
movq %rax, %r13
andq $-0x2, %r13
cmpq $0x2, %rax
jb 0x1345c
leaq 0x10(%r13), %rsi
movq %rcx, %rbx
leaq 0x8(%rcx), %rdx
movq %rdi, %r14
callq 0x13fc2
movq %rbx, %rcx
movq %r14, %rdi
movq %rdi, %r14
movq %rcx, %rsi
movq %rcx, %rbx
movq %r15, %rdx
movq %r13, %rcx
movq %r12, %r8
callq 0x13fe2
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13fc2
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::alloc(unsigned long)
uint64_t staticmap::alloc(size_t bytes)
{
//printf("alloc %lu", bytes);
	uint64_t wanted_bucket = ilog2(bytes);
	
	uint64_t current_bucket = wanted_bucket;
	
again:
	uint64_t ptr = rd64(off_r_freespace(current_bucket));
	if (ptr > 1)
	{
		{
			// remove from freelist
			uint64_t next_free = rd64(ptr+off_f_nextobj);
			if (next_free)
				wr64(next_free+off_f_prevptr, off_r_freespace(current_bucket));
			wr64(off_r_freespace(current_bucket), next_free);
		}
		
	split:
		// split it, add new freespaces to their respective buckets
		uint64_t split = wanted_bucket;
		while (split < current_bucket)
		{
			uint64_t ptr_new_free = ptr+(1<<split);
			uint64_t prev_obj = rd64(off_r_freespace(split));
			if (prev_obj == 1)
			{
				for (uint64_t n=split;rd64(off_r_freespace(split))==1;n--)
					wr64(off_r_freespace(split), 0);
				prev_obj = 0;
			}
			if (prev_obj) // if freelist[n]
				wr64(rd64(off_r_freespace(split))+off_f_prevptr, ptr_new_free+off_f_nextobj); // set freelist[n]->prev to new object
			wr64(ptr_new_free, (1<<split)+t_free, prev_obj, off_r_freespace(split)); // create object
			wr64(off_r_freespace(split), ptr_new_free); // add to freelist
			split++;
		}
		// TODO: batch up writes to freelist
		
//printf(" -> %lu\n", ptr);
		return ptr;
	}
	else if (ptr == 0)
	{
		current_bucket++;
		goto again;
	}
	else // else equals 1, every future bucket is empty
	{
		current_bucket = ilog2(mmap.size());
		ptr = mmap.size();
		f.resize(mmap.size()*2, mmap, map_writable);
		goto split;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
bsrq %rsi, %r14
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
movq 0x8(%rdi), %rax
movq %r14, %r13
movq (%rax,%r13,8), %rbp
cmpq $0x2, %rbp
jae 0x134c8
testq %rbp, %rbp
jne 0x134fa
incq %r13
jmp 0x134b4
leaq (,%r13,8), %r15
movq 0x8(%rax,%rbp), %r12
testq %r12, %r12
je 0x134ea
leaq 0x10(%r12), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x13fc2
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x13fc2
jmp 0x1351b
movq 0x10(%rbx), %rbp
bsrq %rbp, %r13
leaq 0x4(%rbx), %rdi
leaq (,%rbp,2), %rsi
movzbl 0x18(%rbx), %ecx
movq (%rsp), %rdx
callq 0x865a
movq %r13, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
cmpq %r13, %r14
jae 0x135c0
pushq $0x1
popq %rax
movl %r14d, %ecx
shll %cl, %eax
movslq %eax, %r15
leaq (%r15,%rbp), %r13
leaq (,%r14,8), %rbp
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %r12
testq %r12, %r12
je 0x1358c
cmpq $0x1, %r12
je 0x13583
leaq 0x10(%r12), %rsi
leaq 0x8(%r13), %rdx
movq %rbx, %rdi
callq 0x13fc2
jmp 0x1358c
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x14010
movq 0x8(%rbx), %rax
movq (%rax,%rbp), %r12
cmpq $0x1, %r12
je 0x1356e
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %rbp, %r8
callq 0x14030
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x13fc2
incq %r14
movq 0x10(%rsp), %r13
movq 0x8(%rsp), %rbp
jmp 0x13525
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::hashmap_locate(unsigned long, arrayview<unsigned char>)
uint64_t staticmap::hashmap_locate(uint64_t hash, bytesr key)
{
	uint64_t ret = 0;
	uint64_t hashmap_pos = rd64(off_r_hm_ptr);
	uint64_t hashmap_size = rd64(hashmap_pos+off_header) & ~t_typemask;
	
	// ignore bottom 4 bits of hash
	uint64_t off = hash & (hashmap_size-off_h_nodesize);
	while (true)
	{
		if (off == 0)
			off = off_h_nodesize;
		uint64_t node_addr = rd64(hashmap_pos+off+off_h_ptr);
		uint64_t node_hash = rd64(hashmap_pos+off+off_h_hash);
		if (node_addr <= 1)
		{
			if (ret == 0)
				ret = hashmap_pos+off;
			if (node_addr == 0)
				return ret;
		}
		if (node_addr > 1 && node_hash == hash)
		{
			bytesr node_key = mmap.slice(node_addr+off_d_keystart, rd64(node_addr+off_d_keysz));
			if (key == node_key)
				return hashmap_pos+off;
		}
		off = (off+off_h_nodesize) & (hashmap_size-off_h_nodesize);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x18(%rsp), %rax
movq %rdx, (%rax)
movq %rcx, 0x8(%rax)
movq %rdi, 0x8(%rsp)
movq 0x8(%rdi), %rax
movq 0x10(%rax), %r15
movq (%rax,%r15), %r14
andq $-0x10, %r14
addq $-0x10, %r14
movq %r14, %rbp
andq %rsi, %rbp
xorl %ebx, %ebx
pushq $0x10
popq %r13
movq %rsi, 0x10(%rsp)
testq %rbp, %rbp
cmoveq %r13, %rbp
leaq (%r15,%rbp), %r12
movq (%rax,%r12), %rcx
cmpq $0x1, %rcx
ja 0x1363c
testq %rbx, %rbx
cmovneq %rbx, %r12
movq %r12, %rbx
testq %rcx, %rcx
jne 0x1366b
jmp 0x13674
cmpq %rsi, 0x8(%rax,%r12)
jne 0x1366b
leaq (%rax,%rcx), %rsi
addq $0x18, %rsi
movq -0x10(%rsi), %rdx
leaq 0x18(%rsp), %rdi
callq 0x4338
movq 0x10(%rsp), %rsi
testb %al, %al
jne 0x13674
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
addq $0x10, %rbp
andq %r14, %rbp
jmp 0x13616
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::rehash_if_needed()
void staticmap::rehash_if_needed()
{
	uint64_t hashmap_pos = rd64(off_r_hm_ptr);
	uint64_t hashmap_size = rd64(hashmap_pos+off_header) & ~t_typemask;
	
	uint64_t new_num_nodes;
	if (rd64(off_r_entries) > hashmap_size/off_h_nodesize/2)
		new_num_nodes = hashmap_size/off_h_nodesize*2;
	else if (rd64(off_r_hm_load) > hashmap_size/off_h_nodesize*3/4)
		new_num_nodes = hashmap_size/off_h_nodesize;
	else return;
	
	bytearray new_map_buf;
	new_map_buf.resize(new_num_nodes * off_h_nodesize);
	
	uint8_t* new_map = new_map_buf.ptr();
	wr64(new_map, new_num_nodes*off_h_nodesize+t_meta);
	
	for (uint64_t src_off=16;src_off<hashmap_size;src_off+=16)
	{
		uint64_t node_addr = rd64(hashmap_pos+src_off+off_h_ptr);
		uint64_t node_hash = rd64(hashmap_pos+src_off+off_h_hash);
		if (node_addr <= 1) continue;
		
		uint64_t dst_off = node_hash & (new_map_buf.size()-off_h_nodesize);
		while (readu_le64(new_map+dst_off+off_h_ptr) != 0) // this reads the object header if dst_off = 0; this is fine, it's nonzero
			dst_off = (dst_off+off_h_nodesize) & (new_map_buf.size()-off_h_nodesize);
		wr64(new_map+dst_off, node_addr, node_hash);
	}
	
	if (hashmap_size == new_map_buf.size())
	{
		f.pwrite(hashmap_pos, new_map_buf);
		wr64(off_r_hm_load, rd64(off_r_entries));
	}
	else
	{
		uint64_t new_pos = alloc(new_map_buf.size());
		f.pwrite(new_pos, new_map_buf);
		wr64(off_r_hm_ptr, new_pos, rd64(off_r_entries));
		free(hashmap_pos);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x10(%rax), %r14
movq (%rax,%r14), %r15
movq %r15, %r12
shrq $0x4, %r12
movq %r15, %rcx
shrq $0x5, %rcx
cmpq %rcx, 0x20(%rax)
jbe 0x136bb
addq %r12, %r12
jmp 0x136cd
leaq (%r12,%r12,2), %rcx
shrq $0x2, %rcx
cmpq %rcx, 0x18(%rax)
jbe 0x137bc
andq $-0x10, %r15
xorps %xmm0, %xmm0
movq %rsp, %r13
movaps %xmm0, (%r13)
shlq $0x4, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0xbaee
movq (%r13), %rax
orq $0x2, %r12
movq %r12, (%rax)
pushq $0x10
popq %rcx
cmpq %r15, %rcx
jae 0x13740
movq 0x8(%rbx), %rsi
addq %rcx, %rsi
movq (%r14,%rsi), %rdx
cmpq $0x2, %rdx
jb 0x1373a
movq 0x8(%r14,%rsi), %rsi
movq 0x8(%rsp), %rdi
addq $-0x10, %rdi
movq %rsi, %r9
movq %r9, %r8
andq %rdi, %r8
leaq 0x10(%r8), %r9
cmpq $0x0, (%rax,%r8)
jne 0x13720
movq %rdx, (%rax,%r8)
movq %rsi, 0x8(%rax,%r8)
addq $0x10, %rcx
jmp 0x136f9
movq 0x8(%rsp), %rsi
cmpq %rsi, %r15
jne 0x13772
leaq 0x4(%rbx), %rdi
movq (%rsp), %rdx
movq %r14, %rsi
movq %r15, %rcx
callq 0x13f72
movq 0x8(%rbx), %rax
movq 0x20(%rax), %rdx
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x13fc2
jmp 0x137b3
movq %rbx, %rdi
callq 0x13490
movq %rax, %r15
leaq 0x4(%rbx), %rdi
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %rax, %rsi
callq 0x13f72
movq 0x8(%rbx), %rax
movq 0x20(%rax), %rcx
pushq $0x10
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1405e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13390
movq (%rsp), %rdi
callq 0x3430
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::get_or_empty(arrayview<unsigned char>, bool*)
bytesw staticmap::get_or_empty(bytesr key, bool* found)
{
//puts("GET "+tostringhex(key));
	uint64_t hash = sm_hash(key);
	uint64_t hashmap_pos = hashmap_locate(hash, key);
	
	uint64_t ptr = rd64(hashmap_pos+off_h_ptr);
	if (found)
		*found = (ptr > 1);
	if (ptr > 1)
		return mmap.slice(ptr+off_d_keystart+key.size(), rd64(ptr+off_d_valsz));
	return {};
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq %rdx, %rdi
movq %rcx, %rsi
callq 0x13380
movq %r13, %rdi
movq %rax, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x135d2
movq 0x8(%r13), %rcx
movq (%rcx,%rax), %rax
testq %r15, %r15
je 0x13813
cmpq $0x2, %rax
setae (%r15)
cmpq $0x2, %rax
jb 0x13833
leaq (%rcx,%rax), %rdx
movq 0x10(%rcx,%rax), %rax
leaq (%r14,%rdx), %rcx
addq $0x18, %rcx
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x13839
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::remove(arrayview<unsigned char>)
void staticmap::remove(bytesr key)
{
//puts("REMOVE "+tostringhex(key));
	desync();
	
	uint64_t hash = sm_hash(key);
	uint64_t hashmap_pos = hashmap_locate(hash, key);
	
	uint64_t ptr = rd64(hashmap_pos+off_h_ptr);
	if (ptr > 1)
	{
		free(ptr);
		wr64(hashmap_pos+off_h_ptr, 1);
		wr64(off_r_entries, rd64(off_r_entries)-1);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x13a4e
movq %r15, %rdi
movq %r14, %rsi
callq 0x13380
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x135d2
movq %rax, %r14
movq 0x8(%rbx), %rax
movq (%rax,%r14), %rsi
cmpq $0x2, %rsi
jb 0x13ae7
movq %rbx, %rdi
callq 0x13390
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14010
movq 0x8(%rbx), %rax
movq 0x20(%rax), %rdx
decq %rdx
pushq $0x20
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x13fc2
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::sync()
void staticmap::sync()
{
	if (!*synced)
	{
		f.pwrite(off_r_sigactive, synced);
		f.sync();
	}
	*synced = true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x19(%rdi), %rbx
cmpb $0x0, 0x19(%rdi)
jne 0x13b34
movq %rdi, %r14
addq $0x4, %r14
pushq $0xf
popq %rsi
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x13f72
movq %r14, %rdi
callq 0x140a6
movb $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::iterator::operator*()
staticmap::node staticmap::iterator::operator*()
{
	it = next(it, nullptr);
	uint64_t keylen = readu_le64(it+off_d_keysz);
	uint64_t vallen = readu_le64(it+off_d_valsz);
	return { bytesr(it+off_d_keystart, keylen), bytesw(it+off_d_keystart+keylen, vallen) };
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rdi
xorl %esi, %esi
callq 0x13b40
movq %rax, (%rbx)
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rdx
leaq 0x18(%rax), %rsi
movq %rsi, (%r14)
movq %rcx, 0x8(%r14)
leaq 0x18(%rax,%rcx), %rax
movq %rax, 0x10(%r14)
movq %rdx, 0x18(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/Alcaro[P]bridges/arlib/staticmap.cpp
// Function: staticmap::iterator::operator!=(staticmap::iterator const&)
bool staticmap::iterator::operator!=(const iterator& other)
{
	uint8_t* a = it;
	uint8_t* b = other.it;
	if (it < other.it) a = next(a, b);
	else b = next(b, a);
	return (a != b);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %rbx
movq (%rsi), %r14
cmpq %r14, %rbx
jae 0x13be5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13b40
movq %rax, %rbx
jmp 0x13bf3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x13b40
movq %rax, %r14
cmpq %r14, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop