LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/simple_sparsehash.c
// Function: sparse_dict_free
int sparse_dict_free(struct sparse_dict *dict) {
	unsigned int i = 0;
	for (i = 0; i < dict->bucket_max; i++) {
		size_t current_value_siz = 0;
		const void *current_value = sparse_array_get(dict->buckets, i, &current_value_siz);

		if (current_value_siz != 0 && current_value != NULL) {
			struct sparse_bucket *existing_bucket = (struct sparse_bucket *)current_value;
			free(existing_bucket->val);
		}
	}
	sparse_array_free(dict->buckets);
	free(dict);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x4496
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0xc(%rbp), %esi
leaq -0x18(%rbp), %rdx
callq 0x3460
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x4489
cmpq $0x0, -0x20(%rbp)
je 0x4489
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3050
jmp 0x448b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x443a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3250
movq -0x8(%rbp), %rdi
callq 0x3050
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/simple_sparsehash.c
// Function: position_to_offset
static uint32_t position_to_offset(const uint32_t *bitmap,
									   const uint32_t position) {
	uint32_t retval = 0;
	uint32_t pos = position;
	uint32_t bitmap_iter = 0;

	/* Here we loop through the bitmap a uint32_t at a time, and count the number
	 * of 1s in that chunk.
	 */
	for (; pos >= BITCHUNK_SIZE; pos -= BITCHUNK_SIZE)
		retval += popcount_32(bitmap[bitmap_iter++]);

	/* This last bit does the same thing as above, but takes care of the
	 * remainder that didn't fit cleanly into the 32 x 32 x 32 ... loop above. That
	 * is to say, it grabs the last 0 - 7 bits and adds the number of 1s in it to
	 * retval.
	 */
	return retval + popcount_32(bitmap[bitmap_iter] & (((uint32_t)1 << pos) - 1u));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x14(%rbp), %eax
cmpq $0x20, %rax
jb 0x4517
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movl %ecx, %ecx
movl (%rax,%rcx,4), %edi
callq 0x45f0
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
subq $0x20, %rax
movl %eax, -0x14(%rbp)
jmp 0x44e3
movl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movl (%rax,%rcx,4), %edi
movl -0x14(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
andl %eax, %edi
callq 0x45f0
movl %eax, %ecx
movl -0x1c(%rbp), %eax
addl %ecx, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/simple_sparsehash.c
// Function: popcount_32
static inline uint32_t popcount_32(uint32_t x) {
	const uint32_t m1 = 0x55555555;
	const uint32_t m2 = 0x33333333;
	const uint32_t m4 = 0x0f0f0f0f;
	x -= (x >> 1) & m1;
	x = (x & m2) + ((x >> 2) & m2);
	x = (x + (x >> 4)) & m4;
	x += x >>  8;
	return (x + (x >> 16)) & 0x3f;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl $0x55555555, -0x8(%rbp) # imm = 0x55555555
movl $0x33333333, -0xc(%rbp) # imm = 0x33333333
movl $0xf0f0f0f, -0x10(%rbp) # imm = 0xF0F0F0F
movl -0x4(%rbp), %ecx
shrl %ecx
andl $0x55555555, %ecx       # imm = 0x55555555
movl -0x4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0x33333333, %eax       # imm = 0x33333333
movl -0x4(%rbp), %ecx
shrl $0x2, %ecx
andl $0x33333333, %ecx       # imm = 0x33333333
addl %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl -0x4(%rbp), %ecx
shrl $0x4, %ecx
addl %ecx, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0x8, %eax
addl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl -0x4(%rbp), %ecx
shrl $0x10, %ecx
addl %ecx, %eax
andl $0x3f, %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: m38_url_decode
int m38_url_decode(const char *s, char *dec) {
	char *o;
	const char *end = s + strlen(s);
	int c;

	for (o = dec; s <= end; o++) {
		c = *s++;
		if (c == '+') c = ' ';
		else if (c == '%' && (!_ishex(*s++) ||
					!_ishex(*s++) ||
					!sscanf(s - 2, "%2x", &c)))
			return -1;

		if (dec) {
			*o = c;
		}
	}

	return o - dec;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3140
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x28(%rbp), %rax
ja 0x4796
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x2b, -0x2c(%rbp)
jne 0x4709
movl $0x20, -0x2c(%rbp)
jmp 0x4771
cmpl $0x25, -0x2c(%rbp)
jne 0x476f
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %edi
callq 0x47b0
cmpl $0x0, %eax
je 0x4766
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %edi
callq 0x47b0
cmpl $0x0, %eax
je 0x4766
movq -0x10(%rbp), %rdi
addq $-0x2, %rdi
leaq 0x78ea(%rip), %rsi      # 0xc040
leaq -0x2c(%rbp), %rdx
movb $0x0, %al
callq 0x3410
cmpl $0x0, %eax
jne 0x476f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x47a4
jmp 0x4771
cmpq $0x0, -0x18(%rbp)
je 0x4783
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
jmp 0x4785
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x46d7
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: endswith
int endswith(const char *string, const char *suffix) {
	size_t string_siz = strlen(string);
	size_t suffix_siz = strlen(suffix);

	if (string_siz < suffix_siz)
		return 0;

	unsigned int i = 0;
	for (; i < suffix_siz; i++) {
		if (suffix[i] != string[string_siz - suffix_siz + i])
			return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3140
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3140
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x483d
movl $0x0, -0x4(%rbp)
jmp 0x488f
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x4888
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
subq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %esi
addq %rsi, %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x487b
movl $0x0, -0x4(%rbp)
jmp 0x488f
jmp 0x487d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4844
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: strnstr
char *strnstr(const char *haystack, const char *needle, size_t len) {
	int i;
	size_t needle_len;

	/* segfault here if needle is not NULL terminated */
	if (0 == (needle_len = strlen(needle)))
		return (char *)haystack;

	/* Limit the search if haystack is shorter than 'len' */
	len = strnlen(haystack, len);

	for (i=0; i<(int)(len-needle_len); i++)
	{
		if ((haystack[0] == needle[0]) && (0 == strncmp(haystack, needle, needle_len)))
			return (char *)haystack;

		haystack++;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3140
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x48d5
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4950
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3260
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
subq -0x30(%rbp), %rcx
cmpl %ecx, %eax
jge 0x4948
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movq -0x18(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x4931
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x30b0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x4931
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4950
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48ed
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: get_file_creation_date
time_t get_file_creation_date(const char *file_path) {
	struct stat st = {0};
	if (stat(file_path, &st) == -1)
		return 0;
	return st.st_mtime;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x90, %edx
callq 0x3240
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3350
cmpl $-0x1, %eax
jne 0x49a1
movq $0x0, -0x8(%rbp)
jmp 0x49a9
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: get_file_size
size_t get_file_size(const char *file_path) {
	struct stat st = {0};
	if (stat(file_path, &st) == -1)
		return 0;
	return st.st_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x90, %edx
callq 0x3240
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3350
cmpl $-0x1, %eax
jne 0x4a01
movq $0x0, -0x8(%rbp)
jmp 0x4a09
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: hash_string_fnv1a
int hash_string_fnv1a(const unsigned char *key, const size_t siz, char outbuf[static HASH_STR_SIZE]) {
	/* https://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash */
	const uint64_t fnv_prime = 1099511628211ULL;
	const uint64_t fnv_offset_bias = 14695981039346656037ULL;

	const int iterations = siz;

	uint8_t i;
	uint64_t hash = fnv_offset_bias;

	for(i = 0; i < iterations; i++) {
		hash = hash ^ key[i];
		hash = hash * fnv_prime;
	}

	sprintf(outbuf, "%"PRIX64, hash);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movabsq $0x100000001b3, %rax    # imm = 0x100000001B3
movq %rax, -0x20(%rbp)
movabsq $-0x340d631b7bdddcdb, %rax # imm = 0xCBF29CE484222325
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl %eax, -0x2c(%rbp)
movabsq $-0x340d631b7bdddcdb, %rax # imm = 0xCBF29CE484222325
movq %rax, -0x38(%rbp)
movb $0x0, -0x2d(%rbp)
movzbl -0x2d(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x4aa6
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
movzbl -0x2d(%rbp), %edx
movzbl (%rcx,%rdx), %ecx
xorq %rcx, %rax
movq %rax, -0x38(%rbp)
movabsq $0x100000001b3, %rax    # imm = 0x100000001B3
imulq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movb -0x2d(%rbp), %al
addb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x4a69
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x758f(%rip), %rsi      # 0xc044
movb $0x0, %al
callq 0x35a0
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/utils.c
// Function: m38_get_cookie_value
char *m38_get_cookie_value(const char *cookie_string, const size_t cookie_string_siz, const char *needle) {
	/* TODO: Make sure this function handles bad input. */
	if (!cookie_string)
			return NULL;

	const char *cookie_loc = strnstr(cookie_string, needle, cookie_string_siz);
	if (!cookie_loc)
			return NULL;

	const char *cookie_string_start = cookie_loc;
	const char *cookie_string_end = strnstr(cookie_loc, ";", cookie_string_siz - (cookie_loc - cookie_string));
	if (!cookie_string_end) {
			/* This is okay, it might be at the end of the cookie. */
			cookie_string_end = strnstr(cookie_loc, " ", cookie_string_siz - (cookie_loc - cookie_string));
			if (!cookie_string_end)
					cookie_string_end = cookie_loc + cookie_string_siz;
	}

	const size_t cookie_string_size = cookie_string_end - cookie_string_start;
	const char *cookie_string_value = strnstr(cookie_loc, "=", cookie_string_size);
	if (!cookie_string_value)
			return NULL;

	/* -1 here is for the '=': */
	const size_t cookie_string_value_size = cookie_string_end - cookie_string_value;
	char *data = calloc(sizeof(char), cookie_string_value_size + 2); /* Plus two here: One for =, one for NULL */
	data[cookie_string_value_size] = '\0';
	strncpy(data, cookie_string_value + 1, cookie_string_value_size);

	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x4af8
movq $0x0, -0x8(%rbp)
jmp 0x4c17
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x32c0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x4b21
movq $0x0, -0x8(%rbp)
jmp 0x4c17
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq %rax, %rdx
leaq 0x7502(%rip), %rsi      # 0xc048
callq 0x32c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x4b91
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq %rax, %rdx
leaq 0x907a(%rip), %rsi      # 0xdbed
callq 0x32c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x4b8f
movq -0x28(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x4b91
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x9045(%rip), %rsi      # 0xdbf4
callq 0x32c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x4bc9
movq $0x0, -0x8(%rbp)
jmp 0x4c17
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
addq $0x2, %rsi
movl $0x1, %edi
callq 0x3300
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x58(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq $0x1, %rsi
movq -0x50(%rbp), %rdx
callq 0x30a0
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: r_404_handler
int r_404_handler(const m38_http_request *request, m38_http_response *response) {
	UNUSED(request);
	response->out = (unsigned char *)"<h1>\"Welcome to Die|</h1>";
	response->outsize = strlen("<h1>\"Welcome to Die|</h1>");
	return 404;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x6cf7(%rip), %rcx      # 0xc1be
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq $0x19, 0x8(%rax)
movl $0x194, %eax            # imm = 0x194
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: m38_render_file
int m38_render_file(const struct greshunkel_ctext *ctext, const char *file_path, m38_http_response *response) {
	int rc = m38_mmap_file(file_path, response);
	if (!RESPONSE_OK(rc))
		return rc;

	/* Render the mmap()'d file with greshunkel */
	const char *mmapd_region = (char *)response->out;
	const size_t original_size = response->outsize;

	size_t new_size = 0;
	char *rendered = gshkl_render(ctext, mmapd_region, original_size, &new_size);
	gshkl_free_context((greshunkel_ctext *)ctext);

	/* Clean up the stuff we're no longer using. */
	munmap(response->out, original_size);
	free(response->extra_data);

	/* Make sure the response is kept up to date: */
	response->outsize = new_size;
	response->out = (unsigned char *)rendered;

	return 200;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3150
movl %eax, -0x24(%rbp)
cmpl $0xc8, -0x24(%rbp)
jl 0x5546
cmpl $0x190, -0x24(%rbp)     # imm = 0x190
jl 0x554e
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x55ca
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x32d0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3530
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3480
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x3050
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0xc8, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: m38_insert_custom_header
int m38_insert_custom_header(m38_http_response *response, const char *header, const size_t header_len,
		const char *value, const size_t value_len) {
	if (!header || !value || !response)
		return 0;

	m38_header_pair *new_pair = calloc(1, sizeof(m38_header_pair));
	if (!new_pair) {
		m38_log_msg(LOG_ERR, "Could not create header_pair for http_response extra headers!");
		return 0;
	}

	const char *copied_header = strndup(header, header_len);
	const char *copied_value = strndup(value, value_len);
	if (!copied_header || !copied_value) {
		m38_log_msg(LOG_ERR, "Could not create copied values for http_response extra headers!");
		free(new_pair);
		return 0;
	}

	m38_header_pair _stack_pair = {
		.header = copied_header,
		.header_len = header_len,
		.value = copied_value,
		.value_len = value_len,
	};
	memcpy(new_pair, &_stack_pair, sizeof(m38_header_pair));
	vector_append_ptr(response->extra_headers, new_pair);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5a91
cmpq $0x0, -0x28(%rbp)
je 0x5a91
cmpq $0x0, -0x10(%rbp)
jne 0x5a9d
movl $0x0, -0x4(%rbp)
jmp 0x5b86
movl $0x1, %edi
movl $0x20, %esi
callq 0x3300
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x5ad6
movl $0x3, %edi
leaq 0x6715(%rip), %rsi      # 0xc1d8
movb $0x0, %al
callq 0x3580
movl $0x0, -0x4(%rbp)
jmp 0x5b86
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x32f0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x32f0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x5b06
cmpq $0x0, -0x48(%rbp)
jne 0x5b2b
movl $0x3, %edi
leaq 0x6704(%rip), %rsi      # 0xc216
movb $0x0, %al
callq 0x3580
movq -0x38(%rbp), %rdi
callq 0x3050
movl $0x0, -0x4(%rbp)
jmp 0x5b86
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movq -0x60(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3500
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: read_max_bytes_from_socket
static int read_max_bytes_from_socket(const int accept_fd, unsigned char **to_read, size_t *num_read) {
	size_t read_this_time = 0;
	while ((read_this_time = recv(accept_fd, *to_read + *num_read, MAX_READ_LEN, 0))) {
		*num_read += read_this_time;
		if (read_this_time == 0 || read_this_time < MAX_READ_LEN)
			break;
		read_this_time = 0;

		*to_read = realloc(*to_read, *num_read + MAX_READ_LEN);
		if (!(*to_read)) {
			m38_log_msg(LOG_ERR, "Ran out of memory reading request.");
			goto error;
		}
		memset(*to_read + *num_read, '\0', MAX_READ_LEN);
		if (*num_read >= MAX_REQUEST_SIZE)
			break;
	}

	return 0;

error:
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
addq (%rax), %rsi
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x3060
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x6cd0
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x6c55
cmpq $0x400, -0x20(%rbp)     # imm = 0x400
jae 0x6c57
jmp 0x6cd0
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
addq $0x400, %rsi            # imm = 0x400
callq 0x3470
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x6ca2
movl $0x3, %edi
leaq 0x5917(%rip), %rsi      # 0xc5b0
movb $0x0, %al
callq 0x3580
jmp 0x6cd9
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
addq (%rax), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3240
movq -0x18(%rbp), %rax
cmpq $0x200000, (%rax)       # imm = 0x200000
jb 0x6ccb
jmp 0x6cd0
jmp 0x6c0b
movl $0x0, -0x4(%rbp)
jmp 0x6ce0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: attempt_reread_from_socket
static int attempt_reread_from_socket(
		const int accept_fd, const size_t clength_num,
		const size_t post_body_len, m38_http_request *out) {

	unsigned char *to_read = NULL;
	size_t num_read = 0;

	/* If we have a post_body_len > 0, we don't have to reread from the socket. */
	/* In addition, if we have a longer content-length than we have known post-body
	 * length, than we should attempt to re-read from the client. */
	if ((post_body_len <= 0 && clength_num > 0) ||
		(post_body_len > 0 && post_body_len < clength_num)) {

		to_read = calloc(1, MAX_READ_LEN);

		m38_log_msg(LOG_WARN, "Content-Length is %i but we got a post_body_len of %i.", clength_num, post_body_len);
		m38_log_msg(LOG_WARN, "Attempting to re-read from stream.", clength_num, post_body_len);
		/* ------------------------------------- */
		/* XXX: Do a select here with a timeout. */
		/* ------------------------------------- */
		int rc = read_max_bytes_from_socket(accept_fd, &to_read, &num_read);
		if (rc != 0)
			goto error;
	}

	out->full_body = to_read;
	out->body_len = num_read;
	return 0;

error:
	free(to_read);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
ja 0x6d25
cmpq $0x0, -0x10(%rbp)
ja 0x6d36
cmpq $0x0, -0x18(%rbp)
jbe 0x6d9c
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x6d9c
movl $0x1, %edi
movl $0x400, %esi            # imm = 0x400
callq 0x3300
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x2, %edi
leaq 0x5876(%rip), %rsi      # 0xc5d3
movb $0x0, %al
callq 0x3580
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x2, %edi
leaq 0x5892(%rip), %rsi      # 0xc60a
movb $0x0, %al
callq 0x3580
movl -0x8(%rbp), %edi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x6bf0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x6d9a
jmp 0x6dc3
jmp 0x6d9c
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x240(%rax)
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x248(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6dd3
movq -0x28(%rbp), %rdi
callq 0x3050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: log_request
static void log_request(const m38_http_request *request, const m38_http_response *response, const int response_code) {
	char *visitor_ip_addr = m38_get_header_value_raw(request->full_header, request->header_len, "X-Real-IP");
	char *user_agent = m38_get_header_value_raw(request->full_header, request->header_len, "User-Agent");

	m38_log_msg(LOG_FUN, "%s \"%s %s\" %i %i \"%s\"",
		visitor_ip_addr == NULL ? "NOIP" : visitor_ip_addr,
		request->verb,
		request->resource,
		response_code,
		response->outsize,
		user_agent == NULL ? "NOUSERAGENT" : user_agent);

	free(visitor_ip_addr);
	free(user_agent);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rsi
leaq 0x581d(%rip), %rdx      # 0xc62d
callq 0x3220
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x238(%rax), %rsi
leaq 0x5801(%rip), %rdx      # 0xc637
callq 0x3220
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6e53
leaq 0x580b(%rip), %rax      # 0xc658
movq %rax, -0x30(%rbp)
jmp 0x6e5b
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6e9d
leaq 0x57c6(%rip), %rax      # 0xc65d
movq %rax, -0x60(%rbp)
jmp 0x6ea5
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %r10
movl -0x3c(%rbp), %r9d
movq -0x48(%rbp), %r8
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rax
movl $0x4, %edi
leaq 0x5779(%rip), %rsi      # 0xc642
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x3580
movq -0x20(%rbp), %rdi
callq 0x3050
movq -0x28(%rbp), %rdi
callq 0x3050
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: clean_up_extra_headers
static void _clean_up_extra_headers(m38_http_response *response) {
	size_t i = 0;
	for (i = 0; i < response->extra_headers->count; i++) {
		m38_header_pair **pair = (m38_header_pair **)vector_get(response->extra_headers, i);
		free((char *)(*pair)->header);
		free((char *)(*pair)->value);
		free(*pair);
	}
	vector_free(response->extra_headers);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x38(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jae 0x713e
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movl %eax, %esi
callq 0x3160
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x3050
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
callq 0x3050
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3050
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x70dc
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x3120
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/grengine.c
// Function: guess_mimetype
static void guess_mimetype(const char *ending, const size_t ending_siz, m38_http_response *response) {
	int i;
	char *type = "application/octet-stream";
	for (i = 0; mimetype_mapping[i].ext; i++) {
		if (strncasecmp(ending, mimetype_mapping[i].ext, ending_siz) == 0) {
			type = mimetype_mapping[i].type;
			break;
		}
	}
	strncpy(response->mimetype, type, sizeof(response->mimetype));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x541c(%rip), %rax      # 0xc597
movq %rax, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x1c(%rbp), %rcx
movq 0x9e37(%rip), %rax      # 0x10fc8
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x71ee
movq -0x8(%rbp), %rdi
movslq -0x1c(%rbp), %rcx
movq 0x9e1b(%rip), %rax      # 0x10fc8
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0x33e0
cmpl $0x0, %eax
jne 0x71e1
movslq -0x1c(%rbp), %rcx
movq 0x9df8(%rip), %rax      # 0x10fc8
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x71ee
jmp 0x71e3
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7186
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rsi
movl $0x20, %edx
callq 0x30a0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: create_socket
static inline int create_socket(const int port) {
	int rc = -1;
	int sock_fd = socket(PF_INET, SOCK_STREAM, 0);
	if (sock_fd <= 0) {
		m38_log_msg(LOG_ERR, "Could not create main socket.");
		goto error;
	}

	int opt = 1;
	setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (void*) &opt, sizeof(opt));

	struct sockaddr_in hints = {0};
	hints.sin_family		 = AF_INET;
	hints.sin_port			 = htons(port);
	hints.sin_addr.s_addr	 = htonl(INADDR_ANY);

	rc = bind(sock_fd, (struct sockaddr *)&hints, sizeof(hints));
	if (rc < 0) {
		m38_log_msg(LOG_ERR, "Could not bind main socket.");
		goto error;
	}

	rc = listen(sock_fd, 0);
	if (rc < 0) {
		m38_log_msg(LOG_ERR, "Could not listen on main socket.");
		goto error;
	}
	m38_log_msg(LOG_FUN, "Listening on http://localhost:%i/", port);

	return sock_fd;

error:
	close(sock_fd);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x3610
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0xaf74
movl $0x3, %edi
leaq 0x2901(%rip), %rsi      # 0xd869
movb $0x0, %al
callq 0x3580
jmp 0xb03b
movl $0x1, -0x14(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x2, %edx
leaq -0x14(%rbp), %rcx
movl $0x4, %r8d
callq 0x30f0
leaq -0x24(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3240
movw $0x2, -0x24(%rbp)
movl -0x8(%rbp), %eax
movzwl %ax, %edi
callq 0x3190
movw %ax, -0x22(%rbp)
xorl %edi, %edi
callq 0x3230
movl %eax, -0x20(%rbp)
movl -0x10(%rbp), %edi
leaq -0x24(%rbp), %rsi
movl $0x10, %edx
callq 0x3490
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xaff5
movl $0x3, %edi
leaq 0x289b(%rip), %rsi      # 0xd887
movb $0x0, %al
callq 0x3580
jmp 0xb03b
movl -0x10(%rbp), %edi
xorl %esi, %esi
callq 0x3420
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jge 0xb01d
movl $0x3, %edi
leaq 0x288f(%rip), %rsi      # 0xd8a3
movb $0x0, %al
callq 0x3580
jmp 0xb03b
movl -0x8(%rbp), %edx
movl $0x4, %edi
leaq 0x2898(%rip), %rsi      # 0xd8c4
movb $0x0, %al
callq 0x3580
movl -0x10(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xb04a
movl -0x10(%rbp), %edi
callq 0x32a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: open_queue
static inline mqd_t _open_queue(const char *queue_name, int flags, const size_t size) {
	(void) flags;
	struct mq_attr asq_attr = {
		.mq_flags = 0,
		.mq_maxmsg = 10,
		.mq_msgsize = size, /* We're passing around file descriptors */
		.mq_curmsgs = 0
	};

	mqd_t to_return = mq_open(queue_name, O_WRONLY | O_CREAT, 0644, &asq_attr);
	if (to_return == -1)
		perror("Could not open queue");

	return to_return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x3240
movq $0xa, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movl $0x41, %esi
movl $0x1a4, %edx            # imm = 0x1A4
leaq -0x58(%rbp), %rcx
movb $0x0, %al
callq 0x3390
movl %eax, -0x5c(%rbp)
cmpl $-0x1, -0x5c(%rbp)
jne 0xb0c1
leaq 0x282a(%rip), %rdi      # 0xd8e6
callq 0x3520
movl -0x5c(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: acceptor
static void *acceptor(void *arg) {
	mqd_t accepted_socket_queue = 0;
	const acceptor_arg *args = arg;
	const int main_sock_fd = args->main_sock_fd;

	accepted_socket_queue = _open_queue(ACCEPTED_SOCKET_QUEUE_NAME, O_WRONLY, sizeof(int));
	if (accepted_socket_queue == -1) {
		m38_log_msg(LOG_ERR, "Acceptor: Could not open accepted_socket_queue.");
		perror("Acceptor: ");
		return NULL;
	}

	while(1) {
		struct sockaddr_storage their_addr = {0};
		socklen_t sin_size = sizeof(their_addr);

		int new_fd = accept(main_sock_fd, (struct sockaddr *)&their_addr, &sin_size);

		if (new_fd == -1) {
			m38_log_msg(LOG_ERR, "Acceptor: Could not accept new connection.");
			return NULL;
		}

		ssize_t msg_size = mq_send(accepted_socket_queue, (char *)&new_fd, sizeof(int), 0);
		if (msg_size == -1) {
			/* We want to continue from this error. Maybe the queue is full or something. */
			m38_log_msg(LOG_ERR, "Acceptor: Could not queue new accepted connection.");
			close(new_fd);
		}
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
leaq 0x257b(%rip), %rdi      # 0xd679
movl $0x1, %esi
movl $0x4, %edx
callq 0xb060
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0xb142
movl $0x3, %edi
leaq 0x27d9(%rip), %rsi      # 0xd8fb
movb $0x0, %al
callq 0x3580
leaq 0x27fb(%rip), %rdi      # 0xd92b
callq 0x3520
movq $0x0, -0x8(%rbp)
jmp 0xb1ef
jmp 0xb144
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3240
movl $0x80, -0xac(%rbp)
movl -0x24(%rbp), %edi
leaq -0xa8(%rbp), %rsi
leaq -0xac(%rbp), %rdx
callq 0x3540
movl %eax, -0xb0(%rbp)
cmpl $-0x1, -0xb0(%rbp)
jne 0xb1a3
movl $0x3, %edi
leaq 0x27a4(%rip), %rsi      # 0xd936
movb $0x0, %al
callq 0x3580
movq $0x0, -0x8(%rbp)
jmp 0xb1ef
movl -0x14(%rbp), %edi
leaq -0xb0(%rbp), %rsi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x32b0
cltq
movq %rax, -0xb8(%rbp)
cmpq $-0x1, -0xb8(%rbp)
jne 0xb1ea
movl $0x3, %edi
leaq 0x2789(%rip), %rsi      # 0xd961
movb $0x0, %al
callq 0x3580
movl -0xb0(%rbp), %edi
callq 0x32a0
jmp 0xb144
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: responder
static void *responder(void *arg) {
	UNUSED(arg);

	mqd_t handled_queue = -1;
	handled_queue = mq_open(HANDLED_CONNECTION_QUEUE_NAME, O_RDWR);
	if (handled_queue == -1) {
		m38_log_msg(LOG_ERR, "Responder: Could not open handled queue.");
		perror("Responder: ");
		return NULL;
	}

	while(1) {
		m38_handled_request *req = NULL;
		ssize_t msg_size = mq_receive(handled_queue, (char *)&req, sizeof(m38_handled_request *), NULL);

		if (msg_size == -1) {
			m38_log_msg(LOG_ERR, "Responder: Could not read from handled_queue.");
			perror("Responder: ");
			break;
		} else if (req == NULL) {
			m38_log_msg(LOG_ERR, "Responder: Got bogus request from queue.");
		} else {
			m38_handled_request *new_req = m38_send_response(req);
			if (new_req != NULL) {
				ssize_t msg_size = mq_send(handled_queue, (char *)&new_req, sizeof(m38_handled_request *), 0);
				if (msg_size == -1)
					m38_log_msg(LOG_ERR, "Responder: Could not enqueue handled response.");
			} else {
				m38_log_msg(LOG_FUN, "Responder: Response sent.");
			}
		}
	}

	mq_close(handled_queue);

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
leaq 0x2485(%rip), %rdi      # 0xd69f
movl $0x2, %esi
movb $0x0, %al
callq 0x3390
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0xb25b
movl $0x3, %edi
leaq 0x2759(%rip), %rsi      # 0xd994
movb $0x0, %al
callq 0x3580
leaq 0x2774(%rip), %rdi      # 0xd9bd
callq 0x3520
movq $0x0, -0x8(%rbp)
jmp 0xb33a
jmp 0xb25d
movq $0x0, -0x20(%rbp)
movl -0x14(%rbp), %edi
leaq -0x20(%rbp), %rsi
movl $0x8, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x34e0
movq %rax, -0x28(%rbp)
cmpq $-0x1, -0x28(%rbp)
jne 0xb2a9
movl $0x3, %edi
leaq 0x2738(%rip), %rsi      # 0xd9c9
movb $0x0, %al
callq 0x3580
leaq 0x271e(%rip), %rdi      # 0xd9bd
callq 0x3520
jmp 0xb32a
cmpq $0x0, -0x20(%rbp)
jne 0xb2c5
movl $0x3, %edi
leaq 0x273b(%rip), %rsi      # 0xd9f7
movb $0x0, %al
callq 0x3580
jmp 0xb323
movq -0x20(%rbp), %rdi
callq 0x3620
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xb30e
movl -0x14(%rbp), %edi
leaq -0x30(%rbp), %rsi
movl $0x8, %edx
xorl %ecx, %ecx
callq 0x32b0
cltq
movq %rax, -0x38(%rbp)
cmpq $-0x1, -0x38(%rbp)
jne 0xb30c
movl $0x3, %edi
leaq 0x271b(%rip), %rsi      # 0xda20
movb $0x0, %al
callq 0x3580
jmp 0xb321
movl $0x4, %edi
leaq 0x2735(%rip), %rsi      # 0xda4f
movb $0x0, %al
callq 0x3580
jmp 0xb323
jmp 0xb325
jmp 0xb25d
movl -0x14(%rbp), %edi
callq 0x3280
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: m38_set_404_handler
int m38_set_404_handler(m38_app *app,
	int (*handler)(const m38_http_request *request, m38_http_response *response)) {
	if (app->r_404_route) {
		app->r_404_route->handler = handler;
	} else {
		m38_route *new_route = calloc(1, sizeof(m38_route));
		new_route->handler = handler;
		new_route->cleanup = NULL;
		strncpy(new_route->name, "Custom 404 Handler", sizeof(new_route->name));
		strncpy(new_route->verb, "GET", sizeof(new_route->verb));
		strncpy(new_route->route_match, "^.*$", sizeof(new_route->route_match));

		app->r_404_route = new_route;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xb593
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x158(%rax)
jmp 0xb617
movl $0x1, %edi
movl $0x168, %esi            # imm = 0x168
callq 0x3300
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x158(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x160(%rax)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
leaq 0x227a(%rip), %rsi      # 0xd84d
movl $0x40, %edx
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x2278(%rip), %rsi      # 0xd860
movl $0x10, %edx
callq 0x30a0
movq -0x18(%rbp), %rdi
addq $0x50, %rdi
leaq 0x2263(%rip), %rsi      # 0xd864
movl $0x100, %edx            # imm = 0x100
callq 0x30a0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/server.c
// Function: m38_set_404_cleanup
int m38_set_404_cleanup(m38_app *app,
	void (*cleanup)(const int status_code, m38_http_response *response)) {
	if (app->r_404_route) {
		app->r_404_route->cleanup = cleanup;
	} else {
		m38_route *new_route = calloc(1, sizeof(m38_route));
		new_route->handler = NULL;
		new_route->cleanup = cleanup;
		strncpy(new_route->name, "Custom 404 Handler", sizeof(new_route->name));
		strncpy(new_route->verb, "GET", sizeof(new_route->verb));
		strncpy(new_route->route_match, "^.*$", sizeof(new_route->route_match));

		app->r_404_route = new_route;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xb653
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x160(%rax)
jmp 0xb6d7
movl $0x1, %edi
movl $0x168, %esi            # imm = 0x168
callq 0x3300
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x158(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x160(%rax)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
leaq 0x21ba(%rip), %rsi      # 0xd84d
movl $0x40, %edx
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x21b8(%rip), %rsi      # 0xd860
movl $0x10, %edx
callq 0x30a0
movq -0x18(%rbp), %rdi
addq $0x50, %rdi
leaq 0x21a3(%rip), %rsi      # 0xd864
movl $0x100, %edx            # imm = 0x100
callq 0x30a0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/parse.c
// Function: m38_get_header_value_raw
char *m38_get_header_value_raw(const char *request, const size_t request_siz, const char header[static 1]) {
	/* TODO: Make sure this function handles bad input. */
	char *data = NULL;
	const char *header_loc = strnstr(request, header, request_siz);
	if (!header_loc)
		return NULL;

	const char *header_value_start = header_loc + strnlen(header, request_siz) + strlen(": ");
	const char *header_value_end = strnstr(header_loc, "\r\n", request_siz);
	if (!header_value_end)
		return NULL;

	const size_t header_value_size = header_value_end - header_value_start;
	data = calloc(sizeof(char), header_value_size + 1);
	data[header_value_size] = '\0';
	strncpy(data, header_value_start, header_value_size);

	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x32c0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb955
movq $0x0, -0x8(%rbp)
jmp 0xb9ef
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3260
movq %rax, %rcx
movq -0x50(%rbp), %rax
addq %rcx, %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xadc(%rip), %rsi       # 0xc467
callq 0x32c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xb9a5
movq $0x0, -0x8(%rbp)
jmp 0xb9ef
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
addq $0x1, %rsi
movl $0x1, %edi
callq 0x3300
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x30a0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/parse.c
// Function: m38_parse_body
int m38_parse_body(const size_t received_body_len,
			   const size_t content_length_num,
			   const unsigned char *raw_request,
			   m38_http_request *request) {

	const char *body_start = (char *)raw_request + request->header_len;
	/* We want to read the least amount. Read whatever is smallest. DO IT BECAUSE I SAY SO. */
	if (content_length_num == received_body_len) {
		request->body_len = content_length_num;
		request->full_body = (unsigned char *)strndup(body_start, content_length_num);
	} else if (received_body_len < content_length_num) {
		m38_log_msg(LOG_DEBUG, "FULL BODY: Received body length is less than clength for full_body.");
		request->body_len = received_body_len;
		request->full_body = (unsigned char *)strndup(body_start, request->body_len);
	} else if (content_length_num > 0 && content_length_num < received_body_len) {
		m38_log_msg(LOG_DEBUG, "FULL BODY: Content length is less than total received body length.");
		request->body_len = content_length_num;
		request->full_body = (unsigned char *)strndup(body_start, request->body_len);
	} else {
		m38_log_msg(LOG_DEBUG, "FULL BODY: Discrepancy between content-length and body length.");
		request->full_body = NULL;
	}

	if (!request->full_body) {
		m38_log_msg(LOG_WARN, "No body on request, even though we expect one.");
		return -1;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
addq 0x238(%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0xbc84
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x248(%rax)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x240(%rax)
jmp 0xbd51
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0xbcd4
movl $0x1, %edi
leaq 0x1fce(%rip), %rsi      # 0xdc68
movb $0x0, %al
callq 0x3580
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x248(%rax)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x248(%rax), %rsi
callq 0x32f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x240(%rax)
jmp 0xbd4f
cmpq $0x0, -0x18(%rbp)
jbe 0xbd2b
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xbd2b
movl $0x1, %edi
leaq 0x1fbb(%rip), %rsi      # 0xdcac
movb $0x0, %al
callq 0x3580
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x248(%rax)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x248(%rax), %rsi
callq 0x32f0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x240(%rax)
jmp 0xbd4d
movl $0x1, %edi
leaq 0x1fb8(%rip), %rsi      # 0xdcef
movb $0x0, %al
callq 0x3580
movq -0x28(%rbp), %rax
movq $0x0, 0x240(%rax)
jmp 0xbd4f
jmp 0xbd51
movq -0x28(%rbp), %rax
cmpq $0x0, 0x240(%rax)
jne 0xbd7b
movl $0x2, %edi
leaq 0x1fc3(%rip), %rsi      # 0xdd2e
movb $0x0, %al
callq 0x3580
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xbd82
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]38-Moths/src/parse.c
// Function: m38_parse_form_encoded_body
int m38_parse_form_encoded_body(m38_http_request *request) {
	struct sparse_dict *new_dict = NULL;
	char *potential_kv_pair = NULL;
	char *duplicated_body = strndup((char *)request->full_body, request->body_len);
	if (!duplicated_body) {
		goto err;
	}

	new_dict = sparse_dict_init();

	while ((potential_kv_pair = strsep((char **)&request->full_body, "&")) != NULL) {
		char *key = NULL;
		char *value = NULL;
		key = strsep(&potential_kv_pair, "=");
		value = strsep(&potential_kv_pair, "=");

		if (!key || !value) {
			continue;
		}

		char *decoded_buffer = calloc(1, strlen(value));
		if (m38_url_decode(value, decoded_buffer) > 0) {
			sparse_dict_set(new_dict, key, strlen(key), decoded_buffer, strlen(decoded_buffer));
		} else {
			m38_log_msg(LOG_WARN, "Could not place item into form elements dict.");
		}
		free(decoded_buffer);
	}

	request->form_elements = new_dict;
	free(duplicated_body);
	return 0;

err:
	free(duplicated_body);
	free(new_dict);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x240(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x248(%rax), %rsi
callq 0x32f0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbdd7
jmp 0xbf05
movb $0x0, %al
callq 0x31d0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
leaq 0x1f69(%rip), %rsi      # 0xdd5d
callq 0x3400
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xbee4
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1dd2(%rip), %rsi      # 0xdbf4
callq 0x3400
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1dbe(%rip), %rsi      # 0xdbf4
callq 0x3400
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xbe4d
cmpq $0x0, -0x38(%rbp)
jne 0xbe4f
jmp 0xbde2
movq -0x38(%rbp), %rdi
callq 0x3140
movq %rax, %rsi
movl $0x1, %edi
callq 0x3300
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x30d0
cmpl $0x0, %eax
jle 0xbec3
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3140
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x3140
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq %rax, %r8
callq 0x3320
jmp 0xbed6
movl $0x2, %edi
leaq 0x1e90(%rip), %rsi      # 0xdd5f
movb $0x0, %al
callq 0x3580
movq -0x40(%rbp), %rdi
callq 0x3050
jmp 0xbde2
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x250(%rax)
movq -0x28(%rbp), %rdi
callq 0x3050
movl $0x0, -0x4(%rbp)
jmp 0xbf1e
movq -0x28(%rbp), %rdi
callq 0x3050
movq -0x18(%rbp), %rdi
callq 0x3050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq