// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/greshunkel.c
// Function: interpolate_conditionals
static line
_interpolate_conditionals(const greshunkel_ctext *ctext, const char *buf, size_t *num_read, const struct compiled_regex *all_regex) {
	line to_return = {0};
	*num_read = 0;

	match_t match[4] = {{0}};
	if (regexec_2_0_beta(&all_regex->c_conditional_inverse_regex, buf, 3, match) == 0) {
		const match_t conditional_variable = match[1];
		match_t conditional_meat = match[2];
		/* Make sure they were matched: */
		assert(conditional_variable.rm_so != -1 && conditional_variable.rm_eo != -1);
		assert(conditional_meat.rm_so != -1 && conditional_meat.rm_eo != -1);

		size_t possible_dif = 0;
		const char *closest_endif = NULL;
		closest_endif = strstr(conditional_meat.start, "xXx ENDLESS xXx");
		possible_dif = closest_endif - buf;
		if (possible_dif != (unsigned int)conditional_meat.rm_so) {
			conditional_meat.rm_eo = possible_dif;
			conditional_meat.len = conditional_meat.rm_eo - conditional_meat.rm_so;
		}

		/* We found a conditioanl. */
		*num_read = conditional_meat.rm_eo + strlen("xXx ENDLESS xXx");

		char just_match_str[conditional_variable.len + 1];
		just_match_str[conditional_variable.len] = '\0';
		strncpy(just_match_str, conditional_variable.start, conditional_variable.len);

		/* TODO: Support a boolean type. */
		/*if (!((tuple = find_needle(ctext, just_match_str, 1)) && tuple->type == GSHKL_BOOL)) { */
		const greshunkel_tuple *tuple = NULL;
		char *sub_ctext_match = NULL;
		int should_render = 0;
		if ((tuple = find_needle(ctext, just_match_str, 1))) {
			if (_is_truthy(tuple)) {
				should_render = 1;
			}
		} else if ((sub_ctext_match = strchr(just_match_str, '.')) != NULL) {
			/* TODO: Check sub-context. */
			char sub_context_name[MAX_GSHKL_STR_SIZE] = {0};
			char sub_item_name[MAX_GSHKL_STR_SIZE] = {0};
			memcpy(sub_context_name, just_match_str, sub_ctext_match - just_match_str);
			memcpy(sub_item_name, sub_ctext_match + strlen("."), conditional_variable.len - strlen(sub_context_name) + strlen("."));

			if ((tuple = find_needle(ctext, sub_context_name, 1)) && tuple->type == GSHKL_SUBCTEXT) {
				const greshunkel_ctext *sub_ctext = tuple->value.sub_ctext;

				unsigned int i;
				for (i = 0; i < sub_ctext->values->count; i++) {
					const greshunkel_tuple *sub_tuple = vector_get(sub_ctext->values, i);
					const char *_name = sub_tuple->name;
					const size_t larger = strlen(_name) > strlen(sub_item_name) ?
							strlen(_name) : strlen(sub_item_name);

					if (strncmp(_name, sub_item_name, larger) == 0 && _is_falsey(sub_tuple)) {
							should_render = 1;
					}
				}
			}
		}

		if (should_render) {
			line to_render_line;
			to_render_line.data = strndup(conditional_meat.start, conditional_meat.len);
			to_render_line.size = conditional_meat.len;

			line rendered_piece = {0};

			/* Recurse contexts until my fucking mind melts. */
			greshunkel_ctext *_temp_ctext = _gshkl_init_child_context(ctext);
			rendered_piece.data = gshkl_render(_temp_ctext, to_render_line.data, to_render_line.size, &rendered_piece.size);
			gshkl_free_context(_temp_ctext);

			const size_t old_size = to_return.size;
			to_return.size += rendered_piece.size;
			if (old_size <= 0) {
				to_return.data = calloc(1, to_return.size);
			} else {
				to_return.data = realloc(to_return.data, to_return.size);
			}

			memcpy(to_return.data + old_size, rendered_piece.data, rendered_piece.size);
			free(rendered_piece.data);
			free(to_render_line.data);
		}
	} else if (regexec_2_0_beta(&all_regex->c_conditional_regex, buf, 3, match) == 0) {
		const match_t conditional_variable = match[1];
		match_t conditional_meat = match[2];

		assert(conditional_variable.rm_so != -1 && conditional_variable.rm_eo != -1);
		assert(conditional_meat.rm_so != -1 && conditional_meat.rm_eo != -1);

		size_t possible_dif = 0;
		const char *closest_endif = NULL;
		closest_endif = strstr(conditional_meat.start, "xXx ENDLESS xXx");
		possible_dif = closest_endif - buf;
		if (possible_dif != (unsigned int)conditional_meat.rm_so) {
			conditional_meat.rm_eo = possible_dif;
			conditional_meat.len = conditional_meat.rm_eo - conditional_meat.rm_so;
		}

		/* We found a conditioanl. */
		*num_read = conditional_meat.rm_eo + strlen("xXx ENDLESS xXx");

		char just_match_str[conditional_variable.len + 1];
		just_match_str[conditional_variable.len] = '\0';
		strncpy(just_match_str, conditional_variable.start, conditional_variable.len);

		/* TODO: Support a boolean type. */
		/*if (!((tuple = find_needle(ctext, just_match_str, 1)) && tuple->type == GSHKL_BOOL)) */
		const greshunkel_tuple *tuple = NULL;
		char *sub_ctext_match = NULL;
		int should_render = 0;
		if (!(tuple = find_needle(ctext, just_match_str, 1))) {
			if ((sub_ctext_match = strchr(just_match_str, '.')) != NULL) {
				/* TODO: Check sub-context. */
				char sub_context_name[MAX_GSHKL_STR_SIZE] = {0};
				char sub_item_name[MAX_GSHKL_STR_SIZE] = {0};
				memcpy(sub_context_name, just_match_str, sub_ctext_match - just_match_str);
				memcpy(sub_item_name, sub_ctext_match + strlen("."), conditional_variable.len - strlen(sub_context_name) + strlen("."));

				if ((tuple = find_needle(ctext, sub_context_name, 1)) && tuple->type == GSHKL_SUBCTEXT) {
					const greshunkel_ctext *sub_ctext = tuple->value.sub_ctext;

					unsigned int i;
					for (i = 0; i < sub_ctext->values->count; i++) {
						const greshunkel_tuple *sub_tuple = vector_get(sub_ctext->values, i);
						const char *_name = sub_tuple->name;
						const size_t larger = strlen(_name) > strlen(sub_item_name) ?
								strlen(_name) : strlen(sub_item_name);

						if (strncmp(_name, sub_item_name, larger) == 0 &&
							_is_truthy(sub_tuple)) {
								should_render = 1;
						}
					}
				}
			} else {
				should_render = 1;
			}
		} else {
			if (_is_falsey(tuple)) {
				should_render = 1;
			} else if ((sub_ctext_match = strchr(just_match_str, '.')) != NULL) {
				/* TODO: Check sub-context. */
				char sub_context_name[MAX_GSHKL_STR_SIZE] = {0};
				char sub_item_name[MAX_GSHKL_STR_SIZE] = {0};
				memcpy(sub_context_name, just_match_str, sub_ctext_match - just_match_str);
				memcpy(sub_item_name, sub_ctext_match + strlen("."), conditional_variable.len - strlen(sub_context_name) + strlen("."));

				if ((tuple = find_needle(ctext, sub_context_name, 1)) && tuple->type == GSHKL_SUBCTEXT) {
					const greshunkel_ctext *sub_ctext = tuple->value.sub_ctext;

					unsigned int i;
					for (i = 0; i < sub_ctext->values->count; i++) {
						const greshunkel_tuple *sub_tuple = vector_get(sub_ctext->values, i);
						const char *_name = sub_tuple->name;
						const size_t larger = strlen(_name) > strlen(sub_item_name) ?
								strlen(_name) : strlen(sub_item_name);

						if (strncmp(_name, sub_item_name, larger) == 0 &&
							_is_truthy(sub_tuple)) {
								should_render = 1;
						}
					}
				}
			}
		}

		if (should_render) {
			line to_render_line;
			to_render_line.data = strndup(conditional_meat.start, conditional_meat.len);
			to_render_line.size = conditional_meat.len;

			/* TODO: This should use gshkl_render. See _interpolate_loop */
			line rendered_piece = _interpolate_line(ctext, to_render_line, all_regex);

			const size_t old_size = to_return.size;
			to_return.size += rendered_piece.size;
			if (old_size <= 0) {
				to_return.data = calloc(1, to_return.size);
			} else {
				to_return.data = realloc(to_return.data, to_return.size);
			}

			memcpy(to_return.data + old_size, rendered_piece.data, rendered_piece.size);
			if (rendered_piece.data != to_render_line.data)
				free(rendered_piece.data);
			free(to_render_line.data);
		}
	}

	return to_return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
movq $0x0, (%rdx)
xorps %xmm0, %xmm0
leaq -0xc0(%rbp), %rcx
movaps %xmm0, 0x50(%rcx)
movaps %xmm0, 0x40(%rcx)
movaps %xmm0, 0x30(%rcx)
movaps %xmm0, 0x20(%rcx)
movaps %xmm0, 0x10(%rcx)
movaps %xmm0, (%rcx)
leaq 0x1c0(%r15), %rdi
movl $0x3, %edx
callq 0x3b54
testl %eax, %eax
je 0x2ec7
leaq 0x180(%r15), %rdi
leaq -0xc0(%rbp), %rcx
movl $0x3, %edx
movq %rbx, %rsi
callq 0x3b54
xorl %r13d, %r13d
movq %r15, %rcx
movl $0x0, %r15d
testl %eax, %eax
jne 0x378f
movq %rcx, -0x58(%rbp)
cmpl $-0x1, -0xa8(%rbp)
je 0x37ea
cmpl $-0x1, -0xa4(%rbp)
je 0x37ea
movq %r14, -0x40(%rbp)
movl -0x90(%rbp), %r13d
cmpl $-0x1, %r13d
je 0x3809
movl -0x8c(%rbp), %r15d
cmpl $-0x1, %r15d
je 0x3809
movq -0xa0(%rbp), %r14
movq -0x98(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x80(%rbp), %rdi
leaq 0x3a5d(%rip), %rsi      # 0x6897
movq %rdi, -0x50(%rbp)
callq 0x1200
subq %rbx, %rax
movl %eax, %ecx
subl %r13d, %ecx
cmpq %r13, %rax
movslq %ecx, %r13
cmovnel %eax, %r15d
cmoveq -0x38(%rbp), %r13
movq %rsp, -0x38(%rbp)
movslq %r15d, %rax
addq $0xf, %rax
movq %rax, (%r12)
movq %rsp, %r15
leaq 0x10(%r14), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movb $0x0, (%r14,%r15)
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq %r14, -0x30(%rbp)
movq %r14, %rdx
callq 0x1050
movl $0x1, %r14d
movq -0x40(%rbp), %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x3c01
testq %rax, %rax
je 0x3203
movl 0x20(%rax), %ecx
cmpl $0x1, %ecx
jne 0x33f6
cmpb $0x0, 0x28(%rax)
jmp 0x33ff
movq %r14, -0x40(%rbp)
cmpl $-0x1, -0xa8(%rbp)
je 0x37ac
cmpl $-0x1, -0xa4(%rbp)
je 0x37ac
movq %r12, -0x30(%rbp)
movl -0x90(%rbp), %r15d
cmpl $-0x1, %r15d
je 0x37cb
movl -0x8c(%rbp), %r14d
cmpl $-0x1, %r14d
je 0x37cb
movq -0xa0(%rbp), %r12
movq -0x98(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x88(%rbp), %r13
movq -0x80(%rbp), %rdi
leaq 0x3968(%rip), %rsi      # 0x6897
movq %rdi, -0x48(%rbp)
callq 0x1200
subq %rbx, %rax
movl %eax, %ecx
subl %r15d, %ecx
cmpq %r15, %rax
movslq %ecx, %rcx
cmovnel %eax, %r14d
cmoveq %r13, %rcx
movq %r12, %r13
movq %rcx, -0x50(%rbp)
movq %rsp, -0x38(%rbp)
movslq %r14d, %rax
addq $0xf, %rax
movq -0x30(%rbp), %rcx
movq %rax, (%rcx)
movq %rsp, %rbx
leaq 0x10(%r12), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
movb $0x0, (%r12,%rbx)
movq %rbx, %rdi
movq -0x58(%rbp), %rsi
movq %r12, %rdx
callq 0x1050
movq -0x40(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x3c01
testq %rax, %rax
je 0x2fc9
movl 0x20(%rax), %edx
xorl %ebx, %ebx
cmpl $0x2, %edx
sete %bl
xorl %ecx, %ecx
cmpl $0x1, %edx
sete %sil
jne 0x3198
cmpb $0x0, 0x28(%rax)
jmp 0x31a1
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x10d0
testq %rax, %rax
je 0x3782
movq %rax, %r15
leaq -0x4c0(%rbp), %r12
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x1120
leaq -0x2c0(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x1120
movq %r15, %rdx
subq %rbx, %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1190
incq %r15
movq %r12, %rdi
callq 0x10c0
subq %rax, %r13
incq %r13
leaq -0x2c0(%rbp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x1190
movq %r14, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x3c01
movb $0x1, %cl
testq %rax, %rax
je 0x3494
cmpl $0x2, 0x20(%rax)
jne 0x3494
movq 0x28(%rax), %r12
movq (%r12), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x3494
movl $0x0, -0x30(%rbp)
xorl %r13d, %r13d
movl %r13d, %esi
callq 0x4baf
movq %rax, %rbx
movq %rax, %rdi
callq 0x10c0
movq %rax, %r15
leaq -0x2c0(%rbp), %r14
movq %r14, %rdi
callq 0x10c0
cmpq %rax, %r15
cmovbeq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1060
testl %eax, %eax
jne 0x3177
movl 0x20(%rbx), %eax
cmpl $0x1, %eax
jne 0x30d1
cmpb $0x0, 0x28(%rbx)
jmp 0x30da
testl %eax, %eax
jne 0x30f8
cmpq $0x0, 0x28(%rbx)
sete %cl
testb %cl, %cl
je 0x30f8
xorl %ebx, %ebx
movl $0x1, %edi
leaq 0x38c1(%rip), %rsi      # 0x69b0
xorl %eax, %eax
callq 0x4818
jmp 0x3167
cmpl $0x1, %eax
jne 0x312a
addq $0x28, %rbx
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x1f0e(%rip), %rsi      # 0x501e
callq 0x1060
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
movl $0x1, %edi
leaq 0x3819(%rip), %rsi      # 0x6941
jmp 0x315e
testl %eax, %eax
je 0x3144
xorl %ebx, %ebx
cmpl $0x2, %eax
setne %bl
movl $0x1, %edi
leaq 0x3847(%rip), %rsi      # 0x6989
jmp 0x315e
movq 0x28(%rbx), %rax
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rax)
sete %bl
movl $0x1, %edi
leaq 0x3800(%rip), %rsi      # 0x695e
movl %ebx, %edx
xorl %eax, %eax
callq 0x4818
testl %ebx, %ebx
movl $0x1, %eax
movl -0x30(%rbp), %ecx
cmovnel %eax, %ecx
movl %ecx, -0x30(%rbp)
incl %r13d
movq (%r12), %rdi
cmpq %r13, 0x10(%rdi)
ja 0x3081
cmpl $0x0, -0x30(%rbp)
sete %cl
movq -0x40(%rbp), %r14
jmp 0x3494
testl %edx, %edx
jne 0x31cf
cmpq $0x0, 0x28(%rax)
sete %dil
testb %dil, %dil
je 0x31cf
movb %sil, %cl
leaq 0x376c(%rip), %rsi      # 0x6920
movl $0x1, %edi
xorl %edx, %edx
movl %ebx, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x4818
xorl %ebx, %ebx
jmp 0x348f
cmpl $0x1, %edx
jne 0x33e2
addq $0x28, %rax
leaq 0x1e3b(%rip), %rsi      # 0x501e
movl $0x5, %edx
movq %rax, %rdi
callq 0x1060
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
leaq 0x36a9(%rip), %rsi      # 0x68a7
jmp 0x3481
movq %r15, %rdi
movl $0x2e, %esi
callq 0x10d0
testq %rax, %rax
je 0x3720
movq %rax, %rbx
leaq -0x4c0(%rbp), %r12
xorl %r14d, %r14d
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x1120
leaq -0x2c0(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x1120
movq %rbx, %rdx
subq %r15, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x1190
incq %rbx
movq %r12, %rdi
callq 0x10c0
movq -0x30(%rbp), %rdx
subq %rax, %rdx
incq %rdx
leaq -0x2c0(%rbp), %rdi
movq %rbx, %rsi
callq 0x1190
movq -0x40(%rbp), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x3c01
testq %rax, %rax
movq %r13, -0x48(%rbp)
je 0x371c
cmpl $0x2, 0x20(%rax)
jne 0x371c
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq (%rax), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x371c
xorl %r13d, %r13d
xorl %r14d, %r14d
movl %r13d, %esi
callq 0x4baf
movq %rax, %r12
movq %rax, %rdi
callq 0x10c0
movq %rax, %rbx
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
callq 0x10c0
cmpq %rax, %rbx
cmovbeq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1060
testl %eax, %eax
jne 0x33c9
movl 0x20(%r12), %eax
xorl %ebx, %ebx
cmpl $0x2, %eax
sete %bl
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %dl
jne 0x3322
cmpb $0x0, 0x28(%r12)
jmp 0x332c
testl %eax, %eax
jne 0x3356
cmpq $0x0, 0x28(%r12)
sete %sil
testb %sil, %sil
je 0x3356
movb %dl, %cl
movl $0x1, %edi
leaq 0x35dd(%rip), %rsi      # 0x6920
xorl %edx, %edx
movl %ebx, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x4818
xorl %ebx, %ebx
jmp 0x33be
cmpl $0x1, %eax
jne 0x3388
addq $0x28, %r12
movl $0x5, %edx
movq %r12, %rdi
leaq 0x1cb0(%rip), %rsi      # 0x501e
callq 0x1060
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movl $0x1, %edi
leaq 0x3521(%rip), %rsi      # 0x68a7
jmp 0x33b5
testl %eax, %eax
je 0x339a
movl $0x1, %edi
leaq 0x3560(%rip), %rsi      # 0x68f8
jmp 0x33b5
movq 0x28(%r12), %rax
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rax)
setne %bl
movl $0x1, %edi
leaq 0x3518(%rip), %rsi      # 0x68cd
movl %ebx, %edx
xorl %eax, %eax
callq 0x4818
testl %ebx, %ebx
movl $0x1, %eax
cmovnel %eax, %r14d
incl %r13d
movq -0x30(%rbp), %rax
movq (%rax), %rdi
cmpq %r13, 0x10(%rdi)
ja 0x32c1
jmp 0x371c
testl %edx, %edx
je 0x346c
leaq 0x3507(%rip), %rsi      # 0x68f8
jmp 0x3481
testl %ecx, %ecx
jne 0x3420
cmpq $0x0, 0x28(%rax)
sete %dl
testb %dl, %dl
je 0x3420
leaq 0x35a3(%rip), %rsi      # 0x69b0
xorl %ebx, %ebx
movl $0x1, %edi
xorl %eax, %eax
callq 0x4818
jmp 0x353a
cmpl $0x1, %ecx
jne 0x3450
addq $0x28, %rax
leaq 0x1bee(%rip), %rsi      # 0x501e
movl $0x5, %edx
movq %rax, %rdi
callq 0x1060
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
leaq 0x34f6(%rip), %rsi      # 0x6941
jmp 0x352c
testl %ecx, %ecx
je 0x3517
xorl %ebx, %ebx
cmpl $0x2, %ecx
setne %bl
leaq 0x3522(%rip), %rsi      # 0x6989
jmp 0x352c
movq 0x28(%rax), %rax
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rax)
setne %bl
leaq 0x344c(%rip), %rsi      # 0x68cd
movl $0x1, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x4818
testl %ebx, %ebx
sete %cl
xorl %r13d, %r13d
testb %cl, %cl
jne 0x3785
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %r13
movq %r13, %rsi
callq 0x1150
movq %rax, %rbx
xorps %xmm0, %xmm0
leaq -0x4c0(%rbp), %r12
movaps %xmm0, (%r12)
callq 0x1d48
movq %rax, %r15
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x24d1
movq %rax, 0x8(%r12)
movq %r15, %rdi
callq 0x246c
movq (%r12), %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0x1160
movq %rax, %r13
movq 0x8(%r12), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1190
jmp 0x3770
movq 0x28(%rax), %rax
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rax)
sete %bl
leaq 0x3432(%rip), %rsi      # 0x695e
movl $0x1, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x4818
testl %ebx, %ebx
jne 0x3720
movq %r15, %rdi
movl $0x2e, %esi
callq 0x10d0
testq %rax, %rax
je 0x37a4
movq %rax, %r12
leaq -0x4c0(%rbp), %rbx
xorl %r14d, %r14d
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1120
leaq -0x2c0(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x1120
movq %r12, %rdx
subq %r15, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1190
incq %r12
movq %rbx, %rdi
callq 0x10c0
movq -0x30(%rbp), %rdx
subq %rax, %rdx
incq %rdx
leaq -0x2c0(%rbp), %rdi
movq %r12, %rsi
callq 0x1190
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x3c01
testq %rax, %rax
movq %r13, -0x48(%rbp)
je 0x371c
cmpl $0x2, 0x20(%rax)
jne 0x371c
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq (%rax), %rdi
cmpq $0x0, 0x10(%rdi)
je 0x371c
xorl %r13d, %r13d
xorl %r14d, %r14d
movl %r13d, %esi
callq 0x4baf
movq %rax, %r12
movq %rax, %rdi
callq 0x10c0
movq %rax, %rbx
leaq -0x2c0(%rbp), %r15
movq %r15, %rdi
callq 0x10c0
cmpq %rax, %rbx
cmovbeq %rax, %rbx
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1060
testl %eax, %eax
jne 0x3708
movl 0x20(%r12), %eax
xorl %ebx, %ebx
cmpl $0x2, %eax
sete %bl
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %dl
jne 0x3661
cmpb $0x0, 0x28(%r12)
jmp 0x366b
testl %eax, %eax
jne 0x3695
cmpq $0x0, 0x28(%r12)
sete %sil
testb %sil, %sil
je 0x3695
movb %dl, %cl
movl $0x1, %edi
leaq 0x329e(%rip), %rsi      # 0x6920
xorl %edx, %edx
movl %ebx, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x4818
xorl %ebx, %ebx
jmp 0x36fd
cmpl $0x1, %eax
jne 0x36c7
addq $0x28, %r12
movl $0x5, %edx
movq %r12, %rdi
leaq 0x1971(%rip), %rsi      # 0x501e
callq 0x1060
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movl $0x1, %edi
leaq 0x31e2(%rip), %rsi      # 0x68a7
jmp 0x36f4
testl %eax, %eax
je 0x36d9
movl $0x1, %edi
leaq 0x3221(%rip), %rsi      # 0x68f8
jmp 0x36f4
movq 0x28(%r12), %rax
xorl %ebx, %ebx
cmpq $0x0, 0x10(%rax)
setne %bl
movl $0x1, %edi
leaq 0x31d9(%rip), %rsi      # 0x68cd
movl %ebx, %edx
xorl %eax, %eax
callq 0x4818
testl %ebx, %ebx
movl $0x1, %eax
cmovnel %eax, %r14d
incl %r13d
movq -0x30(%rbp), %rax
movq (%rax), %rdi
cmpq %r13, 0x10(%rdi)
ja 0x3600
movq -0x48(%rbp), %r13
testl %r14d, %r14d
je 0x3782
movq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x1150
movq %rax, %rbx
movq -0x40(%rbp), %rdi
movq %r13, %rsi
movq %rax, %rdx
movq -0x58(%rbp), %rcx
callq 0x3828
movq %rax, %r15
movq %rdx, %r14
movl $0x1, %edi
movq %rax, %rsi
callq 0x1160
movq %rax, %r13
movq %rax, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1190
cmpq %rbx, %r14
je 0x3778
movq %r14, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
jmp 0x3788
xorl %r13d, %r13d
xorl %r15d, %r15d
movq -0x38(%rbp), %rax
movq %rax, %rsp
movq %r15, %rax
movq %r13, %rdx
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x3720
leaq 0x2ff2(%rip), %rdi      # 0x67a5
leaq 0x2a84(%rip), %rsi      # 0x623e
leaq 0x3029(%rip), %rcx      # 0x67ea
movl $0x2f4, %edx            # imm = 0x2F4
callq 0x1110
leaq 0x3088(%rip), %rdi      # 0x685a
leaq 0x2a65(%rip), %rsi      # 0x623e
leaq 0x300a(%rip), %rcx      # 0x67ea
movl $0x2f5, %edx            # imm = 0x2F5
callq 0x1110
leaq 0x2fb4(%rip), %rdi      # 0x67a5
leaq 0x2a46(%rip), %rsi      # 0x623e
leaq 0x2feb(%rip), %rcx      # 0x67ea
movl $0x344, %edx            # imm = 0x344
callq 0x1110
leaq 0x304a(%rip), %rdi      # 0x685a
leaq 0x2a27(%rip), %rsi      # 0x623e
leaq 0x2fcc(%rip), %rcx      # 0x67ea
movl $0x345, %edx            # imm = 0x345
callq 0x1110