LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/simple_sparsehash.c
// Function: create_and_insert_new_bucket
static int _create_and_insert_new_bucket(
		struct sparse_array *array, const unsigned int i,
		const char *key, const size_t klen,
		const void *value, const size_t vlen,
		const uint64_t key_hash) {
	void *copied_value = NULL;
	char *copied_key = NULL;

	copied_value = malloc(vlen + klen);
	if (copied_value == NULL)
		goto error;
	memcpy(copied_value, value, vlen);

	copied_key = copied_value + vlen;
	strncpy(copied_key, key, klen);

	struct sparse_bucket bct = {
		.key = copied_key,
		.klen = klen,
		.val = copied_value,
		.vlen = vlen,
		.hash = key_hash
	};

	if (!sparse_array_set(array, i, &bct, sizeof(bct)))
		goto error;

	return 1;

error:
	free(copied_value);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r15
movq %r8, %rbp
movq %rcx, %r12
movq %rdx, %r13
movl %esi, 0xc(%rsp)
movq %rdi, %r14
leaq (%r9,%rcx), %rdi
callq 0x33a0
movq %rax, %rbx
testq %rax, %rax
je 0x3fca
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x3350
movq %rbx, %rbp
addq %r15, %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x30a0
leaq 0x10(%rsp), %rdx
movq %rbp, (%rdx)
movq %r12, 0x8(%rdx)
movq %rbx, 0x10(%rdx)
movq %r15, 0x18(%rdx)
movq 0x70(%rsp), %rax
movq %rax, 0x20(%rdx)
movl $0x28, %ecx
movq %r14, %rdi
movl 0xc(%rsp), %esi
callq 0x3070
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x3fd4
movq %rbx, %rdi
callq 0x3050
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/simple_sparsehash.c
// Function: sparse_dict_get
void *sparse_dict_get(struct sparse_dict *dict, const char *key,
							const size_t klen, size_t *outsize) {
	const uint64_t key_hash = hash_fnv1a(key, klen);
	unsigned int num_probes = 0;

	while (1) {
		size_t current_value_siz = 0;
		const unsigned int probed_val = QUADRATIC_PROBE(dict->bucket_max);
		const void *current_value = sparse_array_get(dict->buckets, probed_val, &current_value_siz);

		if (current_value_siz != 0 && current_value != NULL) {
			/* We have to do a string comparison here because we use quadratic probing.
			 * The value we pulled from the underlying array could be anything.
			 */
			struct sparse_bucket *existing_bucket = (struct sparse_bucket *)current_value;
			const size_t lrgr_key = existing_bucket->klen > klen ? existing_bucket->klen : klen;
			if (existing_bucket->hash == key_hash && strncmp(existing_bucket->key, key, lrgr_key) == 0) {
				if (outsize)
					memcpy(outsize, &existing_bucket->vlen, sizeof(existing_bucket->vlen));

				return existing_bucket->val;
			}
		} else {
			/* We found nothing where we expected something. */
			return NULL;
		}

		num_probes++;

		if (num_probes > dict->bucket_count)
			return NULL;
	}

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x10(%rsp)
movq %rdi, %r12
movabsq $-0x340d631b7bdddcdb, %rdi # imm = 0xCBF29CE484222325
testl %edx, %edx
jle 0x4039
movb $0x1, %cl
movabsq $0x100000001b3, %rax    # imm = 0x100000001B3
leal -0x1(%rcx), %r8d
movzbl %r8b, %r8d
movsbq (%rsi,%r8), %r13
xorq %rdi, %r13
imulq %rax, %r13
movzbl %cl, %r8d
leal 0x1(%r8), %ecx
movq %r13, %rdi
cmpl %edx, %r8d
jl 0x4013
jmp 0x403c
movq %rdi, %r13
movq %rsi, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
leaq 0x8(%rsp), %rbp
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
movl %r15d, %eax
imull %r15d, %eax
addl %r13d, %eax
movl (%r12), %esi
decl %esi
andl %eax, %esi
movq 0x10(%r12), %rdi
movq %rbp, %rdx
callq 0x3430
movq %rax, %rbx
xorl %eax, %eax
cmpq $0x0, 0x8(%rsp)
je 0x40f1
testq %rbx, %rbx
je 0x40f1
movb $0x1, %r14b
cmpq %r13, 0x20(%rbx)
jne 0x40ce
movq (%rbx), %rdi
movq 0x8(%rbx), %rdx
movq 0x20(%rsp), %rax
cmpq %rax, %rdx
cmovbeq %rax, %rdx
movq 0x18(%rsp), %rsi
callq 0x30b0
testl %eax, %eax
jne 0x40ce
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x40c3
movq 0x18(%rbx), %rax
movq %rax, (%rcx)
movq 0x10(%rbx), %rax
movq %rax, (%rsp)
xorl %r14d, %r14d
testb %r14b, %r14b
je 0x40fb
incl %r15d
cmpq %r15, 0x8(%r12)
setae %al
movl $0x0, %ecx
movq (%rsp), %rdx
cmovbq %rcx, %rdx
movq %rdx, (%rsp)
jmp 0x40fd
movq $0x0, (%rsp)
jmp 0x40fd
xorl %eax, %eax
testb %al, %al
jne 0x404e
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x4171
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
movq $0x0, 0x8(%rsp)
movq 0x10(%rbx), %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x3430
cmpq $0x0, 0x8(%rsp)
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x4169
movq 0x10(%rax), %rdi
callq 0x3050
incl %r14d
cmpq %r14, (%rbx)
ja 0x4132
movq 0x10(%rbx), %rdi
callq 0x3230
movq %rbx, %rdi
callq 0x3050
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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:
movl %esi, %ecx
cmpl $0x20, %esi
jb 0x4215
pushq %rbx
leal -0x20(%rcx), %esi
movl %esi, %eax
shrl $0x5, %eax
andl $-0x20, %esi
addq $0x20, %rsi
xorl %r8d, %r8d
movl $0x33333333, %r9d       # imm = 0x33333333
movq %rdi, %r10
xorl %edx, %edx
movl (%r10), %r11d
movl %r11d, %ebx
shrl %ebx
andl $0x55555555, %ebx       # imm = 0x55555555
subl %ebx, %r11d
movl %r11d, %ebx
andl %r9d, %ebx
shrl $0x2, %r11d
andl %r9d, %r11d
addl %ebx, %r11d
movl %r11d, %ebx
shrl $0x4, %ebx
addl %r11d, %ebx
andl $0xf0f0f0f, %ebx        # imm = 0xF0F0F0F
movl %ebx, %r11d
shrl $0x8, %r11d
addl %ebx, %r11d
movl %r11d, %ebx
shrl $0x10, %ebx
addl %r11d, %ebx
movzbl %bl, %r11d
addl %r11d, %edx
addq $0x4, %r10
addq $0x20, %r8
cmpq %r8, %rsi
jne 0x41b6
incl %eax
subl %r8d, %ecx
popq %rbx
jmp 0x4219
xorl %edx, %edx
xorl %eax, %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
notl %esi
andl (%rdi,%rax,4), %esi
movl %esi, %eax
shrl %eax
andl $0x15555555, %eax       # imm = 0x15555555
subl %eax, %esi
movl $0x33333333, %eax       # imm = 0x33333333
movl %esi, %ecx
andl %eax, %ecx
shrl $0x2, %esi
andl %eax, %esi
addl %ecx, %esi
movl %esi, %eax
shrl $0x4, %eax
addl %esi, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
movl %eax, %ecx
shrl $0x8, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
addl %ecx, %eax
movzbl %al, %eax
addl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r15
callq 0x3150
movq %r12, %rbx
testq %rax, %rax
js 0x4315
movq %rax, %r14
addq %r15, %r14
leaq 0x4(%rsp), %r13
movq %r12, %rbx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x1(%r15), %rdi
movzbl (%r15), %eax
movsbl %al, %ecx
movl %ecx, 0x4(%rsp)
cmpl $0x25, %eax
je 0x42bb
cmpl $0x2b, %eax
jne 0x42b6
movl $0x20, 0x4(%rsp)
movq %rdi, %r15
jmp 0x4302
movsbl (%rdi), %eax
leal -0x3a(%rax), %ecx
cmpl $-0xb, %ecx
ja 0x42d1
andl $-0x21, %eax
addl $-0x47, %eax
cmpl $-0x6, %eax
jb 0x431a
movsbl 0x2(%r15), %eax
leal -0x3a(%rax), %ecx
cmpl $-0xb, %ecx
ja 0x42e9
andl $-0x21, %eax
addl $-0x47, %eax
cmpl $-0x6, %eax
jb 0x431a
leaq 0x5d3e(%rip), %rsi      # 0xa02e
movq %r13, %rdx
xorl %eax, %eax
callq 0x33e0
testl %eax, %eax
je 0x431a
addq $0x3, %r15
testq %r12, %r12
je 0x430d
movb 0x4(%rsp), %al
movb %al, (%rbx)
incq %rbx
cmpq %r14, %r15
jbe 0x4295
subl %r12d, %ebx
movl %ebx, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3150
movq %rax, %r15
movq %rbx, %rdi
callq 0x3150
movq %rax, %rcx
xorl %eax, %eax
subq %rcx, %r15
jb 0x4379
testq %rcx, %rcx
je 0x4374
addq %r15, %r14
movl $0x1, %edx
xorl %eax, %eax
xorl %esi, %esi
movb (%rbx,%rsi), %dil
cmpb (%r14,%rsi), %dil
jne 0x4379
movl %edx, %esi
incl %edx
cmpq %rsi, %rcx
ja 0x4361
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x3150
testq %rax, %rax
je 0x43da
movq %rax, %r15
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3240
movq %rax, %r12
subl %r15d, %r12d
testl %r12d, %r12d
jle 0x43d8
movb (%r14), %bpl
cmpb %bpl, (%rbx)
jne 0x43d0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x30b0
testl %eax, %eax
je 0x43da
incq %rbx
decl %r12d
jne 0x43b9
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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:
movq %rdx, %rax
movabsq $-0x340d631b7bdddcdb, %r8 # imm = 0xCBF29CE484222325
testl %esi, %esi
jle 0x44b1
xorl %ecx, %ecx
movabsq $0x100000001b3, %r9     # imm = 0x100000001B3
movzbl %cl, %ecx
movzbl (%rdi,%rcx), %edx
xorq %r8, %rdx
imulq %r9, %rdx
incb %cl
movzbl %cl, %r10d
movq %rdx, %r8
cmpl %esi, %r10d
jl 0x4493
jmp 0x44b4
movq %r8, %rdx
pushq %rax
leaq 0x5b76(%rip), %rsi      # 0xa032
movq %rax, %rdi
xorl %eax, %eax
callq 0x3560
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x458a
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x32a0
testq %rax, %rax
je 0x458a
movq %rax, %r14
subq %rax, %r15
addq %rbx, %r15
leaq 0x5b2e(%rip), %rsi      # 0xa036
movq %rax, %rdi
movq %r15, %rdx
callq 0x32a0
movq %rax, %r12
testq %rax, %rax
jne 0x453a
leaq 0x765b(%rip), %rsi      # 0xbb7d
movq %r14, %rdi
movq %r15, %rdx
callq 0x32a0
addq %r14, %rbx
testq %rax, %rax
cmovneq %rax, %rbx
movq %rbx, %r12
movq %r12, %rdx
subq %r14, %rdx
leaq 0x768f(%rip), %rsi      # 0xbbd6
movq %r14, %rdi
callq 0x32a0
testq %rax, %rax
je 0x458a
movq %rax, %rbx
subq %rax, %r12
leaq 0x2(%r12), %rsi
movl $0x1, %edi
callq 0x32e0
movb $0x0, (%rax,%r12)
incq %rbx
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x30a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x3160
cmpl $0x18f, %eax            # imm = 0x18F
ja 0x4b25
movq (%rbx), %rsi
movq 0x8(%rbx), %r15
leaq 0x8(%rsp), %r12
movq $0x0, (%r12)
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
callq 0x32b0
movq %rax, %r13
movq %r14, %rdi
callq 0x3500
movq (%rbx), %rdi
movq %r15, %rsi
callq 0x3450
movq 0x30(%rbx), %rdi
callq 0x3050
movq (%r12), %rax
movq %rax, 0x8(%rbx)
movq %r13, (%rbx)
movl $0xc8, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rdi, %rdi
je 0x4e89
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbp
testq %rsi, %rsi
je 0x4e7b
movq %rcx, %r13
testq %rcx, %rcx
je 0x4e7b
movq %r8, %rbx
movq %rdx, %r15
movq %rdi, %r14
movl $0x1, %edi
movl $0x20, %esi
callq 0x32e0
testq %rax, %rax
je 0x4e4b
movq %rax, %r12
movq %rbp, %rdi
movq %r15, %rsi
callq 0x32d0
movq %rax, %rbp
movq %r13, %rdi
movq %rbx, %rsi
callq 0x32d0
testq %rbp, %rbp
setne %cl
testq %rax, %rax
setne %dl
testb %dl, %cl
je 0x4e60
movq %rbp, (%r12)
movq %r15, 0x8(%r12)
movq %rax, 0x10(%r12)
movq %rbx, 0x18(%r12)
movq 0x38(%r14), %rdi
movq %r12, %rsi
callq 0x34d0
jmp 0x4e7b
leaq 0x5366(%rip), %rsi      # 0xa1b8
movl $0x3, %edi
xorl %eax, %eax
callq 0x3540
jmp 0x4e7b
leaq 0x538f(%rip), %rsi      # 0xa1f6
movl $0x3, %edi
xorl %eax, %eax
callq 0x3540
movq %r12, %rdi
callq 0x3050
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movq (%r14), %rsi
addq (%rbx), %rsi
xorl %r15d, %r15d
movl $0x400, %edx            # imm = 0x400
movl %ebp, %edi
xorl %ecx, %ecx
callq 0x3060
testq %rax, %rax
je 0x5a8a
movq (%rbx), %rsi
addq %rax, %rsi
movq %rsi, (%rbx)
cmpq $0x400, %rax            # imm = 0x400
jb 0x5a8a
movq (%r14), %rdi
addq $0x400, %rsi            # imm = 0x400
callq 0x3440
movq %rax, (%r14)
testq %rax, %rax
je 0x5a71
movq (%rbx), %r12
addq %r12, %rax
xorl %r15d, %r15d
movl $0x400, %edx            # imm = 0x400
movq %rax, %rdi
xorl %esi, %esi
callq 0x3220
cmpq $0x200000, %r12         # imm = 0x200000
jb 0x5a0a
jmp 0x5a8a
leaq 0x4b18(%rip), %rsi      # 0xa590
movl $0x3, %edi
xorl %eax, %eax
callq 0x3540
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/grengine.c
// Function: m38_send_response
m38_handled_request *m38_send_response(m38_handled_request *hreq) {
	/* Send that shit over the wire: */
	const m38_route *matching_route = hreq->matching_route;

	const size_t bytes_left = hreq->response_len - hreq->sent;
	const size_t to_send = bytes_left < 4096 ? bytes_left : 4096;
	int rc = send(hreq->accept_fd, hreq->response_bytes + hreq->sent, to_send, MSG_NOSIGNAL);
	if (rc <= 0) {
		m38_log_msg(LOG_ERR, "Could not send response.");
		goto error;
	}

	hreq->sent += to_send;

	if (hreq->response_len - hreq->sent <= 0) {
		if (matching_route->cleanup != NULL) {
			m38_log_msg(LOG_INFO, "Calling cleanup for %s.", matching_route->name);
			matching_route->cleanup(hreq->response_code, &hreq->response);
		}
		_clean_up_extra_headers(&hreq->response);
		close(hreq->accept_fd);
		free(hreq->response_bytes);
		free(hreq);

		return NULL;
	}

	return hreq;

error:
	if (matching_route != NULL && matching_route->cleanup != NULL)
		matching_route->cleanup(500, &hreq->response);
	_clean_up_extra_headers(&hreq->response);
	close(hreq->accept_fd);
	free(hreq->response_bytes);
	free(hreq);

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq 0x18(%rdi), %rsi
subq %rsi, %r14
movl $0x1000, %eax           # imm = 0x1000
cmpq %rax, %r14
cmovaeq %rax, %r14
movq 0x20(%rdi), %r15
movl 0x10(%rdi), %edi
addq (%rbx), %rsi
movq %r14, %rdx
movl $0x4000, %ecx           # imm = 0x4000
callq 0x31a0
testl %eax, %eax
jle 0x5b10
addq 0x18(%rbx), %r14
movq %r14, 0x18(%rbx)
cmpq %r14, 0x8(%rbx)
jne 0x5b62
cmpq $0x0, 0x160(%r15)
je 0x5b3f
leaq 0x10(%r15), %rdx
leaq 0x49c9(%rip), %rsi      # 0xa4c0
xorl %edi, %edi
xorl %eax, %eax
callq 0x3540
movl 0x14(%rbx), %edi
leaq 0x28(%rbx), %rsi
callq *0x160(%r15)
jmp 0x5b3f
leaq 0x4990(%rip), %rsi      # 0xa4a7
movl $0x3, %edi
xorl %eax, %eax
callq 0x3540
testq %r15, %r15
je 0x5b3f
movq 0x160(%r15), %rax
testq %rax, %rax
je 0x5b3f
leaq 0x28(%rbx), %rsi
movl $0x1f4, %edi            # imm = 0x1F4
callq *%rax
leaq 0x28(%rbx), %rdi
callq 0x5b6b
movl 0x10(%rbx), %edi
callq 0x3280
movq (%rbx), %rdi
callq 0x3050
movq %rbx, %rdi
callq 0x3050
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x5bb8
xorl %r14d, %r14d
movl %r14d, %esi
callq 0x3170
movq %rax, %r15
movq (%rax), %rax
movq (%rax), %rdi
callq 0x3050
movq (%r15), %rax
movq 0x10(%rax), %rdi
callq 0x3050
movq (%r15), %rdi
callq 0x3050
incq %r14
movq 0x38(%rbx), %rdi
cmpq 0x10(%rdi), %r14
jb 0x5b81
popq %rbx
popq %r14
popq %r15
jmp 0x3130
nop
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl (%rdi), %ebx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, 0x30(%rcx)
movaps %xmm0, 0x20(%rcx)
movq $0xa, 0x8(%rcx)
movq $0x4, 0x10(%rcx)
leaq 0x2bd6(%rip), %rdi      # 0xb649
movl $0x41, %esi
movl $0x1a4, %edx            # imm = 0x1A4
xorl %eax, %eax
callq 0x3370
cmpl $-0x1, %eax
je 0x8b52
movl %eax, %ebp
leaq 0x10(%rsp), %r14
leaq 0xc(%rsp), %r15
leaq 0x8(%rsp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x80, 0xc(%rsp)
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3510
movl %eax, %r12d
movl %eax, 0x8(%rsp)
cmpl $-0x1, %eax
je 0x8b21
movl $0x4, %edx
movl %ebp, %edi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3290
cmpl $-0x1, %eax
jne 0x8b34
movl $0x3, %edi
leaq 0x2de2(%rip), %rsi      # 0xb8f1
xorl %eax, %eax
callq 0x3540
movl 0x8(%rsp), %edi
callq 0x3280
jmp 0x8b34
movl $0x3, %edi
leaq 0x2d99(%rip), %rsi      # 0xb8c6
xorl %eax, %eax
callq 0x3540
cmpl $-0x1, %r12d
jne 0x8a9e
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x36cc
jmp 0x8b3e
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x2afc(%rip), %rdi      # 0xb66f
movl $0x2, %esi
xorl %eax, %eax
callq 0x3370
cmpl $-0x1, %eax
je 0x8c42
movl %eax, %ebx
leaq 0x8(%rsp), %r14
leaq 0x2df1(%rip), %r15      # 0xb987
leaq 0x2e42(%rip), %r12      # 0xb9df
leaq 0x10(%rsp), %r13
movq $0x0, 0x8(%rsp)
movl $0x8, %edx
movl %ebx, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x34b0
movq %rax, %rbp
cmpq $-0x1, %rax
je 0x8c23
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x8c02
callq 0x35e0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x8c0c
movl $0x8, %edx
movl %ebx, %edi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3290
cmpl $-0x1, %eax
jne 0x8c1b
movl $0x3, %edi
leaq 0x2db0(%rip), %rsi      # 0xb9b0
jmp 0x8c14
movl $0x3, %edi
movq %r15, %rsi
jmp 0x8c14
movl $0x4, %edi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3540
cmpq $-0x1, %rbp
jne 0x8ba2
jmp 0x8c2a
callq 0x36fb
jmp 0x8c1b
movl %ebx, %edi
callq 0x3260
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x371e
jmp 0x8c31
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x8df0
movq %r14, 0x158(%rax)
jmp 0x8e66
movq %rdi, %rbx
movl $0x1, %edi
movl $0x168, %esi            # imm = 0x168
callq 0x32e0
movq %rax, %r15
movq %r14, 0x158(%rax)
movq $0x0, 0x160(%rax)
movups 0x2d61(%rip), %xmm0     # 0xbb7f
movups %xmm0, 0x10(%rax)
movups 0x2d66(%rip), %xmm0     # 0xbb8f
movups %xmm0, 0x20(%rax)
movups 0x2d6b(%rip), %xmm0     # 0xbb9f
movups %xmm0, 0x30(%rax)
movups 0x2d70(%rip), %xmm0     # 0xbbaf
movups %xmm0, 0x40(%rax)
movups 0x2d76(%rip), %xmm0     # 0xbbc0
movups %xmm0, (%rax)
leaq 0x50(%rax), %rdi
leaq 0x299c(%rip), %rsi      # 0xb7f4
movl $0x100, %edx            # imm = 0x100
callq 0x30a0
movq %r15, 0x20(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x8e88
movq %r14, 0x160(%rax)
jmp 0x8efe
movq %rdi, %rbx
movl $0x1, %edi
movl $0x168, %esi            # imm = 0x168
callq 0x32e0
movq %rax, %r15
movq $0x0, 0x158(%rax)
movq %r14, 0x160(%rax)
movups 0x2cc9(%rip), %xmm0     # 0xbb7f
movups %xmm0, 0x10(%rax)
movups 0x2cce(%rip), %xmm0     # 0xbb8f
movups %xmm0, 0x20(%rax)
movups 0x2cd3(%rip), %xmm0     # 0xbb9f
movups %xmm0, 0x30(%rax)
movups 0x2cd8(%rip), %xmm0     # 0xbbaf
movups %xmm0, 0x40(%rax)
movups 0x2cde(%rip), %xmm0     # 0xbbc0
movups %xmm0, (%rax)
leaq 0x50(%rax), %rdi
leaq 0x2904(%rip), %rsi      # 0xb7f4
movl $0x100, %edx            # imm = 0x100
callq 0x30a0
movq %r15, 0x20(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdx, %rsi
movq %r14, %rdx
callq 0x32a0
testq %rax, %rax
je 0x9070
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3240
movq %rax, %r15
leaq 0x141a(%rip), %rsi      # 0xa447
movq %rbx, %rdi
movq %r14, %rdx
callq 0x32a0
testq %rax, %rax
je 0x9070
movq %rax, %r14
addq %r15, %rbx
addq $0x2, %rbx
subq %rbx, %r14
leaq 0x1(%r14), %rsi
movl $0x1, %edi
callq 0x32e0
movb $0x0, (%rax,%r14)
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x30a0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/parse.c
// Function: m38_parse_request
int m38_parse_request(const unsigned char *to_read, const size_t num_read, m38_http_request *out) {
	/* Find the verb */
	const char *verb_end = strnstr((char *)to_read, " ", MAX_READ_LEN);
	if (verb_end == NULL)
		goto error;

	const size_t c_verb_size = verb_end - (char *)to_read;
	const size_t verb_size = c_verb_size >= sizeof(out->verb) ? sizeof(out->verb) - 1: c_verb_size;
	strncpy(out->verb, (char *)to_read, verb_size);

	const char *res_offset = verb_end + strlen(" ");
	const char *resource_end = strnstr(res_offset, " ", sizeof(out->resource));
	if (resource_end == NULL)
		goto error;

	const size_t c_resource_size = resource_end - res_offset;
	const size_t resource_size = c_resource_size >= sizeof(out->resource) ? sizeof(out->resource) : c_resource_size;
	strncpy(out->resource, res_offset, resource_size);

	/* Parse full header here. */
	size_t header_length = 0;
	int found_end = 0;
	while (header_length + 3 <= num_read) {
		if (to_read[header_length] == '\r' &&
		    to_read[header_length + 1] == '\n' &&
		    to_read[header_length + 2] == '\r' &&
		    to_read[header_length + 3] == '\n') {
			header_length += 4;
			found_end = 1;
			break;
		}
		header_length++;
	}

	if (!found_end) {
		m38_log_msg(LOG_DEBUG, "Could not find end of HTTP header.");
		goto error;
	}

	out->full_header = strndup((char *)to_read, header_length);
	out->header_len = header_length;

	return 0;

error:
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
leaq 0x2ad1(%rip), %rsi      # 0xbb7d
movl $0x400, %edx            # imm = 0x400
callq 0x32a0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x9196
movq %rax, %r13
subq %r15, %rax
cmpq $0xf, %rax
movl $0xf, %edx
cmovbq %rax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x30a0
incq %r13
leaq 0x2a91(%rip), %rsi      # 0xbb7d
movl $0x200, %ebp            # imm = 0x200
movl $0x200, %edx            # imm = 0x200
movq %r13, %rdi
callq 0x32a0
testq %rax, %rax
je 0x9196
subq %r13, %rax
cmpq %rbp, %rax
cmovaeq %rbp, %rax
leaq 0x10(%r14), %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x30a0
cmpq $0x3, %r12
setb %al
jae 0x912e
xorl %r13d, %r13d
jmp 0x9162
movl $0x3, %r13d
cmpb $0xd, -0x3(%r15,%r13)
jne 0x9153
cmpb $0xa, -0x2(%r15,%r13)
jne 0x9153
cmpb $0xd, -0x1(%r15,%r13)
jne 0x9153
cmpb $0xa, (%r15,%r13)
je 0x91a7
incq %r13
cmpq %r12, %r13
seta %al
jbe 0x9134
addq $-0x3, %r13
testb $0x1, %al
je 0x917b
leaq 0x2aba(%rip), %rsi      # 0xbc27
movl $0x1, %edi
xorl %eax, %eax
callq 0x3540
jmp 0x9196
movq %r15, %rdi
movq %r13, %rsi
callq 0x32d0
movq %rax, 0x230(%r14)
movq %r13, 0x238(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %r13
jmp 0x9162
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
addq 0x238(%rcx), %r14
cmpq %rdi, %rsi
jne 0x91d8
movq %r15, 0x248(%rbx)
movq %r14, %rdi
movq %r15, %rsi
jmp 0x91fd
movq %rdi, %r12
jbe 0x9237
leaq 0x2a66(%rip), %rsi      # 0xbc4a
movl $0x1, %edi
xorl %eax, %eax
callq 0x3540
movq %r12, 0x248(%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
movq %rax, %r14
movq %r14, 0x240(%rbx)
xorl %eax, %eax
testq %r14, %r14
jne 0x922b
leaq 0x2af6(%rip), %rsi      # 0xbd10
movl $0x2, %edi
xorl %eax, %eax
callq 0x3540
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
testq %r15, %r15
sete %al
cmpq %r12, %r15
setae %cl
orb %al, %cl
jne 0x925f
leaq 0x2a40(%rip), %rsi      # 0xbc8e
movl $0x1, %edi
xorl %eax, %eax
callq 0x3540
jmp 0x91c9
leaq 0x2a6b(%rip), %rsi      # 0xbcd1
xorl %r14d, %r14d
movl $0x1, %edi
xorl %eax, %eax
callq 0x3540
jmp 0x9205
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq $0x0, (%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x240(%rdi), %r14
xorl %eax, %eax
callq 0x31d0
movq %rax, 0x8(%rsp)
leaq 0x2a93(%rip), %rsi      # 0xbd3f
movq %r14, %rdi
callq 0x33d0
movq %rax, (%rsp)
testq %rax, %rax
je 0x939f
leaq 0x290e(%rip), %r12      # 0xbbd6
movq %rsp, %r13
leaq 0x2a6d(%rip), %r15      # 0xbd3f
movq %r13, %rdi
movq %r12, %rsi
callq 0x33d0
movq %rax, %rbx
movq %r13, %rdi
movq %r12, %rsi
callq 0x33d0
movq %rax, %rbp
testq %rbx, %rbx
setne %al
testq %rbp, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x9387
movq %r12, %r13
movq %r14, %r12
movq %r15, %r14
movq %rbp, %rdi
callq 0x3150
movl $0x1, %edi
movq %rax, %rsi
callq 0x32e0
movq %rax, %r15
movq %rbp, %rdi
movq %rax, %rsi
callq 0x30e0
testl %eax, %eax
jle 0x9360
movq %rbx, %rdi
callq 0x3150
movq %rax, %rbp
movq %r15, %rdi
callq 0x3150
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movq %rax, %r8
callq 0x3300
jmp 0x9373
movl $0x2, %edi
leaq 0x29d5(%rip), %rsi      # 0xbd41
xorl %eax, %eax
callq 0x3540
movq %r15, %rdi
callq 0x3050
movq %r14, %r15
movq %r12, %r14
movq %r13, %r12
movq %rsp, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x33d0
movq %rax, (%rsp)
testq %rax, %rax
jne 0x92d2
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x250(%rax)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/perftests/kvldsclean/main.c
// Function: batch_set
static int
batch_set(struct wire_requestqueue * Q, size_t start, size_t N)
{
	struct many_state C;
	char buf[9];
	size_t x;
	struct kvldskey * key;

	/* Not failed or done yet.  No requests in progress yet. */
	C.failed = C.done = 0;
	C.Nip = 0;

	/* Set values. */
	for (x = start; x < start + N; x++) {
		/* Set "$x" = "$x". */
		sprintf(buf, "%08zu", x);
		if ((key = kvldskey_create((uint8_t *)buf, 8)) == NULL)
			goto err0;
		if (proto_kvlds_request_set(Q, key, key, callback_done, &C)) {
			warnp("Failed to send SET request");
			goto err1;
		}
		C.Nip += 1;
		kvldskey_free(key);
	}

	/* Spin until the requests are done. */
	if (events_spin(&C.done) || C.failed) {
		warnp("SET request failed");
		return (-1);
	}

	/* Success! */
	return (0);

err1:
	kvldskey_free(key);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
testq %rdx, %rdx
je 0x29e5
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
addq %rsi, %r14
leaq 0x1f(%rsp), %rbp
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rbp, %rdi
leaq 0x77d4(%rip), %rsi      # 0xa166
movq %r15, %rdx
xorl %eax, %eax
callq 0x22c0
movl $0x8, %esi
movq %rbp, %rdi
callq 0x5514
testq %rax, %rax
je 0x2a6c
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
movq %rax, %rdx
leaq 0x1da(%rip), %rcx       # 0x2b9f
movq %rsp, %r8
callq 0x5745
testl %eax, %eax
jne 0x2a1d
incq (%rsp)
movq %r13, %rdi
callq 0x2040
incq %r15
cmpq %r14, %r15
jb 0x2988
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x2e7d
xorl %ebx, %ebx
orl -0x4(%r14), %eax
je 0x2a6c
callq 0x2090
cmpl $0x0, (%rax)
je 0x2a41
movq %rax, %rbx
leaq 0x7779(%rip), %rdi      # 0xa187
xorl %eax, %eax
callq 0x52d0
movl $0x0, (%rbx)
jmp 0x2a4f
callq 0x2090
cmpl $0x0, (%rax)
je 0x2a56
movq %rax, %r14
leaq 0x773b(%rip), %rdi      # 0xa16c
xorl %eax, %eax
callq 0x52d0
movl $0x0, (%r14)
jmp 0x2a64
leaq 0x773f(%rip), %rdi      # 0xa187
xorl %eax, %eax
callq 0x53ef
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2a6c
leaq 0x770f(%rip), %rdi      # 0xa16c
xorl %eax, %eax
callq 0x53ef
movq %r13, %rdi
callq 0x2040
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/perftests/kvldsclean/main.c
// Function: batch_delete
static int
batch_delete(struct wire_requestqueue * Q, size_t start, size_t N)
{
	struct many_state C;
	char buf[9];
	size_t x;
	struct kvldskey * key;

	/* Not failed or done yet.  No requests in progress yet. */
	C.failed = C.done = 0;
	C.Nip = 0;

	/* Set values. */
	for (x = start; x < start + N; x++) {
		/* Delete "$x". */
		sprintf(buf, "%08zu", x);
		if ((key = kvldskey_create((uint8_t *)buf, 8)) == NULL)
			goto err0;
		if (proto_kvlds_request_delete(Q, key, callback_done, &C)) {
			warnp("Failed to send DELETE request");
			goto err1;
		}
		C.Nip += 1;
		kvldskey_free(key);
	}

	/* Spin until the requests are done. */
	if (events_spin(&C.done) || C.failed) {
		warnp("DELETE request failed");
		return (-1);
	}

	/* Success! */
	return (0);

err1:
	kvldskey_free(key);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
testq %rdx, %rdx
je 0x2b07
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
addq %rsi, %r14
leaq 0x1f(%rsp), %rbp
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %rbp, %rdi
leaq 0x76af(%rip), %rsi      # 0xa166
movq %r15, %rdx
xorl %eax, %eax
callq 0x22c0
movl $0x8, %esi
movq %rbp, %rdi
callq 0x5514
testq %rax, %rax
je 0x2b8e
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
leaq 0xb8(%rip), %rdx        # 0x2b9f
movq %rsp, %rcx
callq 0x5dfe
testl %eax, %eax
jne 0x2b3f
incq (%rsp)
movq %r13, %rdi
callq 0x2040
incq %r15
cmpq %r14, %r15
jb 0x2aad
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x2e7d
xorl %ebx, %ebx
orl -0x4(%r14), %eax
je 0x2b8e
callq 0x2090
cmpl $0x0, (%rax)
je 0x2b63
movq %rax, %rbx
leaq 0x7688(%rip), %rdi      # 0xa1b8
xorl %eax, %eax
callq 0x52d0
movl $0x0, (%rbx)
jmp 0x2b71
callq 0x2090
cmpl $0x0, (%rax)
je 0x2b78
movq %rax, %r14
leaq 0x7647(%rip), %rdi      # 0xa19a
xorl %eax, %eax
callq 0x52d0
movl $0x0, (%r14)
jmp 0x2b86
leaq 0x764e(%rip), %rdi      # 0xa1b8
xorl %eax, %eax
callq 0x53ef
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x2b8e
leaq 0x761b(%rip), %rdi      # 0xa19a
xorl %eax, %eax
callq 0x53ef
movq %r13, %rdi
callq 0x2040
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_1/exercise_1_11/word_count_test.c
// Function: main
int main(void)
{
  char nl;
  char nw;
  char nc;

  int state;

  nl = nw = nc = 0;
  state = OUT;

  char c;
  while ((c = getchar()) != EOF)
  {
    ++nc;

    if (c == '\n')
    {
      ++nl;
    }

    if (c == ' ' || c == '\n' || c == '\t')
    {
      state = OUT;
    }
    else if (state == OUT)
    {
      state = IN;
      ++nw;
    }
  }

  printf("lines: %d\nwords: %d\ncharacters: %d\n", nl, nw, nc);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x1040
shll $0x18, %eax
xorl %edx, %edx
movl $0x0, %ecx
movl $0x0, %esi
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x11c7
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl $0xa000000, %eax        # imm = 0xA000000
sete %cl
cmpl $0x9000000, %eax        # imm = 0x9000000
je 0x1195
cmpl $0xa000000, %eax        # imm = 0xA000000
je 0x1195
cmpl $0x20000000, %eax       # imm = 0x20000000
jne 0x119a
xorl %r15d, %r15d
jmp 0x11a8
cmpl $0x1, %r15d
adcb $0x0, %r14b
movl $0x1, %r15d
addb %cl, %bl
callq 0x1040
shll $0x18, %eax
incb %bpl
cmpl $0xff000000, %eax       # imm = 0xFF000000
jne 0x1178
movsbl %bl, %esi
movsbl %r14b, %edx
movsbl %bpl, %ecx
leaq 0xe36(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/theovosse[P]llgen/llgen.c
// Function: yyerror
void yyerror(char *format, ...) { /* Called by yyparse on error */
	va_list args;

	errorOccurred = true;
	(void) fprintf(stderr, "%s:%d: ", inputFileName, lineNumber);
	va_start(args, format);
	vfprintf(stderr, format, args);
	fprintf(stderr, "\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %r14
movq %rsi, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
testb %al, %al
je 0x32b3
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movb $0x1, 0x16854(%rip)     # 0x19b0e
movq 0x15d37(%rip), %r15     # 0x18ff8
movq (%r15), %rdi
movq 0x15ebd(%rip), %rdx     # 0x19188
leaq 0x15ed2(%rip), %rax     # 0x191a4
movl (%rax), %ecx
leaq 0xdfb9(%rip), %rsi      # 0x11294
xorl %eax, %eax
callq 0x3160
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rsp, %rdx
movq %rax, (%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movq %r14, 0x10(%rdx)
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x31d0
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x3130
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/theovosse[P]llgen/regexp.c
// Function: OutOfMemory
static void OutOfMemory(char *func) {
	(void) fprintf(stderr, "Out of memory in %s\n", func);
	(void) fprintf(stderr, "%ld bytes allocated\n", totalMalloc);
	(void) fprintf(stderr, "%ld transitions\n", nrTransition);
	(void) fprintf(stderr, "%ld sets\n", nrSet);
	(void) fprintf(stderr, "%ld regexps\n", nrRegExp);
}

// Assembly:
pushq %rbx
movq %rdi, %rdx
movq 0x15620(%rip), %rbx     # 0x18ff8
movq (%rbx), %rdi
leaq 0xf686(%rip), %rsi      # 0x13068
xorl %eax, %eax
callq 0x3160
movq (%rbx), %rdi
movq 0x1827d(%rip), %rdx     # 0x1bc70
leaq 0xf683(%rip), %rsi      # 0x1307d
xorl %eax, %eax
callq 0x3160
movq (%rbx), %rdi
movq 0x1826d(%rip), %rdx     # 0x1bc78
leaq 0xf680(%rip), %rsi      # 0x13092
xorl %eax, %eax
callq 0x3160
movq (%rbx), %rdi
movq 0x1825d(%rip), %rdx     # 0x1bc80
leaq 0xf679(%rip), %rsi      # 0x130a3
xorl %eax, %eax
callq 0x3160
movq (%rbx), %rdi
movq 0x1824d(%rip), %rdx     # 0x1bc88
leaq 0xf66b(%rip), %rsi      # 0x130ad
xorl %eax, %eax
popq %rbx
jmp 0x3160